search
Log In

Recent questions tagged critical-section

0 votes
0 answers
1
Consider the following program segments for two different processes (P1, P2) executing concurrently and where a and b are not shared variables, but x starts at zero and is a shared variable Processor #1 Processor #2 for (a = 1; a <= 3; a++) for (b = 1; b <= 3; b++) x = x + 1; x = x + 1; If P1 and P2 execute only once and concurrently, then the final minimum possible value of x is ____
asked Jan 15, 2019 in Operating System OneZero 143 views
0 votes
0 answers
2
Many problems on gateoverflow asks whether the given code satisfies progress requirement of the solution for the critical section problem. Most of these code contain multiple processes and have two possibilities: Scenario 1: Deadlock (Example gateoverflow problem 1, example gateoverflow ... And if yes, are all other solutions to all those problems incorrect? Or I am screwed up at my concepts?
asked Jan 1, 2019 in Operating System Raj Singh 1 292 views
0 votes
1 answer
3
Consider the following Process Pi while(1) { while(turn != i); //critical section turn = j; //remainder section } Process Pj while(1) { while(turn != j); //critical section turn = I; //remainder section } In above case, Mutual exclusion & progress are not satisfied Only mutual exclusion is satisfied Only progress is satisfied Both mutual exclusion and progress are satisfied
asked Jan 1, 2019 in Operating System Raj Singh 1 314 views
0 votes
0 answers
4
0 votes
1 answer
5
0 votes
1 answer
6
0 votes
0 answers
7
https://gateoverflow.in/1319/gate2009-33 In this question progress is present or not? According to me making x=0 is exit part and not the reminder part. Hence I think progress is there. Am I correct? Definition : If no process is executing ... in their remainder sections can participate in deciding which will enter its critical section next, and this selection cannot be postponed indefinitely.
asked Nov 14, 2018 in Operating System Swapnil Naik 51 views
0 votes
1 answer
8
Consider the following solution for critical section problem with 'n' processes P0,P1,P2,......P(n-1).For all i,number[i] is an integer array initialized to zero, and for all j,choosing[j] is a binary array initialized to false. CODE FOR Pi : Repeat { choose[i]=true; ... a)S1 only. b)S1 and S2 only. c)S2 and S3 only. d)S1 , S2 and S3 (please anyone elaborate this solution.thanks in advance)
asked Oct 18, 2018 in Operating System talha hashim 109 views
4 votes
3 answers
9
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 1k views
1 vote
2 answers
10
while (turn != 0); // initially turn is set to 0 { turn = 1 CS turn = 0 } My question is let two processes P0 and P1 where P0 enters loop first and sets turn = 1 and P1 waits at while loop , Now as soon as P0 comes out of CS and sets turn ... at while loop gets to enter the CS before PO could again enter CS. So Bound waiting should be satisfied but the given ans is Bound waiting not satisfied.
asked Jul 6, 2018 in Operating System Shiv Gaur 155 views
0 votes
0 answers
11
Is context switch allowed when a process is in the cirtical section? (Not preemption) If yes then how it deals with data inconsistency?
asked Mar 31, 2018 in Operating System Akash Kumar Roy 71 views
1 vote
1 answer
12
Can a process be preempted while it is in a critical section? If yes, then how does the critical section or synchronisation mechanism concept provide solution for 'Data inconsistency'? If no, then how the gate2013 problem on critical section is solved.( ... /watch?v=jDUJsCFNI0E In video explanation instead of preemption sir has used context switch. How preemption is different from context switch?
asked Mar 30, 2018 in Operating System Akash Kumar Roy 393 views
1 vote
1 answer
13
Q1. Consider the methods used by process P1 and P2 for accessing their critical sections whenever needed, as given below. The initial values of shared Boolean variables, S1 and S2 are random assigned. For the program to guarantee mutual exclusion, the predicate P and Q in the ... B. My doubt is what is the case in which option D will not satisfy mutual exclusion? I am confused between B and D.
asked Jan 5, 2018 in Operating System mahakp 289 views
3 votes
0 answers
14
Let 'n' processes competing to enter their critical sections and mutex be a global binary semaphore initialized to 1. The process is coded as follows: Signal(mutex); C.S; wait(mutex); Which of the following statements are TRUE? s1: This code ensures mutual ... the decision is not postponed indefinitely and there is no competition to enter as well. can we take this as progress? Please answer.
asked Jan 2, 2018 in Operating System junk_mayavi 362 views
0 votes
1 answer
15
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 298 views
1 vote
0 answers
16
Hi Guys, Deadlock implies no progress. This statement is mentioned at many places. But i just want to verify my reasoning with respect to Progress definition Progress If no process is executing in its critical section and some processes wish to enter their critical sections, ... satisfied in case of Deadlock. If my reasoning is not complete or incorrect then please notify. It will be a great help.
asked Dec 4, 2017 in Operating System Chhotu 294 views
2 votes
2 answers
17
If there are n processes executing concurrently using binary semaphore S , (n-1) processes have the code do{ wait(S); <c.s> signal(s); <r.s> }while(1); the code for the n-th process i.e Pn is given by do{ signal(S); <c.s> signal(S); <r.s> }while(1); What is the max no. of processes that can be there in the critical section simultaneously? A. 2 B . 3 C. n-1 D. n
asked Nov 27, 2017 in Operating System Kalpataru Bose 302 views
2 votes
2 answers
18
If there are n processes executing concurrently using binary semaphore S , (n-1) processes have the code do{ wait(S); <c.s> signal(s); <r.s>}while(1); the code for the n-th process i.e Pn is given by do{ signal(S); <c.s> wait(S); <r.s>}while(1); a) What is the max no. of processes that can be there in the critical section simultaneosly ? A. 2 B . 3 C. n-1 D. n
asked Nov 27, 2017 in Operating System Kalpataru Bose 240 views
0 votes
1 answer
19
Consider the following code to access critical section do{ flag[j] = 1; turn = x; while(y); // Critical Section flag[z]=0; // Remainder Section } while(1); The values of x, y and z in the above code for which Mutual exclusion is guaranteed for two process i and j x=j; y=flag[j]&&turn=i; z=i x=i; y=flag[i]&&turn=i; z=j x=j; y=flag[i]&&turn=i; z=j x=j; y=flag[j]&&turn=j; z=j
asked Nov 27, 2017 in Operating System Parshu gate 579 views
0 votes
1 answer
20
In a given synchronization construct, if there is no deadlock and no strict alternation between two process then is it always true that a process will starve ?
asked Nov 16, 2017 in Operating System rishi71662data4 333 views
3 votes
0 answers
21
Consider the following two-process synchronization solution. Process 0 --------- Entry: loop while (turn == 1); (critical section) Exit: turn = 1; Process 1 ---------- Entry: loop while (turn == 0); (critical section) Exit: ... solution. (B) This solution violates mutual exclusion requirement. (C) This solution violates progress requirement. (D) This solution violates bounded wait requirement.
asked Nov 13, 2017 in Operating System Parshu gate 119 views
1 vote
1 answer
23
which of the following is true? it guarantees mutual exclusion. it is busy waiting solution. it does not guarantees progress. it guarantee bounded waiting. entry_section(int process) { int other = 1-process while (flag!=process); CS } exit_section(int process) { flag = other }
asked Nov 9, 2017 in Operating System hacker16 232 views
1 vote
1 answer
24
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 283 views
3 votes
1 answer
25
0 votes
2 answers
26
Consider Three binary Semaphore Q = R = 1 , S = 0; Process P1:- P(Q); P(R); /* CRITICAL SECTION */ V(Q); V(R); Process P2:- P(R); P(Q); /* CRITICAL SECTION */ V(Q); V(R); Process P3:- P(S); /* CRITICAL SECTION */ Q1 Give ... for INFINITE AMOUNT OF TIME then process P2 is also trying to enter into critical section, 1. then Bounded Wait is satisfied or not. 2. then Starvation is satisfied or not.
asked Sep 9, 2017 in Operating System Shubhanshu 1.1k views
4 votes
1 answer
27
This Screenshot is taken from William Stalling's Operating Systems book. My doubt is that Bounded wait is not satisfied by this solution. Though Book claims that is satisifes all three required conditions. For example: P0 and P1 both want to enter critical section and set their flags ... it did set its flag to False to give path to Po and now stuck for infinite time. hence B.W is not satisfied!
asked Aug 21, 2017 in Operating System Manu Thakur 1.3k views
3 votes
3 answers
28
What is Lock Variable solution to critical section problem? Does it satisfy all the conditions like Mutual exclusion, Bounded waiting and Progress?
asked Aug 21, 2017 in Theory of Computation Warlock lord 1.2k views
6 votes
5 answers
29
A critical region is a piece of code which only one process executes at a time is a region prone to deadlock is a piece of code which only a finite number of processes execute is found only in windows NT operating system
asked May 7, 2017 in Operating System sh!va 3.1k views
0 votes
1 answer
30
which other method should be used to resolve the problem of peterson's method/solution for critical section problem ?
asked May 1, 2017 in Operating System iarnav 73 views
...