ringbuf icon indicating copy to clipboard operation
ringbuf copied to clipboard

Worker-record queue

Open ulatekh opened this issue 8 years ago • 0 comments

This accomplishes the same thing that my worker-stack change tried to do, but far more efficiently, plus you can mix permanent and temporary worker-record registration. Also, according to my tests, there seems to be no change in performance.

There's a small bug-fix in the makefile. Without it, the test/stress executables can't be debugged. Trying to view variables in gdb usually results in "<optimized out>". My memory was that later flags provided to gcc override the settings in earlier flags, but that doesn't seem to be true any more. The fix was easy.

ringbuf_worker.registered is now a 64-bit field, but because that struct already had a 64-bit field, there wasn't any change in struct size. Besides, this keeps me from having to implement another compare-and-swap function.

ringbuf.first_free_worker doesn't have to be exact; the intention is to minimize the number of records that have to be searched when registering another worker. This is especially important when using lots of temporary worker-registrations.

I modified t_stress so that one of the worker-records is registered permanently, just to demonstrate that mixing permanent & temporary registration works. I also had it print the total number of bytes received, to make it easy to determine whether new features have performance implications.

The rest of the changes should be easy to understand.

ulatekh avatar Feb 11 '18 01:02 ulatekh