News for hackers. Stuff that matters.
Re:Wait-free queueing and ultra-low latency logging by zwieback on Thursday May 29, 2014 @12:16PM (#7816962)
Most of my high speed experience is in embedded systems with direct control over HW.

Question: for these higher-level systems, is it possible to prevent preemption for a very short time? I'm guessing that a userland app can't do that easily but if it could then that would effectively give you larger atomic operations, which can aid in implementing lock-free solutions.

Re:Wait-free queueing and ultra-low latency logging by javert on Thursday May 29, 2014 @01:02PM (#7817234)
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).

Re:Wait-free queueing and ultra-low latency logging by zwieback on Thursday May 29, 2014 @02:13PM (#7817695)
Yes, excellent point. Multi-core changes how critical sections would be implemented and whether they'd be useful at all.