search
Log In
2 votes
1.3k views

difference in following: [i] mutual exclusion [ii] critical section [iii] semaphore

in CO and Architecture
retagged by
1.3k views

1 Answer

9 votes
 
Best answer

critical section anything...file,code,memory,register,colddrink,food which is "shared" by two processes..

mutual exclusion...if a process is inside the critical section.....other process shouldnt enter inside...like u r in a washroom..till that time no one should enter..

semaphore...a "variable"...a protected variable on which read modify etc happens automatically in kernal mode....like before entering washroom u have kept a bodygaurd ouside who will prevent others from entering..and when u comes out...it is removed...P and V are the operations to do so...


selected by
0
When examples bare taken from our daily life and become a model or prototype in complex topic , that topic become easy to understand and no one can forget.

Related questions

0 votes
1 answer
1
416 views
Process P1 Process P2 P(S1) P(S1) P(S2) P(S2) Critical Section Critical Section V(S2) V(S1) V(S1) V(S2) In one of the Gateoverflow tests, this question was given and it was told that in the above case mutual exclusion is not guaranteed. But I ... the critical section. As far as the order of unlocking, I dont see a problem there. Can someone please explain why mutual exclusion is not guaranteed?
asked Dec 14, 2017 in Operating System humblefool 416 views
1 vote
1 answer
2
594 views
Can Mutual exclusion can be enforced with a general semaphore initial value is greater than 1 ? I think yes. Consider a semaphore $S = 2$, and following code segment for both processes. P(S); P(S); <Critical Section> V(S); V(S);
asked Sep 25, 2016 in Operating System thor 594 views
4 votes
3 answers
3
1.8k views
Consider the following code to solve the critical section problem for two processes P0 and P1. Initially flag [i] contain false for i = 0 and 1. Assume i refers to the current process Pi and j refers the other process Pj. If two processes executing above ... the following satisfy the above solution? A. Mutual exclusion and progress B. Mutual exclusion and bounded wait C. Progress D. None of these
asked Jul 18, 2018 in Operating System Na462 1.8k views
1 vote
1 answer
4
374 views
There are two threads which try to solve critical section problem using Test-And-Set instruction. Does the above code prevent deadlock? please provide reason to your answer
asked Oct 8, 2017 in Operating System Tuhin Dutta 374 views
...