[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: semaphore and spin locks
On Sun, Aug 05, 2001 at 11:51:37AM -0400, w.us@verizon.net wrote:
> Spin locks only work in a multiprocessor environment.
Right. (at least in the Linux kernel..)
> If you use it in a unprocessor environment, then the waiting process would
> keep running in a spin and have no chance to release it and the whole
> kernel would hang.
No. What waiting processes?
As spinlock are not allowed to be held over a blocking call there is no
way a process holding a spinlock can ever be schedule(). That way _no_
spinlock can be held at all in a UP kernel.
That's why their are optimized away.
Christoph
--
Whip me. Beat me. Make me maintain AIX.
-
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
IRC Channel: irc.openprojects.net / #kernelnewbies
Web Page: http://www.kernelnewbies.org/