Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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



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

Answer / guest

Kernel Locking Techniques
Semaphores in Linux are sleeping locks. Because they cause a
task to sleep on contention, instead of spin, they are used
in situations where the lock-held time may be long.
Conversely, since they have the overhead of putting a task
to sleep and subsequently waking it up, they should not be
used where the lock-held time is short. Since they sleep,
however, they can be used to synchronize user contexts
whereas spinlocks cannot. In other words, it is safe to
block while holding a semaphore.

A "mutex" (or "mutual exclusion lock") is a signal that two
or more asynchronous processes can use to reserve a shared
resource for exclusive use. The first process that obtains
ownership of the "mutex" also obtains ownership of the
shared resource. Other processes must wait for for the first
process to release it's ownership of the "mutex" before they
may attempt to obtain it.

The most common locking primitive in the kernel is the
spinlock. The spinlock is a very simple single-holder lock.
If a process attempts to acquire a spinlock and it is
unavailable, the process will keep trying (spinning) until
it can acquire the lock. This simplicity creates a small and
fast lock.

Is This Answer Correct ?    64 Yes 7 No

Post New Answer

More Linux AllOther Interview Questions

I want to configure production interface and manage interface, how to configure both interfaces in Linux. please post the answers

0 Answers  


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,


What are RPM?s, what do they offer?

2 Answers  


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

3 Answers  


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

2 Answers  


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

3 Answers   Broadcom,


how can i make an user to nologin without locking the account for the user

7 Answers   CSS, CSS Corp,


Tell me the 5 differences between Linux and Unix?

4 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 know what are the packages required for any service? Example: How to know what are the package required for send mail services. using any command it is passable are not?

2 Answers   OnMobile,


why you are using nis server

2 Answers  


what is the difference between fork and thread ? and parent and child process in fork system call?

3 Answers   Satyam,


Categories