Question about Microsoft Windows XP Professional

# How to be solve banker algorithm?example - Microsoft Windows XP Professional

Posted by on

• Level 3:

An expert who has achieved level 3 by getting 1000 points

All-Star:

An expert that got 10 achievements.

MVP:

An expert that got 5 achievements.

Vice President:

An expert whose answer got voted for 100 times.

• Master

I m providing you this from my college notes

Banker's Algorithm

* multiple instances of resource types IMPLIES cannot use resource-allocation graph

* banks do not allocate cash unless they can satisfy customer needs when a new process enters the system

* declare in advance maximum need for each resource type

* cannot exceed the total resources of that type

* later, processes make actual request for some resources

* if the the allocation leaves system in safe state grant the resources

* otherwise, suspend process until other processes release enough resources

Banker: Data Structures define MAXN 10 /* maximum number of processes */
#define MAXM 10 /* maximum number of resource types */
int Available[MAXM]; /* Available[j] = current # of unused resource j */
int Max[MAXN][MAXM]; /* Max[i][j] = max demand of i for resource j */
int Allocation[MAXN][MAXM]; /* Allocation[i][j] = i's current allocation of j*/
int Need[MAXN][MAXM]; /* Need[i][j] = i's potential for more j */
/* Need[i][j] = Max[i][j] - Allocation[i][j] */

Notation:

X <= Y iff X[i] <= Y[i] for all i

(0,3,2,1) is less than (1,7,3,2)

(1,7,3,2) is NOT less than (0,8,2,1)

Each row of Allocation and Need are vectors: Allocation_i and Need_i

Banker: Example

Initially:

Available
A B C
10 5 7

Later Snapshot:

Max - Allocation = Need Available
A B C A B C A B C A B C
P0 7 5 3 0 1 0 7 4 3 3 3 2
P1 3 2 2 2 0 0 1 2 2
P2 9 0 2 3 0 2 6 0 0
P3 2 2 2 2 1 1 0 1 1
P4 4 3 3 0 0 2 4 3 1

Banker: Safety Algorithm

* consider some sequence of processes

* if the first process has Need less than Available

* it can run until done

* then release all of its allocated resources

* allocation is increased for next process

* if the second process has Need less than Available

* ...

* then all of the processes will be able to run eventually

* IMPLIES system is in a safe state

Banker: Safety Algorithm

STEP 1: initialize
Work := Available;
for i = 1,2,...,n
Finish[i] = false
STEP 2: find i such that both
a. Finish[i] is false
b. Need_i <= Work
if no such i, goto STEP 4
STEP 3:
Work := Work + Allocation_i
Finish[i] = true
goto STEP 2
STEP 4:
if Finish[i] = true for all i, system is in safe state

Banker: Safety Example

Using the previous example, P1,P3,P4,P2,P0 satisfies criteria.

Max - Allocation = Need <= Work Available
A B C A B C A B C A B C
P1 3 2 2 2 0 0 1 2 2 3 3 2 3 3 2
P3 2 2 2 2 1 1 0 1 1 5 3 2
P4 4 3 3 0 0 2 4 3 1 7 4 3
P2 9 0 2 3 0 2 6 0 0 7 4 5
P0 7 5 3 0 1 0 7 4 3 10 4 7
10 5 7<<< initial system

Banker: Resource-Request Algorithm

STEP 0: P_i makes Request_i for resources, say (1,0,2)
STEP 1: if Request_i <= Need_i
goto STEP 2
else ERROR
STEP 2: if Request_i <= Available
goto STEP 3
else suspend P_i
STEP 3: pretend to allocate requested resources
Available := Available - Request_i
Allocation_i := Allocation_i + Request_i;
Need_i := Need_i - Request_i
STEP 4: if pretend state is SAFE
then do a real allocation and P_i proceeds
else
restore the original state and suspend P_i

Banker: Resource-Request Algorithm [129]

Say P1 requests (1,0,2)

Compare to Need_1: (1,0,2) <= (1,2,2)

Compare to Available: (1,0,2) <= (3 3 2)

Pretend to allocate resources:

Max - Allocation = Need Available
A B C A B C A B C A B C
P0 7 5 3 0 1 0 7 4 3 2 3 0<<<
P1 3 2 2 3 0 2<<< 0 2 0<<<
P2 9 0 2 3 0 2 6 0 0
P3 2 2 2 2 1 1 0 1 1
P4 4 3 3 0 0 2 4 3 1

Is this safe? Yes: P1, P3, P4, P0, P2

Can P4 get (3,3,0)? No, (3,3,0) > (2,3,0) Available

Can P0 get (0,2,0)? (0,2,0) < (2,3,0) Available

Pretend: Available goes to (2,1,0)

Thanks And Regards

Posted on May 13, 2009

• Level 1:

An expert who has achieved level 1.

Mayor:

An expert whose answer got voted for 2 times.

• Contributor

W@nt @nnim@tion

Posted on Apr 04, 2010

## 2 Suggested Answers

Hi,
A 6ya expert can help you resolve that issue over the phone in a minute or two.
Best thing about this new service is that you are never placed on hold and get to talk to real repairmen in the US.
The service is completely free and covers almost anything you can think of (from cars to computers, handyman, and even drones).
click here to download the app (for users in the US for now) and get all the help you need.
Good luck!

Posted on Jan 02, 2017

Nice try. Find an upper-class student to give you one-on-one tutoring with your homework.

Posted on Dec 02, 2009

×

my-video-file.mp4

Complete. Click "Add" to insert your video.

×

## Related Questions:

Tip

### How to recover PDF password?

on Apr 29, 2010 | Computers & Internet

Tip

### Once you forgot PDF password, the data in the encrypted PDF file are on the...

For security, we often protect our PDF file by password , such as some academic papers or network magazines. If we want to edit secured PDF, we would better unlock them first. But something bad often happen, For example, when we want to print a secured PDF file, but the password is lost; or if we want to extract some excellent pages from a PDF file, we would fail to copy them. So how to unlock and edit secured PDF?
Fortunately, as far as I know, there are methods, such as Brute Force Attack and Dictionary Attack can resolve the problem. However another question comes, with so much software can retrieve PDF password, which one should be chosen? Well, according to my own experience, I recommend you
PDF Password Recovery 5.0 an easy-to-use tool designed for removing passwords added to Adobe Acrobat PDF documents.

Features:
1. All versions through Adobe Acrobat 9.0 are supported
2. Do NOT need Adobe Acrobat software.
3. Easy to use: step-to-step guide and screenshots
4. Recovers user password required to open the file
5. Decrypts PDF files protected with owner passwords
6. Instantly removes restrictions on copying, printing and other actions with the file
7. Program automatically saves password search state and can resume after a stop or a crash
8. Patterns can be used to minimize search time if any part of the password is known
9. Passwords of any length and complexity can be recovered
10.Free updates during one year.
you can download the product form Password Recovery Official site

on Apr 28, 2010 | Computers & Internet

### Banker's Algorithm usin c# code

Gee I SAW that movie and Tom Hanks was GREAT!

Feb 07, 2013 | Cell Phones

### I registered but i am not able to buy credit with my master card

Check it out with your bankers first, ie if your card is locked for internet transactions. This is probably due to security reasons usual answers from bankers!

Apr 03, 2011 | Computers & Internet

### Code of DES algorithm using C++

Why can you not just use an existing encryption library? It will be much more reliable. If on windows you can use the MS CryptoAPI library to encrypt using the DES.

If you still wish to make your own algorithm I found a page with javascript, perl, and php examples you can use to base your own custom conversion on at http://tero.co.uk/des/code.php

Apr 16, 2010 | Computers & Internet

### I have a trial version of excel 7 on my computer; it has expired what doI need to buy to enable wha have?

process allocation Max
A B C D A B C D
p1 0 0 1 2 0 0 1 2
p2 2 0 0 0 2 7 5 0
p3 0 0 3 4 6 6 5 6
p4 2 3 5 4 4 3 5 6
p5 0 3 3 2 0 6 5 6

total recourses in a system (r1,r2,r3,r4)=(6,7,12,12)
(i) Calculate available resource martrix & need matrix for state of
system
(ii) determine saftey if Iexits for the system applying banker's
algorithm.
(iii) p3 request for(0,1,0,0) . does this request lead to a deadlock?

Feb 01, 2010 | Microsoft Windows Vista Home Premium with...

### C program for banking algorithm to find deadlock.

Nice try. Find an upper-class student to give you one-on-one tutoring with your homework.

Apr 17, 2009 | Microsoft Windows XP Professional

## Open Questions:

#### Related Topics:

13,006 people viewed this question

## Ask a Question

Usually answered in minutes!

Level 3 Expert

Level 3 Expert