Patent ID: 8578069

Claim:
A method for fetching control instructions for a direct memory access (DMA) engine shared between a plurality of threads, the method comprising the steps of: selecting a first thread for participation in a data transfer operation with a DMA engine; the DMA engine fetching and processing a predetermined number of control instructions for the data transfer operation with the first thread, wherein each of the control instructions includes an amount of data to transfer, at least one source location where the amount of data is transferred from, and at least one destination location where the amount of data is transferred to; determining a total amount of data transferred as a result of the data transfer operation; determining a difference between the total amount of data transferred and a threshold amount of data, wherein the threshold amount of data indicates a preferred amount of data to be transferred for the first thread; and updating, for a subsequent data transfer operation with the first thread, the predetermined number of control instructions to fetch based on the determined difference; wherein the step of updating the predetermined number of control instructions comprises: dividing the difference between the total amount of data transferred and the threshold amount of data to determine a number of control instructions to add or subtract, depending on whether the total amount of data transferred was less than or greater than the threshold amount of data, to the predetermined number; and adding or subtracting the determined number to the predetermined number of control instructions.