Role of process priority in locking mechanism
From: Kamal R. Prasad (kamalp_at_acm.org)
Date: 12/23/04
- Next message: Kamal R. Prasad: "File * to fd"
- Previous message: Doug Mitton: "Kernel 2.6.x User Module Compiling?"
- Next in thread: Casper H.S. ***: "Re: Role of process priority in locking mechanism"
- Reply: Casper H.S. ***: "Re: Role of process priority in locking mechanism"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 23 Dec 2004 09:35:34 -0800
From: Casper H.S. *** (Casper.***@Sun.COM)
Subject: Re: Role of process priority in locking mechanism
View this article only
Newsgroups: comp.unix.programmer
Date: 2004-12-22 04:04:16 PST
"Mona" <indian.monalisa@gmail.com> writes:
>Can anyone explain me, role played by spls in kernel locks ?
splxxx() are a set of routines -which provide a priority level(xxx),
which preempts other lower priority interrupts from preempting the
code. They are used throughout the UNIX kernel, but they do not
necessarily have anything to do with the hw. You could use splxxx()
within an implementation of a syscall() , a device's read(), mmap(),
ioctl() etc.. Its just to ensure atomicity of execution of a certain
fragment of a code block.
>This depends very much on the specific kernel you are playing with.
>In traditional Unix kernel, the spl*() function are used to lock
>out interrupts and some other activities while manipulating certain
>data structures. In those systems, spl*() functions as a primitive
>locking scheme.
a primitive lock would be something like a spinlock().
>It can be used to lock out
>If you take a modern, multi-threaded kernel, like Solaris, you'll
>find that you can no longer manipulate interrupt masks inside
drivers;
Well -whether the kernel is multi-threaded or not does not ahve much
to do with the nature of locks. Perhaps you mean, MP has a lot to with
the implementation of locks.
>rather, the system does it all for you. With each driver mutex
>Solaris associates a "cookie" which describes the interrupt
properties
>of the driver. The interrupt handler can then safely obtain the lock
>and lower level code can also safely obtain the lock as the kernel
then how will you implement splnet()? Its not related to any driver.
>will magically prevent interrupts from occuring while the lock is
held.
netbsd, freebsd etc.. are all examples of multi-threaded kernels that
dont work that way You are describing an implementation.
regards
-kamal
Casper
-- Expressed in this posting are my opinions. They are in no way related to opinions held by my employer, Sun Microsystems. Statements on Sun products included here are not gospel and may be fiction rather than truth.
- Next message: Kamal R. Prasad: "File * to fd"
- Previous message: Doug Mitton: "Kernel 2.6.x User Module Compiling?"
- Next in thread: Casper H.S. ***: "Re: Role of process priority in locking mechanism"
- Reply: Casper H.S. ***: "Re: Role of process priority in locking mechanism"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]