Patent ID: 7950012

Claim:
A method for communicating and performing synchronization operations between a main thread and a helper-thread, comprising: at runtime, executing a program in the main thread; and upon encountering a loop which has associated helper-thread code, commencing execution of the code by the helper-thread separately and in parallel with the main thread and in advance of where the main thread is executing to prefetch data items for the main thread, wherein executing the code by the helper-thread involves: prior to executing the loop, comparing an address of a first shared parallel data to be used for the loop by the helper-thread to an address of a second shared parallel data currently being accessed by the main thread and skipping execution of the loop by the helper-thread if the comparison indicates a mismatch between the address of the first shared parallel data and the address of the second shared parallel data; and periodically checking the progress of the main thread and deactivating the helper-thread if the code being executed by the helper-thread is no longer prefetching useful data for the main thread; wherein, for each load instruction in the main thread that is not used to compute a branch condition or an address, the helper-thread code includes a prefetch instruction in place of the load in the main thread.