# (Solved Homework): Consider the following snapshot of a system: Allocation Max Available

Consider the following snapshot of a system:
Allocation Max Available
A B C D E A B C D E A B C D E
P0 2 0 0 1 0 4 2 1 2 3 3 3 3 1 2
P1 0 1 2 1 1 3 2 5 2 3
P2 2 1 0 3 1 2 3 1 6 3
P3 1 3 1 2 2 1 4 2 4 4
P4 1 4 3 2 2 3 6 6 5 4

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.
b. If a request from process P1 arrives for (1, 1, 0, 0, 1), can the request be granted immediately?
c. If a request from process P4 arrives for (0, 0, 2, 0, 1), can the request be granted immediately?

a. Illustrate that the system is in a safe state by demonstrating an order in which

the processes may complete.

Ans:

Need = Max – Allocation.

Now, let us see which of the above needs may be met by the Available resources.

P1’s Need are satisfied. So assume we have allocated these resources to P1. P1 completes execution and then releases its resources.

Now Available= <3 3 3 1 2> + <0 1 2 1 1> = <3 4 5 2 3>.

Now, P2’s Need are satisfied. So assume we have allocated these resources to P2. P2 completes execution and then releases its resources.

Now Available= <3 4 5 2 3> + <2 1 0 3 1> = <5 5 5 5 4>.

Now, P3’s Need are satisfied. So assume we have allocated these resources to P3. P3 completes execution and then releases its resources.

Now Available= <5 5 5 5 4> + <1 3 1 2 2> = <6 8 6 7 6>.

Now, P4’s Need are satisfied. So assume we have allocated these resources to P4. P4 completes execution and then releases its resources.

Now Available= <6 8 6 7 6> + <1 4 3 2 2> = <7 12 9 9 8>.

Now, P1, P2, P3 or P4’s Need may be satisfied. Assume we have allocated resources to P0. P0 completes execution and then releases its resources.

Now Available= <7 12 9 9 8> + < 2 0 0 1 0>= <9 12 9 10 8>.

Since there is at least one sequence <P1, P2, P3, P4, P0> that can successfully complete execution, there is no deadlock.

b. If a request from process P1 arrives for (1, 1, 0, 0, 1), can the request be granted immediately?

Ans: To answer this question, first let us assume that the request (1, 1, 0, 0, 1) is granted.

Then Available=<3 3 2 1 2> – <1 1 0 0 1> = < 2 2 2 1 1>.

P0 can still complete with the Available. After it completes,

Available = < 2 2 2 1 1> + <2 0 0 1 1> = <4 2 2 2 2>.

P3 can still finish with the Available. After it completes,

Available = <4 2 2 2 2> + <1 3 1 2 2 > = <5 5 3 4 2>.

P1, P2, or P4 can finish in any order.

Since there is a possible sequence in which all processes can finish even after granting P1’s (1 1 0 0 1) request, the request may be granted immediately.

c. If a request from process P4 arrives for (0, 0, 2, 0 1), can the request be granted immediately?

Ans: To answer this question, first let us assume that the request (0, 0, 2, 0 1) is granted.

Then Available=<3 3 2 1 2> – <0 0 2 0 1> = < 3 3 0 1 3>.

None of the processes P0-P4 can finish with the new Available. So we should defer granting resources to this request.

Order NOW for a 10% Discount
Pages (550 words)
Approximate price: -

Why Us?

Top Quality and Well-Researched Papers

All ourbpapers are written from scratch. In fact, Clients who ask for paraphrasing services are highly discouraged. We have writers ready to craft any paper from scratch and deliver quality ahead of time.

Our writers keeps you posted on your papers progress - providing you with paper outline/draft. You are also at liberty to communicate directly with your writer.

Free Unlimited Revisions

If you think we missed something, send your order for a free revision. You have 10 days to submit the order for review after you have received the final document. You can do this yourself after logging into your personal account or by contacting our support.

Prompt Delivery and 100% Money-Back-Guarantee

All papers are always delivered on time, in many cases quite ahead of time. In case we need more time to master your paper, we may contact you regarding the deadline extension. In case you cannot provide us with more time, a 100% refund is guaranteed.

Original & Confidential

We use several writing tools checks to ensure that all documents you receive are free from plagiarism. Our editors carefully review all quotations in the text. We also promise maximum confidentiality in all of our services.

Our support agents are available 24 hours a day 7 days a week and committed to providing you with the best customer experience. Get in touch whenever you need any assistance.

Try it now!

## Calculate the price of your order

Total price:
\$0.00

How it works?

Fill in the order form and provide all details of your assignment.

Proceed with the payment

Choose the payment system that suits you most.

Our Services

No need to work on your paper at night. Sleep tight, we will cover your back. We offer all kinds of writing services.

## Essay Writing Service

No matter what kind of academic paper you need and how urgent you need it, you are welcome to choose your academic level and the type of your paper at an affordable price. We take care of all your paper needs and give a 24/7 customer care support system.