What is the difference between mutex and semaphore?

Answer Posted / mickey

Modified question is - What's the difference between A mutex
and a "binary" semaphore in "Linux"?

Ans: Compiled from above correct answers -

Following are the differences –
i) Scope – The scope of mutex is within a process address
space which has created it and is used for synchronization
of threads. Whereas semaphore can be used across process
space and hence it can be used for interprocess synchronization.

ii) Mutex is lightweight and faster than semaphore. Futex is
even faster.

iii) Mutex can be acquired by same thread successfully
multiple times with condition that it should release it same
number of times. Other thread trying to acquire will block.
Whereas in case of semaphore if same process tries to
acquire it again it blocks as it can be acquired only once.

Is This Answer Correct ?    6 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Tell me what has triggered the need for multitasking in pcs?

528


What is the important aspect of a real-time system?

2848


Write a function that responds to a click anywhere on the page by displaying an alert dialog. Display the event name if the user held Shift during the mouse click. Display the element name that triggered the event if the user held Ctrl during the mouse click.

1398


Explain the stipulations of c2 level security?

621


Hi All, Can any one post a MS-DOS command/ utility tool, that modifies large size(nGBs) log file into MBs form the begining of log file? I will appreciate if any one give correct answer to this question. Thanks

1440






What is the safest computer operating system?

567


What is BSS(Block Started by Symbol)?

602


How do you create a directory?

552


How to setup never expired user password?

592


What is starvation os?

594


What do you understand by coding schemes?

698


What is time- sharing system?

584


What was the last 32 bit processor?

527


Give an example of a Process State.

672


Can you move program files from c to d?

527