Question

Semephore $1=1, s2-1; int a 0, 60; P20 { if(a > 0) { senwait(s2); senwait(s); } P1() { senwait(s); aH+; senwait(s2); bH+; sen

will deadlock occurs or not why? explain
urgent

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Suppose first process P1 is executing at starting S1=1 and S2=1

When semWait(S1) execute it makes S1=0;

After then when semWait(S2) execute it makes S2=0

Now suppose P1 gets Preempt and P2 get start to execute now when semWait(S1) try to execute but already S1=0 so process will get blocked same thing happened when semWait(S2) is executed.

So process P2 will get blocked hence there will be a deadlock.

Please give thumb up to the answer.

Add a comment
Know the answer?
Add Answer to:
will deadlock occurs or not why? explain urgent Semephore $1=1, s2-1; int a 0, 60; P20...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Use the following information: Percentage Service Provided to Department Cost S1 S2 P1 P2 Service 1...

    Use the following information: Percentage Service Provided to Department Cost S1 S2 P1 P2 Service 1 (S1) $115,000 0% 25% 30% 45% Service 2 (S2) $47,000 20 0 20 60 Production 1 (P1) $375,000 Production 2 (P2) $246,000 Total $783,000 Question: What percentage of S1’s costs is allocated to P1 and to P2 under the direct method?

  • Use the following information: Percentage Service Provided to Department Cost S1 S2 P1 P2 Service 1...

    Use the following information: Percentage Service Provided to Department Cost S1 S2 P1 P2 Service 1 (S1) $ 115,000 0 % 25 % 30 % 45 % Service 2 (S2) 47,000 20 0 20 60 Production 1 (P1) 375,000 Production 2 (P2) 246,000 Total $ 783,000 QUESTION: What percentage of S2’s costs is allocated to P1 and to P2 under the direct method?

  • IN JAVA int[] numbers = new int [4]; numbers [0] = 1; for (int i =...

    IN JAVA int[] numbers = new int [4]; numbers [0] = 1; for (int i = 1; i < numbers.length; ++i) { numbers[i] numbers[i - 1] * 2 + 1; } Enumerate the contents of the array numbers after the above code is executed.

  • Consider the hypothesis test below. H. : P1 - P20 H. : P1 P2 > 0...

    Consider the hypothesis test below. H. : P1 - P20 H. : P1 P2 > 0 The following results are for independent samples taken from the two populations. Sample 2 Sample 1 11 = 100 ©1 = 0.27 n2 = 300 P2 = 0.18 Use pooled estimator of p. a. What is the value of the test statistic (to 2 decimals)? .16 b. What is the p-value (to 4 decimals)? 1.89 c. With a = .05, what is your hypothesis...

  • Question 5: A) Consider: int i=1; int fun(int x) { for(int i=0; i<4; i++) { x...

    Question 5: A) Consider: int i=1; int fun(int x) { for(int i=0; i<4; i++) { x += i; return x; What value is returned by a function call fun(1)? B In C, static variables can only be initialized by literals, not functions. For example, this is allowed: static int x = 5; But this is not allowed: static int x = compute_initial(); Why would this be the case? A Because you can never initialize a variable using a function, even...

  • Question 2 (a) Define algorithm and give an example to illustrate it. [5 marks] (b) The...

    Question 2 (a) Define algorithm and give an example to illustrate it. [5 marks] (b) The following C program codes are given below 1.#include <stdio.h> 2. main() char s 1-"Bad"; 6 7 char s1 -"weather!"; char sen [20]; int i, ji for (i-0;i<20: ++i) 10. sen [i]-s [i]; else 12. 13. 14. 15. 16. 17 18. 19 sen [i++ for ( j-o;s1 [j] !-'\0 ' ; j ++ , i++) sen [i]-s1 [j break; 20. 21 22. sen [il-'1o puts...

  • 3. Convert the following FA to a regular expression 2 0 S1 S2 0 S3 b....

    3. Convert the following FA to a regular expression 2 0 S1 S2 0 S3 b. 4. Prove the following languages are not regular a. {onion 1 n>=21

  • At the instant shown, 0-60", and rod AB is subjected to a deceleration 4-18 m/s2 when...

    At the instant shown, 0-60", and rod AB is subjected to a deceleration 4-18 m/s2 when the velocity v = 11 m/s Figure 1) Part A Determine the angular velocity of link CD at this instant measured counterolackwise. Express your answer using three significant figures. Enter positive value if the angular velocity is counterclockwise and negative value if the angular velocity is clockwise. rad/s Submit Figure < 1of1 > Part B Determine the angular acceleration of link CD at this...

  • This is for C in Linux: Problem 1: Given the following recursive function: void recursiveFunction( int...

    This is for C in Linux: Problem 1: Given the following recursive function: void recursiveFunction( int m ) printf("%d", m); if( m <= 0 ) return; if( n + 2 == 0 ) recursiveFunction( m - 1); else recursiveFunction( m - 2); What is the output when the following functions are called with these parameters? recursiveFunction( 5 ); recursiveFunction( 10 ); recursiveFunction( 0);

  • Using C++ please explain What is the Big-O time complexity of the following code: for (int...

    Using C++ please explain What is the Big-O time complexity of the following code: for (int i=0; i<N; i+=2) { ... constant time operations... Select one: o a. O(n^2) O b. O(log n) c. O(n) O d. 0(1) What is the Big-O time complexity of the following code: for(int i=1; i<N; i*=2) { ... constant time operations... Select one: O O a. O(n^2) b. 0(1) c. O(n) d. O(log n) O What is the Big-O time complexity of the following...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT