Question

Let I represent an execution of init(s), W of wait(s), and S of signal(s). Then, for...

Let I represent an execution of init(s), W of wait(s), and S of signal(s). Then, for example, IWWS represents the sequence of calls init(s), wait(s), wait(s), and signal(s) by some processes in an operating system. For each of the following sequences of calls, state the value of s and the number of processes blocked after the last call in the sequence: (b) IS (c) ISSSW (d) IWWWS (e) ISWWWW Each of the following code fragments contains a bug in the entry or exit section. For each fragment, state whether mutual exclusion still holds. If it doesn’t, show an execution sequence that violates it. State whether deadlock can occur. If it can, show an execution sequence that produces it. (b) Process P1 Process P2 do signal(mutEx); critical section wait(mutEx); remainder section while (!done1); do signal(mutEx); critical section wait(mutEx); remainder section while (!done2); (c) Process P1 Process P2 do wait(mutEx); critical section signal(mutEx); remainder section while (!done1); do wait(mutEx); critical section wait(mutEx); remainder section while (!done2); (d) Process P1 Process P2 do wait(mutEx); critical section signal(mutEx); remainder section while (!done1); do wait(mutEx); critical section remainder section while (!done2); (e) Process P1 Process P2 do wait(mutEx); critical section signal(mutEx); remainder section while (!done1); do critical section signal(mutEx); remainder section while (!done2); Section An operating system has processes P1, P2, P3, and P4 and resources R1 (one resource), R2 (one resource), R3 (two resources), and R4 (three resources). The notation (1, 1), (2, 2), (1, 2) means that P1 requests R1, then P2 requests R2, then P1 requests R2. Note that the first two requests produce allocation edges on the resource allocation graph, but the third request produces a request edge on the graph because R2 is already allocated to P2. Draw the resource allocation graph after each sequence of requests. State whether the graph contains a cycle. If it does, state whether it is a deadlock cycle. (c) (1, 1), (2, 1), (3, 1), (4, 1) (d) (3, 3), (4, 3), (2, 2), (3, 2), (2, 3) (e) (1, 2), (1, 3), (1, 4), (2, 2), (2, 3), (2, 4) (f) (2, 1), (1, 2), (2, 3), (3, 3), (2, 2), (1, 3) (g) (2, 1), (1, 2), (2, 3), (3, 3), (2, 2), (1, 3), (3, 1) (h) (1, 4), (2, 3), (3, 3), (2, 1), (3, 4), (1, 3), (4, 4), (3, 1), (2, 4) (i) (1, 4), (2, 3), (3, 3), (2, 1), (3, 4), (1, 3), (4, 4), (3, 1), (2, 4), (4, 3)

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

3 Q-20:- (b) ,S → Value ok, s,+1 blocked (d) I wwws-> value ot s 2-1 blockede mu-Hua xsion eence P, 3fanal critical seeカor RoaL ded vever happine

Add a comment
Know the answer?
Add Answer to:
Let I represent an execution of init(s), W of wait(s), and S of signal(s). Then, for...
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
  • Given the table, suppose we have avoided circular-wait by ordering the resources in the order R1...

    Given the table, suppose we have avoided circular-wait by ordering the resources in the order R1 -> R2 -> R3 -> R4 and enforcing that each process must request resources in the ascending order. Show one allocation possibility of R1-R4 to P1-P4 and the corresponding wait-for graph. If there is a deadlock, please explain why or why not? Resource No. of instances Requested Allocated R1 2 P1, P2 ? R2 1 P1, P3 ? R3 1 P3, P4 ? R4...

  • A system has five processes P1 through P5 and four resource types R1 through R4. There...

    A system has five processes P1 through P5 and four resource types R1 through R4. There are 2 units of each resource type. Given that: P1 holds 1 unit of R1 and requests 1 unit of R4 P2 holds 1 unit of R3 and requests 1 unit of R2 P3 holds one unit of R2 and requests 1 unit of R3 P4 requests 1 unit of R4 P5 holds one unit of R3 and 1 unit of R2, and requests...

  • In the code below, three processes are competing for six resources labeled A to F. a....

    In the code below, three processes are competing for six resources labeled A to F. a. Determine a sequence of requests and locks that results in a deadlock among the 3 processes. You could, for example, for each process list which resources it currently has locked (Allocated) and which resource it is requesting. Hint: it might be useful to draw a resource allocation graph to help you find a deadlock. b. Modify the order of some of the get requests...

  • In order to prevent deadlocks, let a system adopt the policy of forcing processes to request...

    In order to prevent deadlocks, let a system adopt the policy of forcing processes to request resources in ascending order of request type rank. In particular, when a process is requesting a resource of a certain type, the process cannot be holding other higher ranked resources. Consider four resource types with the following profile in this system: Resource Type Rank Number of Instances RT1 4 2 RT2 7 4 RT3 8 3 RT4 10 2 Let the following sequence of...

  • Please give an explanation for the answers as well. 1. A system has three processes (P1,...

    Please give an explanation for the answers as well. 1. A system has three processes (P1, P2, and P3) and three resources (R1, R2, and R3). There is one instance of RI, two instances of R2, and three instances of R3. PI holds RI and one instance of R3 and is requesting one instance from R2. P2 holds one instance of R3 and is requesting RI and one instance from R2. P3 holds two instances of R2 and one instance...

  • a. A system has two processes and three identical resources. Each process needs a maximum of...

    a. A system has two processes and three identical resources. Each process needs a maximum of two resources. Is deadlock possible? Explain your answer. b. A system has 4 processes, P1 through P4, and 5 types of resources, R1 through R5. Existing resource vector E = (3, 2, 1, 2, 2) Current allocation matrix C = R1 R2 R3 R4 R5 P1 1 1 0 0 0 P2 0 0 1 0 0 P2 1 0 0 20 P4 0...

  • Write a C program for: One technique for dealing with deadlock is called “detect and recover.” In...

    Write a C program for: One technique for dealing with deadlock is called “detect and recover.” In this scheme, some procedure is used to identify when a deadlock occurs, and then another procedure is used to deal with the blocked processes. One technique to identify a deadlock is to maintain a resource graph that identifies all processes, all resources, and the relationships between them (that is, which processes exclusively own which resources, and which processes are blocked waiting for which...

  • Code the Bankers' algorithm for deadlock avoidance as described in lecture. Apply this algorithm against the...

    Code the Bankers' algorithm for deadlock avoidance as described in lecture. Apply this algorithm against the following data displaying the Work, Need and Allocation matrices for each pass of the algorithm provided a safe state exists. Process       Allocation   Max            Available                    A B C D      A B C D      A B C D P0               0 0 1 2       0 0 1 2       1 5 2 0 P1                1 0 0 0       1 7 5 0 P2               1 3 5 4      ...

  • resource instances of the same type, being shared by processes maz, is maximum resource needs of...

    resource instances of the same type, being shared by processes maz, is maximum resource needs of Pi, where 2 mar, S m n. Assume that a process can request one resource at a time during execution. Answer 7. (20 pts) Consider a system of m P, P Pa where m 22. Suppose the following questions about deadlock among the various processes A: Suppose m 5 printers and n 2 processes in a system, with mazi 3 and mar2 4. Identify...

  • TRUE-FALSE     Basic synchronization principles and multithreading 1. Java user threads can implement both busy-waiting and no-busy-waiting...

    TRUE-FALSE     Basic synchronization principles and multithreading 1. Java user threads can implement both busy-waiting and no-busy-waiting policy. 2. Priority inversion avoids deadlocks. 3. Spinlock mutex can be used as an adaptive mutex. 4. Java RTE can be blocked for Input/Output operation. 5. Interrupted user thread, which executes a method in a monitor, must be rolled back to undo any changes it performed. 6. The synchronization primitive by disabling interrupts can be used by an application program. 7. Bounded-waiting requirement is...

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