lkml.org 
[lkml]   [1999]   [Feb]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: race condition in down_interruptible
On Fri, 12 Feb 1999, Ulrich Schmid wrote:

> sem->count sem->waking
>No process holds the semaphore 1 0
>Process A acquires the semaphore 0 0
>Process B calls down_interruptible() -1 0
>Process B is interrupted and passes
> waking_non_zero() -1 0
>Process A calls up() (on another CPU) 0 1

B get wakenup and runs waking_non_zero that sees sem->waking == 1 and so
do sem->waking-- and then B has no way to runs atomic_inc() because
waking_non_zero returned 1 (owned the semaphore).

after B exit from __down_interruptible, the state of the semaphore is:

0 0

and not:

>Process B calls atomic_inc(&sem->count) 1 1

Tell me if I missed something.

Andrea Arcangeli


-
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:50    [W:0.060 / U:0.004 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site