Releasing queue memory without the MREW lock
I know how to implement a no-wait release in my dynamic queue if somehow the ABA problem gets solved. (I also had some ideas on how to solve the ABA problem if the tail pointer never catches the head one. But that’s still very much in the design phase.) Each block gets a header element (with a tagHeader tag). Each slot in the block uses the previously unused bytes (stuffing) to store its position (index) inside the block.
A number of all not-yet-released slots is stored in the header’s value field. The second part of the Dequeue code is changed:
So what is going on here?
I tested this approach by putting initial tag switching (tagFree –> tagAllocating etc) into a critical section, thusly bypassing the ABA problem. It works but the critical section really killed the performance when number of threads got high (N = 4, M = 4 case worked well, N = 8, M = 8 did not). Labels: Delphi, multithreading, programming |
0 Comments:
Post a Comment
Links to this post:
Create a Link
<< Home