[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]
On Fri, Jun 02, 2000 at 11:57:51AM +0400, Praveen wrote:
> Hi folks,
> Can any one tell me What down_trylock and down_interruptible defined
> in semaphore.h will do ?
They do the same things as the classic OS text book (P and V) semaphores.
The _trylock versions are optimizations that are inlined for the common
case. When there is contention, they transfer to code in
arch/i386/lib/semaphore.S via a non standard calling sequence. They
eventually end up in kernel/sched.c, where the sleeping and context
switch takes place.
The _interruptible versions allow a signal or an external event other
than the semaphore becoming free wake up the process.
PS: While Linux is great as a learning tool for embedded space, it makes
zero business sense in that space.