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

why accounting Software does not support on linux?

5 Answers  


what is difference between  TFTP abd FTP?

0 Answers  


what is the difference between semaphore, mutex & spinlock?????

1 Answers   Patni,


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  


Who owns the data dictionary?

2 Answers  






how can i create samba server in fedora 9.0 ? and domain/LDAP controller! clilent side is windows pc .?

0 Answers   Wipro,


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

5 Answers   Toyota,


Through ssh whole directory structure from / is shared regardless the user we have connected with ....... how do i prevent sharing ??

4 Answers   Tech Mahindra,


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

0 Answers  


what is difference between inetd and xinetd

2 Answers  


What is LILO?

11 Answers   Cisco,


What is the difference between semaphore and spinlock?

1 Answers  


Categories