lkml.org 
[lkml]   [1999]   [Apr]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: mutexs for synchronization between kernel threads?
> From: Andi Kleen <ak@muc.de>
>
> Patrick MOUROT <pm@sxb.bsf.alcatel.fr> writes:
> >
> > Sorry for disturbing....but i have a hot (at least for us) question :
> > Do you encounter any Priority Inversion or deadlock with Mutexes or
> > Semaphores (regarding to spinlock) ??
>
> AFAIK Linux 2.2 makes no attempt to handle priority inversion in any
> locking code. so yes. Deadlocks are always easy with any locking
> primitives.

well semaphores seem to make an attempt at least. when an "up" is done on
a semaphore, the "waking" field is incremented by 1 and _all_ the processes
waiting on the semaphore are woken up. they race to decrement "waking" and
the process which wins owns the semaphore now. who wins the race depends
on who the scheduler picks to run first, which depends on priority among
other things. so the highest priority process has a good chance of getting
the semaphore. doesn't this solve the inversion problem somewhat ?
(there are other issues due to which we can't just wake a single process
and avoid the thundering herd. for one thing, these primitives don't take
the process off the wait queue when they wake it up. they rely on the
process itself to do so. so queue management becomes a bit more complex when
multiple "up"s arrive before any of the woken up processes run and take
themselves off the queue.)
someone please yell if I'm totally off the mark...

ganesh

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:51    [W:0.024 / U:0.128 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site