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

Is it ok to interrupt chkdsk?

541


How do you tell if your os is corrupted?

529


Enumerate the different RAID levels.

603


How long does chkdsk f'r take?

569


Can I change from 32 bit to 64 bit?

548






Explain Marshalling?

588


Can you list the coffman's conditions that lead to a deadlock?

646


What do you mean by a zombie process?

586


Is atomic thread safe?

550


What is BSS(Block Started by Symbol)?

599


A pair of redundant systems are operating, how would you ensure that when one of them goes down, the other one will take over its operation?

638


Throw some light on internal process memory.

557


What does echo $$ do?

532


What is the dispatcher?

580


Explain what is meant by repetition of information and inability to represent information. Explain why each of these properties may indicate a bad relational database design.

2626