摘要:
Implementing fair scalable reader writer mutual exclusion for access to a critical section by a plurality of processing threads in a processing system is accomplished by creating a first queue node for a first thread on the first thread's stack, the queue node representing a request by the first thread to access the critical section; adding the first queue node to a queue pointed to by a single word reader writer mutex for the critical section, the queue representing a list of threads desiring access to the critical section, each queue node in the queue being on a stack of a thread of the plurality of processing threads; waiting until the first queue node has no preceding write requests as indicated by predecessor queue nodes on the queue; entering the critical section by the first thread; exiting the critical section by the first thread; and removing the first queue node from the queue.
摘要:
A loop can be executed on a parallel processor by partitioning the loop iterations into chunks of decreasing size. An increase in speed can be realized by reducing the time taken by a thread when determining the next set of iterations to be assigned to a thread. The next set of iterations can be determined from a chunk index stored in a shared variable. Using a shared variable enables threads to perform operations concurrently to reduce the wait time to the period while another thread increments the shared variable.
摘要:
An integer division system for a dividend and a divisor includes a pre-calculation module to select a reciprocal approximation and a rounding error compensation value of the divisor, and an instruction generation module to generate at least an instruction to calculate a quotient of the dividend using the reciprocal and the rounding error compensation value. The reciprocal approximation is of the same predetermined number of binary bits as the divisor and the pre-calculation module determines which one of rounding-up and rounding-down is used when selecting the reciprocal approximation and the rounding error compensation value.