Nebil Cover3
Nebil Cover3
HACHALU HUNDESSA
CAMPUS
DEPARTMENT OF COMPUTER SCIENCE
OPERATING SYSTEM ASSIGNMENT
SECTION:- 1
NAME ID NO
1- NABIL MOHAMMED…………….……………..UGR/51354/13
2- SOFAN AYALEW………………………..………..UGR/51147/13
3-OUMER ABDO……………………………………..UGR/54008/13
4-ABDUREZAK AHMED…….……………………..UGR/51362/13
5-ABEBE GONFA……………………………………..UGR/50249/13
6-KUMNEGER GASHAW…………………………..UGR/50246/13
7-ADANU DERESA…………………….……………..UGR/51612/13
1
AMBO, ETHIOPIA
The system is in a safe state since the sequence < P1, P3, P4, P0, P2> satisfies
safety criteria.
Apply the safety algorithm:
Set Work (3, 3, 2) and Finish (F, F, F, F, F)
Search for a process that can terminate,
Terminate Search
Since Finish contains processes that have not terminated (no safe sequence), the
above state is unsafe and the request by P0 for the resources is not granted
– P0 must wait.
3
Apply the safety algorithm:
Set Work (0, 0, 2) and Finish (F, F, F, F, F)
Search for a process that can terminate,
No process can have its needs (Need Matrix) met by the available
resources (Available vector), that is, no Need[i] Work.
Terminate search.
Since Finish contains processes that have not terminated, the above state is
unsafe and the request by P4 for the resources is not granted – P4 must wait.
4
Finish (F, F, F, T, F)
Terminate Search
Since Finish contains processes that have not terminated (no safe sequence), the
above state is unsafe and the request by P0 for the resources is not granted
– P0 must wait.
5
2🔸 5 processes, P0 through P4 and three resource types A, B, and C. Resource type A
has ten instances, resource type B has five instances, and resource type C has seven
instances. Suppose that, at time T0, the following snapshot of the system has been
taken:
The content of the matrix Need is defined to be Max − Allocation and is as follows:
753–010=743
322–302=020
902–302=600
222–211=011
433–002=431
6
P1: Need (p1) <= work
0 2 0 <= 2 3 0 -------- Finish [p1] =True
Work=work+ allocation( P1 )
=230+302
=5 3 2 ------------- new work.
7
WORK
A B C
P1 5 3 2
P3 7 4 3
P4 7 4 5
P0 7 5 5
P2 10 5 7
We claim that the system is currently in a safe state. Indeed, the sequence <P1,
P3, P4, P0, P2> satisfies the safety criteria.
Suppose now that process P4 requests one additional instance of resource type A
and two instances of resource type C, so Request1 = (3,3,0). We here implement
Resource-Request Algorithm:
You should be able to see, however, that when the system is in this state, a
request for (3,3,0) by P4 cannot be granted, since the resources are not
available.
8
B🔸Can request for (0,2,0) by P0 be granted?
Suppose now that process P0 requests one additional instance of resource type A and
two instances of resource type C, so Request2 = (0,2,0). We here implement Resource-
Request Algorithm:
9
Furthermore, a request for (0,2,0) by P0 cannot be granted, even though the resources
are available, since the resulting state is unsafe.
10