What is the difference between mutex and semaphore?

Answer Posted / henry denial s

"Mutexes are typically used to serialise access to a
section of re-entrant code that cannot be executed
concurrently by more than one thread. A mutex object only
allows one thread into a controlled section, forcing other
threads which attempt to gain access to that section to wait
until the first thread has exited from that section."

A mutex is really a semaphore with value 1

A semaphore restricts the number of simultaneous users of a
shared resource up to a maximum number. Threads can request
access to the resource (decrementing the semaphore), and can
signal that they have finished using the resource
(incrementing the semaphore)."

Is This Answer Correct ?    2 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Do I need web plugins for vlc?

530


How do I know 64 bit?

522


What is the main difference between wait() and sleep() method?

533


Where are chkdsk logs stored?

593


Briefly explain the concept of Virtual Memory.

729






Name the different types of memory?

565


Explain page cannibalizing?

557


Difference between NTFS and FAT32?

585


Tell us something about mutex.

605


What is gang scheduling in operating system (os)?

593


What was microsoft's first operating system?

611


What is plumbing/piping?

577


Which program files folder is 64 bit?

668


How do I search for a file?

537


Explain the booting process of a windows xp system.

584