Question

Consider the following snapshot of a system:   Allocation Max Available ABCD ABCD ABCD P0 1121 2233...

Consider the following snapshot of a system:  
Allocation Max Available ABCD ABCD ABCD P0 1121 2233 2212 P1 2122 5445 P2 3010 3121 P3 1001 2311 P4 2000 3221
Answer the following questions using the banker`s algorithm:
a) Illustrate that the system is in a safe state by demonstrating an order in which the processes may complete. Give the Available matrix after completion of each process.

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

The given inputs are -

\\ \ Process \ \ \ \ Allocation\ \ \ \ \ \ Max\ \ \ \ \ \ \ \ \ \ \ Available \\ \ - \ \ \ \ \ \ \ \ \ \ \ A\ B\ C\ D \ \ \ \ \ \ A\ B\ C\ D \ \ \ \ \ A\ B\ C\ D \\ P0\ \ \ \ \ \ \ \ \ \1\ \ 1\ \ 2\ \ 1\ \ \ \ \ \ \ 2\ \ 2\ \ 3\ \ 3\ \ \ \ \ \ 2\ \ 2\ \ 1\ \ 2 \\ P1\ \ \ \ \ \ \ \ \ \2\ \ 1\ \ 2\ \ 2\ \ \ \ \ \ \ 5\ \ 4\ \ 4\ \ 5\\ P2\ \ \ \ \ \ \ \ \ \3\ \ 0\ \ 1\ \ 0\ \ \ \ \ \ \ 3\ \ 1\ \ 2\ \ 1\\ P3\ \ \ \ \ \ \ \ \ \ 1\ \ 0\ \ 0\ \ 1\ \ \ \ \ \ \ 2\ \ 3\ \ 1\ \ 1 \\ P4\ \ \ \ \ \ \ \ \ \ 2\ \ 0\ \ 0\ \ 0 \ \ \ \ \ \ \ 3\ \ 2\ \ 2\ \ 1

Now , Need = Max - allocation

\\ \ Process \ \ \ \ Need\\ \ - \ \ \ \ \ \ \ \ \ \ \ A\ B\ C\ D \\ P0\ \ \ \ \ \ \ \ \ \1\ \ 1\ \ 1\ \ 2\\ P1\ \ \ \ \ \ \ \ \ \3\ \ 3\ \ 2\ \ 3\\ P2\ \ \ \ \ \ \ \ \ \0\ \ 1\ \ 1\ \ 1\\ P3\ \ \ \ \ \ \ \ \ \ 1\ \ 3\ \ 1 \ 0\\ P4\ \ \ \ \ \ \ \ \ \ 1\ \ 2\ \ 2\ \ 1

We can show that the state given is a safe state by showing that it is possible for each process to acquire its maximum resources and then terminate.

  1. P0 acquires 1 A, 1 B, 1 C and 2 D resources, achieving its maximum
    • [available resource: <2 2 1 2> - <1 1 1 2> = <1 1 0 0>]
    • The system now still has 1 A, 1 B, no C and no D resource available
  2. P0 terminates, returning 2 A, 2 B, 3 C and 3 D resources to the system
    • [available resource: <1 1 0 0 > + <2 2 3 3> = <3 3 3 3>]
    • The system now has 3 A, 3 B, 3 C and 3 D resources available
  3. P1 acquires 3 A, 3 B, 2 C and 3 D resources, achieving its maximum
    • [available resource: <3 3 3 3> - <3 3 2 3> = <0 0 1 0>]
    • The system now still has no A, no B, 1 C and no D resource available
  4. P1 terminates, returning 5 A, 4 B, 4 C and 5 D resources to the system
    • [available resource: <0 0 1 0> + <5 4 4 5> = <5 4 5 5>]
    • The system now has 5 A, 4 B, 5 C and 5 D resources available
  5. P2 acquires 0 A, 1 B, 1 C and 1 D resources, achieving its maximum
    • [available resource: <5 4 4 5> - <0 1 1 1> = <5 3 3 4>]
    • The system now still has 5 A, 3 B, 3 C and 4 D resource available
  6. P2 terminates, returning 3 A, 1 B, 2 C and 1 D resources to the system
    • [available resource: <5 3 3 4 > + <3 1 2 1> = <8 4 5 5>]
    • The system now has 8 A, 4 B, 5 C and 5 D resources available
  7. P3 acquires 1 A, 3 B, 1 C and 0 D resources, achieving its maximum
    • [available resource: <8 4 5 5 > - <1 3 1 0> = <7 1 4 5>]
    • The system now still has 7 A, 1 B, 4 C and 5 D resource available
  8. P3 terminates, returning 2 A, 3 B, 1 C and 1 D resources to the system
    • [available resource: <7 1 4 5> + <2 3 1 1> = <9 4 5 6>]
    • The system now has 9 A, 4 B, 5 C and 6 D resources available
  9. P4 acquires 1 A, 2 B, 2 C and 1 D resources, achieving its maximum
    • [available resource: <9 4 5 6> - <1 2 2 1> = <8 2 3 5>]
    • The system now still has 8 A, 2 B, 3 C and 5 D resource available
  10. P4 terminates, returning 3 A, 2 B, 2 C and 1 D resources to the system
    • [available resource: <8 2 3 5> + <3 2 2 1> = <11 4 5 6>]
    • The system now has 11 A, 4 B, 5 C and 6 D resources available
  11. Because all processes were able to terminate, this state is safe.
Add a comment
Know the answer?
Add Answer to:
Consider the following snapshot of a system:   Allocation Max Available ABCD ABCD ABCD P0 1121 2233...
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
  • Answer the following question: Allocation Available A B C D 3 3 2 1 Ро P1...

    Answer the following question: Allocation Available A B C D 3 3 2 1 Ро P1 A B C D 2001 3121 2103 1312 1 432 Max ABCD 4212 5252 2316 1424 36 65 P2 P3 P4 The snapshot of a system 1) Illustrate that the system is in a safe state by demonstrating an order in which the processes may complete. (Format: use process number only, e.g. 01234) 2) If a request from process P1 arrives for (1,1,0,0), can...

  • Consider the following snapshot of a system: Process РО P1 P2 P3 P4 Allocation A B...

    Consider the following snapshot of a system: Process РО P1 P2 P3 P4 Allocation A B C D 2013 2 2 1 0 3 1 2 1 0 4 1 0 4 2 1 2 Max A B C D 5 1 1 6 3 2 1 1 3 2 2 1 4 6 1 2 5 3 2 5 Using the banker's algorithm, determine whether or not each of the following states is unsafe. If the state is safe,...

  • Show all work. Determine the matrix Need and the Available matrix for each step. Answer the...

    Show all work. Determine the matrix Need and the Available matrix for each step. Answer the following questions using the Banker’s algorithm: Allocation Max Available ABCD ABCD ABCD P0 0112 3412 2222 P1 1000 5755 P2 1354 7354 P3 3281 3682 P4 0222 1222 A.  What is the content of the matrix Need? B.  Is the system in a safe state?

  • 2. Consider the following snapshot of a system:

    Banker's Algorithm2. Consider the following snapshot of a system: Answer the following questions using the banker's algorithm: a. What is the content of the matrix Need? b. Illustrate that the system is in a safe state by demonstrating an order in which the processes may complete. c. Using the available work, if a request from process Pi arrives for (0.4.2.0). can

  • Consider the following snapshot of a system:

    Consider the following snapshot of a system: Using the banker's algorithm, determine whether or not each of the following states is unsafe. If the state is safe, illustrate the order in which the processes may complete. Otherwise, illustrate why the state is unsafe. a. Available = (0,2,0,1) b. Available = (2, 0, 0, 2)

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