P. 1
Os Programs

Os Programs

|Views: 1,274|Likes:
Published by rijine

More info:

Published by: rijine on Oct 15, 2011
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as DOC, PDF, TXT or read online from Scribd
See more
See less

11/10/2014

pdf

text

original

Ex. No. :
Date :

AIM:

To implement Banker’s algorithm.

ALGORITHM:

1.Start the program.
2.Get the number of processes, number of resources, maximum number of
resources, allocated resources and available resources.
3.Initialize the finish (i) variable for all processes to 0.
4.Calculate the need matrix as
Needed resources = max. No. of resources – allocated no. of resources

5.Find a process with

a.Needed resources <= available resources & finish [ i] = 0
b.If such a process is found
Available resources = allocated resources of process i
+ available resources & set finish [ i ] = 1.
6.If finish [i] of all processes = 1 then the system is in safe state. Otherwise they
system is in unsafe state.
7.End the program.

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->