This whitepaper by a veteran real-time trainer David Kalinsky provides an introduction to the subject of Priority Inversions and Mutexes, from the perspective of embedded systems software developers using a real-time operating system. It discusses unbounded priority inversions, including a detailed example. Then it surveys the differences between mutexes and “classic” semaphores, and the use of priority promotion, priority inheritance and priority ceiling protocols. More articles here.
Whitepaper: Mutexes Battle Priority Inversions
Submitted by David Kalinsky 2004-01-04 General Development 15 Comments
A decent read and explanation.
It’s nice to see the site being responsive (I can only presume this article was posted to compliment the comments on VxWorks article). Excellent work Eugenia.
I didn’t write it, my post clearly indicates David Kalinsky as the author.
Excellent work as editor, Eugenia.
he said, no plans for priorty ceiling or inheritance..
“”I didn’t write it, my post clearly indicates David Kalinsky as the author.””
Sorry, I was unclear. I meant excellent work in digging it up for us to read.
Windows XP also does this for you.
It was interesting to see the author referring to semaphores as the more traditional synchronization primitive. In my operating systems class, mutexes were introduced first as they are simpler; semaphores were talked about later. This led me to believe that mutexes came first, but it seems that is not the case.
Nice article. Reading the paper got me wanting to write a simple real-time OS to try out some of these ideas
I surely learned about semaphores before mutexes and I think about them as traditional too.
Nice article all in all. The whole mechanism is quite simple and elegant. I am sure there are many more aspects that are involved in an implementation but why not taking a crack at such a scheduler for Linux or BSD? What’s the reasoning behind the opposition? Can you ask Andrew to please explain in few words?
I remember an article in which some major players – can’t remember who (Oracle?) – were pushing to get DLM included in the kernel. But it hasn’t happened yet. Maybe not stable yet. http://oss.software.ibm.com/dlm/
excellent, clear and concise, a good and easy read. Thanks David!
little bit of info on priority inheritance and ceilings that i found helpful. For the newbies.
>The whole mechanism is quite simple and elegant. I am sure
>there are many more aspects that are involved in an
>implementation but why not taking a crack at such a scheduler
>for Linux or BSD?
These schedulers are _very_ diffrent from the ones in realtime systems.
Making use of priority inheritance/ceiling doesn’t make that much sense
in a general purpose OS as it does in a realtime OS.
(well, Linux actually have a “realtime” scheduler, though it’s not entierly realtime(interrupt handlers and some housekeeping still runs). man sched_setscheduler)
>(well, Linux actually have a “realtime” scheduler, though >it’s not entierly realtime(interrupt handlers and some >housekeeping still runs). man sched_setscheduler)
For FreeBSD see: sched_setscheduler(2), rtprio(2).
But still it’s no more than soft real time.
Victor Yodaiken is a founder of FSMLabs, that produces and ships RTLinux—real-time version of Linux kernel, and he has quite an opposite view on the usefulness (or, unusefulness, so to speak) or priority inheritance:
OS X includes priority inheritance for kernel mutexes (not sure about pthread mutexes). Priority inheritance is actually very useful in a modern desktop OS as something like audio does need to be near Real-Time in performance.