lkml.org 
[lkml]   [1999]   [Aug]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: Locks used in the FAT file system are non-atomic and in fact, don't work on SMP systems
Date
From
> Lock()
> {
> while (lock) sleep_on(&wait);
> lock =3D 1;
> }
>
> Unlock()
> {
> lock =3D 0;
> wake_up(&wait);
> }
>
> Two processes can enter Lock() while lock is equal to 0, and both set =
> it. We have seen this occur, and it seems broken. =20

Really

CPU 0 CPU 1
while(lock) - its 0 while(lock) - its 0
lock=1 lock=1

am I missing something. I think you want to be using atomic test and set
operations. (test_and_set_bit)

Alan


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