Skip to contentSkip to conversation

Do not deprecate binary semaphore or do allow mutex in software interrupt contexts

DISCUSSION Matti Linnanvuori 2 participants 2 messages Sep 11, 2007

lore
Share & tools
lore
#0 lore raw

Peter Zijlstra <[email protected]>:

Quoted 1 line

Yes it is.

Why do you think it is broken?

Quoted 2 lines

If you have to wait a long time in an atomic context you've done something wrong.

I saw an implementation where there were two atomic contexts, one to initiate reading and another to complete the reading. That way, there was no busy wait for a long time in an atomic context.

Quoted 3 lines

If you're only reading it from an atomic context you
might consider storing a copy that can be quickly updated and protect that using a spinlock.

You suggested that a user-space task read from the device.
But that includes more context switching and therefore consumes more resources than reading just from an atomic context.

Quoted 2 lines

Not being too familiar with the timer stuff, it smells wrong what you say.

Why?

Wissenswertes für Bastler und Hobby Handwerker. BE A BETTER HEIMWERKER! www.yahoo.de/clever

#1 lore raw
Quoted 4 lines · On Tue, 11 Sep 2007 10:29:19 -0700 (PDT) Matti Linnanvuori…
Quoted 2 lines

Not being too familiar with the timer stuff, it smells wrong what you say.

Why?

timers and sleeping locks really shouldn't be mixed. It ends up in general as more complex, fragile and weird...

But feel free to prove us otherwise with real code...