user1865947
user1865947

Reputation: 59

Why does Linux RT not use semaphores?

While reading[1] through I found the following

"This is done by replacing most kernel spinlocks with mutexes that support priority inheritance, as well as moving all interrupt and software interrupts to kernel threads."

My question is why not semaphores?

https://rt.wiki.kernel.org/index.php/CONFIG_PREEMPT_RT_Patch

Upvotes: 1

Views: 912

Answers (2)

gby
gby

Reputation: 15218

Mutexes are binary semaphores, so they are using a semaphore.

Specifically, the purpose of the lock is to ensure mutual exclusion. This means, create a critical section of code that gets executed only by one context at a time. So we want a semaphore that admits only a single contender - this kind of semaphore is a binary semaphore which has a special nick name to denote this kind of use: mutex.

Upvotes: 2

Related Questions