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

This question is belong to linux support. "one of my customer told to me, my application is getting slow response". how to resolve the issue. what are the steps you will follow to resolve the issue.

0 Answers  


i installed clustering packages.When i try to run it getting LUCI error...what is it..??

0 Answers  


You want to create a compressed backup of the users' home directories. What utility should you use?

5 Answers  


i want some basic level enterview questions can any one can help me in this

1 Answers   TCL,


How to give 2 different gateway IP addresses for 2 different interfaces in same system ?

5 Answers   Toyota,






what is memory mapped / IO mapped ? Which calls used for this to access any hardware address in linux device driver ?

3 Answers   Broadcom,


what are the default permissions for files and folders..?

8 Answers   IBM,


Friends, I don't have enough free space in root directory. but in home directory I have 40gb free. So I can not install anything in root directory (which occupies more space) Please suggest me If there is any possibility to increase the root directory size by minimising the home directory's.

3 Answers  


How can you see all mounted drives?

10 Answers  


Tell me command which is use for create quota database in Linux.

7 Answers   Wipro,


What is the difference between RedHat linux and Fedora and Ubuntu?

3 Answers   CSC,


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,


Categories