5 ms·
If I understand your suggestion, that only works when all the threads that share a critical section can only run on the same core. For instance, if you have a
by javert 12y ago
If I understand your suggestion, that only works when all the threads that share a critical section can only run on the same core.
For instance, if you have a producer on core 0 and a consumer on core 1, even if the producer disables preemptions, the consumer can still enter the critical section (unless you protect it with locks).
Off the top of my head I actually don't know if you can turn off preemptions from userspace in Linux, I've never needed to.
You can give threads sched_fifo or sched_rr priorities that will prevent them from being interrupted by anything of lower priority (but that doesn't include the kernel itself... unless you are on preempt_rt and then there are things you can do).
- zwieback 12y agoYes, excellent point. Multi-core changes how critical sections would be implemented and whether they'd be useful at all.