3 ms·
It seems that, for this very tiny OS, they're trying to do real work in interrupts. Most OSs do that, including UNIX/Linux. This has the problem that you can't
by Animats 10y ago
It seems that, for this very tiny OS, they're trying to do real work in interrupts. Most OSs do that, including UNIX/Linux. This has the problem that you can't block the interrupt while waiting for some thread to clear a lock.
QNX, though usually sends a message to a thread in a process when an interrupt comes in. The interrupt is processed slightly later. QNX has no interrupt lockouts longer than a few microseconds, because it's not doing much from interrupt code except sending messages. QNX also has a strict real-time priority system, so this doesn't hurt interrupt processing latency. So everything running in a thread uses the regular locking mechanisms, rather than depending on interrupt lockout.
Something like that might be a better fit to Rust's locking model. Either that, or the language has to know about interrupts, as in Modula I.
- jacquesm 10y agoAnd that's the way to do it if you value latency rather than simply maximizing throughput. In real time situations latency is usually the more important factor. One thing about those interrupt messages ('signals') in QNX parlance, they get processed before any other messages.
- Animats 10y agoQNX has bounded latency. A standard test in the real time world is to hook a square wave generator up to an input that cause an interrupt, and run a program which gets activated by the interrupt and turns on an output. You watch the input and output signals on an oscilloscope. If there are any outliers, it's not real time. (A QNX rep once told me they'd had problems with x86 boards that did things in "system management mode", stealing CPU cycles from the real work and messing up the response time. They had a quiet blacklist of unacceptable embedded boards.) Linux has a long history of long interrupt lockouts. It's gotten better.[1] The phrase "95% real time" is used. Kernel drivers can lock out interrupts, so you have to watch for drivers that are not real-time qualified. That's the trouble with doing real work in an interrupt handler. Usually you have to activate a thread after an interrupt anyway, so there's no overall performance gain in doing work at interrupt level. [1] http://events.linuxfoundation.org/sites/events/files/slides/Real-Time-Linux-Comparison-Bridgers-ELC2015.pdf http://events.linuxfoundation.org/sites/events/files/slides/...
- jacquesm 10y ago> A QNX rep once told me they'd had problems with x86 boards that did things in "system management mode", stealing CPU cycles from the real work and messing up the response time. They had a quiet blacklist of unacceptable embedded boards. Ah, so that was the source of QNX informally suggesting we stick to certain brands of motherboards. I always wondered about that, since it seemed to work ok. I guess they didn't want to alienate those vendors outright so they chose to informally promote the ones they were sure were good. 95% real time is funny. It's real time or don't bother. I worked with and for the QNX dealership in NL long ago.
- Animats 10y agoYes. Some boards emulated a hard drive using flash, with BIOS code stealing cycles from the main CPU with code in system management mode. This caused what looked like random CPU stalls at the OS level.
- dllthomas 10y agoMore precisely, worst case latency.
- revelation 10y agoLinux doesn't do that, work is put into tasklets or workqueues. (in theory..)
- Animats 10y agoIt's better to have one kind of thread and make it go fast than having lots of special cases for bypassing the scheduler. The old MacOS, through version 7, had that problem in a huge way. It didn't have a real CPU dispatcher. Everything event-driven was done by plugging into interrupts. So there were timer tick tasks, vertical refresh interval tasks, and, when TCP/IP networking was crammed in, a bunch of task hooks for network-related tasks. Each could make some different subset of the system calls. None of them could block. Horrid mess.