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

what is meant by mysql clustering

2 Answers  


What is the difference between ext3 and ext4?

0 Answers   IBM,


Hi all Could u plz tell me how I can get UNIX/Linux Certification

2 Answers   Accenture,


there are many IPC mechanisms available in Linux ? Which one is best to use and when ?

1 Answers   Broadcom,


how do i check which package has installed some command suppose ls , mkdir or whatever ???

8 Answers  






Which directory is closer to the top of the file system tree, parent directory or current directory?

3 Answers  


why accounting Software does not support on linux?

5 Answers  


When you install RedHat what is the kernel mode ? What is kernel compilation / upgrade ?

4 Answers   IBM,


Give a Linux shell command to find all files in a directory which contain ip addresses.

1 Answers   Amazon,


How is the difference between ftp and sftp ? and explain how to create ftp server and sftp server with example ?

2 Answers   Bank Of America, IBM,


My root password has been changed, how can i enter into the system without root password?

6 Answers  


How do display error messages instantly when command fails?

4 Answers  


Categories