Restartable sequences
Restartable sequences
Posted Jul 9, 2015 7:16 UTC (Thu) by epa (subscriber, #39769)Parent article: Restartable sequences
Perhaps a similar mechanism could be used for concurrency in general, assuming a single-CPU machine. The special section runs and if the process is pre-empted for any reason at all then the restart handler is called. Then the final commit is a single instruction. If the scheduler timeslice is big enough this might let multithreaded code be written without locking. Of course the process will starve if interrupts happen so often the special section can never complete.