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
  • Assume a system with 3 processes P1, P2, and P3, and resources R1, R2, and R3....

    Assume a system with 3 processes P1, P2, and P3, and resources R1, R2, and R3. Each resource has a single instance. Draw a resource allocation graph for the following sequence of events: P1 is granted access to resource R1. P2 requests resource R1 P3 requests resource R3 P2 is granted access toR2 P1 requests R2 Convert your resource allocation graph to a wait-for graph. Is there a deadlock?

  • 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...

  • QUESTION 1 Process P1 waits on the condition x in the monitor M. Process P2 calls...

    QUESTION 1 Process P1 waits on the condition x in the monitor M. Process P2 calls x.signal() within a function defined in the same monitor M. What further scenario is possible? (Check all that apply.) Process P2 is suspended. Process P1 resumes the execution. Process P1 resumes the execution. Process P2 continues the execution. Process P2 continues the execution. Process P1 is nonetheless suspended until P2 leaves the monitor. The operation x.signal() fails. QUESTION 2 The following pseudocode fragment adds...

  • 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...

  • T/F question about operating system, thank you 1. A deadlocked system must involve at least two...

    T/F question about operating system, thank you 1. A deadlocked system must involve at least two threads/processes that are deadlocked. 2. If all 4 following conditions hold in a system: mutual exclusion, hold and wait, circular waiting, and no pre-emption, then a deadlock must occur. 3. In avoidance strategy, the OS may refuse to allocate requested resources if there is a potential for a deadlock. 4. Given a reusable resource graph representing a state S, state S is a deadlock...

  • This set of questions is involving multithreading in C++ and are multiple choice, choose the best...

    This set of questions is involving multithreading in C++ and are multiple choice, choose the best answer 1) Which action will not recover a process from deadlock? Terminate threads holding onto resources Terminate user process and restart Wait for the resource to be released by other threads None of the others 2) In a boss-worker thread model, the boss must keep in constant communication with the workers to make sure they are functioning correctly. True False 3) Process aging 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