What is the difference between semaphore and spinlock?



What is the difference between semaphore and spinlock?..

Answer / sandeep

Spinlock is a busy wait. Semaphore is a sleep wait.
Spinlocks are used to get exclusive access to critical
section whereas semaphores are used for exclusive access and
also to synchronize processes and threads.
Spin locks are used when the critical sections it is
protecting is small and are held for a short time.
Semaphores can be held for longer time. Semaphores use spin
locks to access its control structures.
Spinlocks are kernel locking mechanism where as semaphores
are used in both kernel and user space.
Semaphores should not be used in interrupt handlers since
the code sleeps if the semaphore is not acquired.

Is This Answer Correct ?    7 Yes 0 No

Post New Answer

More Linux AllOther Interview Questions

will u plz send me the complete steps of installation of red hat linux on intel's core 2 duo processor?

1 Answers  


I have accidently deleted my fstab... how do i recover/ regenerate the file?????? in rescue mode i cannot create a new file since the filesystem is readonly and could not mount in readwrite mode ?????????

6 Answers   IBM,


what is difference between inetd and xinetd

2 Answers  


As a system admin i want to know some things what are the troubleshooting issues we are facing frequently and what are the tickets will be raised.

0 Answers   Ondot,


How to build new filesystem ? and what is irig file system?

3 Answers  






My Linux server in the two lan card one lan card is ok working but second lan card after restart daily lan card deactivate and then manual activate then properly working but after restart repeat this problem.(Fedora O.S.) Pls tell me solved this problem.

4 Answers  


what is NIS Server...?

2 Answers   IBM,


What is the other method of installing Linux O.S other than Text, GUI mode? Why we prefer that for installation of Linux in Real time?

2 Answers  


What is the complete name of the default configuration file for LILO?

1 Answers  


How do display error messages instantly when command fails?

4 Answers  


what is meant by mysql clustering

2 Answers  


How find out drivers of installed devices in linux (RHEL)?

2 Answers  


Categories