News for hackers. Stuff that matters.
Re:Unix System Call Timeouts by Animats on Sunday March 12, 2017 @11:14PM (#13854980)
This is done right in QNX. In QNX, everything that can block can be given a timeout, using TimerTimeout().[1] This is useful in real-time code with moderate time constraints. If you're logging to disk, and the disk stalls because of a hardware problem, you may need to get control back so you can keep doing your real-time work. It's more important to, say, issue steering commands than log.

After a timeout, you don't know how the request that blocked ended. If you need that, a multi-thread or multi-process solution is indicated.

In general, QNX is much better at timing, hard real time scheduling, and inter-process communication than UNIX/Linux. In the Unix/Linux world, those were afterthoughts; in QNX, they're core features. Because all I/O is via interprocess communication, it takes an extra memory to memory copy; this seems to add maybe 10% CPU overhead. That's the microkernel penalty, a moderate fixed cost.

[1] http://www.qnx.com/developers/docs/7.0.0/#com.qnx.doc.neutri...

Re:Unix System Call Timeouts by nwmcsween on Monday March 13, 2017 @02:30AM (#13855667)
A better solution is to have async syscalls, this helps both the scheduler (you could batch return) and given a proper language the developer as well. The microkernel approach still suffers from the high context switch overhead and IMO it would be better to use something similar to an exokernel while implementing most things in userspace.
Re:Unix System Call Timeouts by panic on Monday March 13, 2017 @03:16AM (#13855819)
The problem with asynchronous operations is that there has to be a buffer somewhere. Once you have a buffer, you have to answer the question: what happens when the buffer is full? If the answer is to block, then you haven't really solved anything.
Re:Unix System Call Timeouts by nwmcsween on Monday March 13, 2017 @01:57PM (#13860465)
This is why you want something like an exokernel.
Re:Unix System Call Timeouts by pjmlp on Monday March 13, 2017 @03:30AM (#13855869)
Windows comes to my mind....