You are on page 1of 26

INDEX

(Operating System Lab - CSE-313)


5th Semester Compter Enginerring
Sr.
Number
Name of Experiment Document No.
1
Implementation of First Come First Serve(FCFS)
Scheduling Scheme.
HEC/CE/CSE-33/!-
2
Implementation of Shortest "o# First(S"F)
Scheduling Scheme
HEC/CE/CSE-33/!- $
3
Implementation of !riorit% Scheduling
HEC/CE/CSE-33/!-3
4
Implementation of &ound &o#in Scheduling
Scheme
HEC/CE/CSE-33/!-'
5
Implementation of Shortest "o# First !reemptive
Scheduling Scheme.
HEC/CE/CSE-33/!-(
6
Implementation of )orst* #est and first fit for
contiguous allocation assuming randoml%
generated free space list.
HEC/CE/CSE-33/!-+
7 Implementation of &esource ,llocation -raph HEC/CE/CSE-33/!-.
8
Implement a !rogram for Conversion of &esource
,llocation -raph
/o 0ait For -raph.
HEC/CE/CSE-33/!-1
9
Implement a !rogram /o Find 0ait For -raph for
&esources.
HEC/CE/CSE-33/!-2
.
Originate! "#e$ie%e!
&y'
(ppro$e! by'
#e$ision No
#e$ision Date' E))e*ti$e
Date
Er+ ,eena-shi Er+ #+.+ .ra!han // ----NIL--- (01+ 2//3
Haryana Enineerin !o""ee
#$%$DH&'
HEC/CE/CSE-33/!-
E3periment Instructions
Isse ' /1
.age 1 o) 2
1+/ (I,4 Implementation of First Come First Serve(FCFS) Scheduling Scheme
2+/ SCO.E' /his !ractical )ill help the students to implement the First Come First
Serve Scheduling techni5ue.
3+/ CODIN1'
6include7stdio.h8
6include7conio.h8
void main()
9
int n*i*process:;<*#urst:;<*)ait:;<=
float sum>;.;*avg=
clrscr()=
printf(?@nEnter the num#er of processes4?)=
scanf(?Ad?*Bn)=
if(n8;)
9
printf(?Enter a value less than ;?)=
e3it()=
C
for(i>=i7>n=iDD)
9
printf(?Enter the processAd4?*i)=
scanf(?Ad?*Bprocess:i<)=
C
for(i>=i7>n=iDD)
9
printf(?Enter the #urst time of process:Ad<4?*i)=
scanf(?Ad?*B#urst:i<)=
C
)ait:<>;=
for(i>$=i7>n=iDD)
9
)ait:i<>)ait:i-<D#urst:i-<=
Originate! "#e$ie%e!
&y'
(ppro$e! by'
#e$ision No
#e$ision Date' E))e*ti$e
Date
Er+ ,eena-shi Er+ #+.+ .ra!han // ----NIL--- (01+ 2//3
Haryana Enineerin !o""ee
#$%$DH&'
HEC/CE/CSE-33/!-
E3periment Instructions
Isse ' /1
.age 2 o) 2
sum>sumD)ait:i<=
C
avg>(float)sum/n=
for(i>=i7>n=iDD)
printf(?@n/he )aiting time for !:Ad< is Ad?*process:i<*)ait:i<)=
printf(?@n /he average )aiting time is Af?*avg)=
getch()=
C
4+/ IN.05'
Enter the num#er of processes4 3
Enter the process4
Enter the process$4$
Enter the process343
Enter the #urst time of process:<4+
Enter the #urst time of process:$<4'
Enter the #urst time of process:3<4;
5+/ O05.05'
/he )aiting time for !:< is4;
/he )aiting time for !:$< is4+
/he )aiting time for !:3< is4;
/he average )aiting time is41
Originate! "#e$ie%e!
&y'
(ppro$e! by'
#e$ision No
#e$ision Date' E))e*ti$e
Date
Er+ ,eena-shi Er+ #+.+ .ra!han // ----NIL--- (01+ 2//3
Haryana Enineerin !o""ee
#$%$DH&'
HEC/CE/CSE-33/!-$
E3periment Instructions
Isse ' /1
.age 1 o) 3
1+/ (I,' Implementation of Shortest "o# First(S"F) Scheduling Scheme.
2+/ SCO.E' /his !ractical )ill help the students to implement the Shortest "o#
First(S"F) Scheduling techni5ue.
3+/ CODIN1'
6include7stdio.h8
6include7conio.h8
void main()
9
int n*E*i*process:;<*temp*#urst:;<*)ait:;<=
float sum>;.;*avg=
clrscr()=
printf(?@nEnter the num#er of processes4?)=
scanf(?Ad?*Bn)=
if(n8;)
9
printf(?Enter a value less than ;?)=
e3it()=
C
for(i>=i7>n=iDD)
9
printf(?Enter the processAd4?*i)=
scanf(?Ad?*Bprocess:i<)=
C
for(i>=i7>n=iDD)
9
printf(?Enter the #urst time of process:Ad<4?*i)=
scanf(?Ad?*B#urst:i<)=
Originate! "#e$ie%e!
&y'
(ppro$e! by'
#e$ision No
#e$ision Date' E))e*ti$e
Date
Er+ ,eena-shi Er+ #+.+ .ra!han // ----NIL--- (01+ 2//3
Haryana Enineerin !o""ee
#$%$DH&'
HEC/CE/CSE-33/!-$
E3periment Instructions
Isse ' /1
.age 2 o) 3
C
for(E>=E7>n-=EDD)
for(i>= i7>n-E=iDD)
9
if(#urst:i<8#urst:iD<)
9
temp>#urst:i<=
#urst:i<>#urst:iD<=
#urst:iD<>temp=
temp>process:i<=
process:i<>process:iD<=
process:iD<>temp=
C
C
)ait:<>;=
for(i>$=i7>n=iDD)
9
)ait:i<>)ait:i-<D#urst:i-<=
sum>sumD)ait:i<=
C
avg>(float)sum/n=
for(i>=i7>n=iDD)
printf(?@n/he )aiting time for !:Ad< is Ad?*process:i<*)ait:i<)=
printf(?@n /he average )aiting time is Af?*avg)=
getch()=
C
Originate! "#e$ie%e!
&y'
(ppro$e! by'
#e$ision No
#e$ision Date' E))e*ti$e
Date
Er+ ,eena-shi Er+ #+.+ .ra!han // ----NIL--- (01+ 2//3
Haryana Enineerin !o""ee
#$%$DH&'
HEC/CE/CSE-33/!-3
E3periment Instructions
Isse ' /1
.age 3 o) 3
4+/ IN.05'
Enter the num#er of processes4 3
Enter the process4
Enter the process$4$
Enter the process343
Enter the #urst time of process:<4+
Enter the #urst time of process:$<4'
Enter the #urst time of process:3<4;
5+/ O05.05'
/he )aiting time for !:< is4'
/he )aiting time for !:$< is4;
/he )aiting time for !:3< is4;
/he average )aiting time is4.
Originate! "#e$ie%e!
&y'
(ppro$e! by'
#e$ision No
#e$ision Date' E))e*ti$e
Date
Er+ ,eena-shi Er+ #+.+ .ra!han // ----NIL--- (01+ 2//3
Haryana Enineerin !o""ee
#$%$DH&'
HEC/CE/CSE-33/!-3
E3periment Instructions
Isse ' /1
.age 1 o) 3
1+/ (I,' Implementation of !riorit% Scheduling
2+/ SCO.E' /his !ractical )ill help the students to implement the !riorit% Scheduling
techni5ue.
3+/ CODIN1'
6include7stdio.h8
6include7conio.h8
void main()
9
int n*E*i*process:;<*temp*#urst:;<*)ait:;<*priorit%:;<=
float sum>;.;*avg=
clrscr()=
printf(?@nEnter the num#er of processes4?)=
scanf(?Ad?*Bn)=
if(n8;)
9
printf(?Enter a value less than ;?)=
e3it()=
C
for(i>=i7>n=iDD)
9
printf(?Enter the processAd4?*i)=
scanf(?Ad?*Bprocess:i<)=
C
for(i>=i7>n=iDD)
9
printf(?Enter the #urst time of process:Ad<4?*i)=
scanf(?Ad?*B#urst:i<)=
C
for(i>=i7>n=iDD)
9
printf(?Enter the priorit% of process:Ad<4?*i)=
scanf(?Ad?*Bpriorit%:i<)=
C
Originate! "#e$ie%e!
&y'
(ppro$e! by'
#e$ision No
#e$ision Date' E))e*ti$e
Date
Er+ ,eena-shi Er+ #+.+ .ra!han // ----NIL--- (01+ 2//3
Haryana Enineerin !o""ee
#$%$DH&'
HEC/CE/CSE-33/!-3
E3periment Instructions
Isse ' /1
.age 2 o) 3
for(E>=E7>n-=EDD)
for(i>= i7>n-=iDD)
9
if(priorit%:i<8priorit%:iD<)
9
temp>priorit%:i<=
priorit%:i<>priorit%:iD<=
priorit%:iD<>temp=
temp>process:i<=
process:i<>process:iD<=
process:iD<>temp=
temp>#urst:i<=
#urst:i<>#urst:iD<=
#urst:iD<>temp=
C
C
)ait:<>;=
for(i>$=i7>n=iDD)
9
)ait:i<>)ait:i-<D#urst:i-<=
sum>sumD)ait:i<=
C
avg>(float)sum/n=
for(i>=i7>n=iDD)
printf(?@n/he )aiting time for !:Ad< is Ad?*process:i<*)ait:i<)=
printf(?@n /he average )aiting time is Af?*avg)=
getch()=
C
Originate! "#e$ie%e!
&y'
(ppro$e! by'
#e$ision No
#e$ision Date' E))e*ti$e
Date
Er+ ,eena-shi Er+ #+.+ .ra!han // ----NIL--- (01+ 2//3
Haryana Enineerin !o""ee
#$%$DH&'
HEC/CE/CSE-33/!-'
E3periment Instructions
Isse ' /1
.age 3 o) 3
4+/ IN.05'
Enter the num#er of processes4 3
Enter the process4
Enter the process$4$
Enter the process343
Enter the #urst time of process:<4+
Enter the #urst time of process:$<4'
Enter the #urst time of process:3<4;
Enter the priorit% of process:<43
Enter the priorit% of process:$<4$
Enter the priorit% of process:3<4
5+/ O05.05'
/he )aiting time for !:< is4'
/he )aiting time for !:$< is4;
/he )aiting time for !:3< is4;
/he average )aiting time is4$
Originate! "#e$ie%e!
&y'
(ppro$e! by'
#e$ision No
#e$ision Date' E))e*ti$e
Date
Er+ ,eena-shi Er+ #+.+ .ra!han // ----NIL--- (01+ 2//3
Haryana Enineerin !o""ee
#$%$DH&'
HEC/CE/CSE-33/!-3
E3periment Instructions
Isse ' /1
.age 1 o) 3
1+/ (I,' Implementation of &ound &o#in Scheduling Scheme

2+/ SCO.E' /his !ractical )ill help the students to implement the &ound &o#in
Scheduling techni5ue.
3+/ CODIN1'
6include7stdio.h8
6include7conio.h8
int 3>;*flag>;*n*pos*E*i*sum=
int process:;<*#:;<*c:;<*5uantum*#urst:;<*)ait:;<=
float avg=
void main()
9
clrscr()=
printf(?@nEnter the num#er of processes4?)=
scanf(?Ad?*Bn)=
printf(?Enter the time 5uantum4?)=
scanf(?Ad?*B5uantum)=
if(n8;)
9
printf(?Enter a value less than ;?)=
e3it()=
C
for(i>=i7>n=iDD)
9
printf(?Enter the processAd4?*i)=
scanf(?Ad?*Bprocess:i<)=
Originate! "#e$ie%e!
&y'
(ppro$e! by'
#e$ision No
#e$ision Date' E))e*ti$e
Date
Er+ ,eena-shi Er+ #+.+ .ra!han // ----NIL--- (01+ 2//3
Haryana Enineerin !o""ee
#$%$DH&'
HEC/CE/CSE-33/!-'
E3periment Instructions
Isse ' /1
.age 2 o) 3
C
for(i>=i7>n=iDD)
9
printf(?Enter the #urst time of process:Ad<4?*i)=
scanf(?Ad?*B#urst:i<)=
C
for(i>=i7>n=iDD)
#:i<>#urst:i<=
printf(?@nE3ecuting se5uence is 4?)=
)hile(flagF>)
9
printf(?@n?)=
for(i>=i7>n=iDD)
9
if(#urst:i<8;)
9
pos>i=
if(#urst:i<75uantum)
9
c:i<>3D#urst:i<=
#urst:i<>;=
C
else
9
c:i<>3D5uantum=
#urst:i<->5uantum=
C
3>c:i<=
printf(?!:Ad<-8?*process:i<)=
C
C
flag>=
for(i>=i7>n=iDD)
if(#urst:i<8;)
flag>;=
C
Originate! "#e$ie%e!
&y'
(ppro$e! by'
#e$ision No
#e$ision Date' E))e*ti$e
Date
Er+ ,eena-shi Er+ #+.+ .ra!han // ----NIL--- (01+ 2//3
Haryana Enineerin !o""ee
#$%$DH&'
HEC/CE/CSE-33/!-'
E3periment Instructions
Isse ' /1
.age 3 o) 3
for(i>=i7>n=iDD)
9
)ait:i<>c:i<-#:i<=
sum>sumD)ait:i<=
C
avg>(float)sum/n=
printf(?@n !&GCESS@tHI&S/ /IJE@tCGJ!I/,/IGK /IJE@t0,I/IK- /IJE@n?)=
for(i>=i7>n=iDD)
printf(?!:Ad<@tA;d@tA(d@tA1d@n?*process:i<*#:i<*c:i<*)ait:i<)=
printf(?@n /he average )aiting time is Af?*avg)=
getch()=
C
4+/ IN.05'
Enter the num#er of processes4 3
Enter the time 5uantum4'
Enter the process4
Enter the process$4$
Enter the process343
Enter the #urst time of process:<4+
Enter the #urst time of process:$<4'
Enter the #urst time of process:3<4;
5+/ O05.05'
E3ecuting se5uence is 4
!&GCESS HI&S/ /IJE CGJ!I/,/IGK /IJE 0,I/IK- /IJE
' ' ;
$ ' 1
' 3 ' $
1 $ '
$ 3 '
+ '
3 $ 1 +
/he average )aiting time is4 $+
Originate! "#e$ie%e!
&y'
(ppro$e! by'
#e$ision No
#e$ision Date' E))e*ti$e
Date
Er+ ,eena-shi Er+ #+.+ .ra!han // ----NIL--- (01+ 2//3
Haryana Enineerin !o""ee
#$%$DH&'
HEC/CE/CSE-33/!-(
E3periment Instructions
Isse ' /1
.age 1 o) 4
1+/ (I,' Implementation of Shortest "o# First !reemptive Scheduling Scheme.
2+/ SCO.E' /his !ractical )ill help the students to implement the Shortest Eo#
First(S"F) !remmptive Scheduling techni5ue.
3+/ CODIN1'
6include7stdio.h8
6include7conio.h8
void main()
9
int 3>;*n*E*min*pos>*a:;<*ct:;<*i*process:;<*temp*#:;<*#urst:;<*)ait:;<=
float sum>;.;*avg=
clrscr()=
printf(?@nEnter the num#er of processes4?)=
scanf(?Ad?*Bn)=
if(n8;)
9
printf(?Enter a value less than ;?)=
e3it()=
C
for(i>=i7>n=iDD)
9
printf(?Enter the processAd4?*i)=
scanf(?Ad?*Bprocess:i<)=
C
for(i>=i7>n=iDD)
Originate! "#e$ie%e!
&y'
(ppro$e! by'
#e$ision No
#e$ision Date' E))e*ti$e
Date
Er+ ,eena-shi Er+ #+.+ .ra!han // ----NIL--- (01+ 2//3
Haryana Enineerin !o""ee
#$%$DH&'
HEC/CE/CSE-33/!-(
E3periment Instructions
Isse ' /1
.age 2 o) 4
9
printf(?Enter the arrival time of process:Ad<4?*i)=
scanf(?Ad?*Ba:i<)=
C
for(i>=i7>n=iDD)
9
printf(?Enter the #urst time of process:Ad<4?*i)=
scanf(?Ad?*B#urst:i<)=
C
for(i>=i7>n=iDD)
#:i<>#urst:i<= /Lcopies #urst time in another arra%L/
for(i>=i7>n=iDD)
ct:i<>;= //initialiMes computation time
for(i>=i7>n-=iDD)
9
if(i>>)
9
#urst:i<->(a:iD<-a:i<)=
printf(?!:Ad<-8?*process:i<)=
ct:i<>3Da:iD<-a:i<=
3>ct:i<=
C
else
9
min>(;;=
for(E>i=E8>=E--)
9
if(#urst:E<7min BB #urst:E<8;)
9
min>#urst:E<=
pos>E=
C
C
printf(?!:Ad<-8?*process:pos<)=
#urst:pos<->(a:iD<-a:i<)=
ct:pos<>a:iD<-a:i<D3=
Originate! "#e$ie%e!
&y'
(ppro$e! by'
#e$ision No
#e$ision Date' E))e*ti$e
Date
Er+ ,eena-shi Er+ #+.+ .ra!han // ----NIL--- (01+ 2//3
Haryana Enineerin !o""ee
#$%$DH&'
HEC/CE/CSE-33/!-(
E3periment Instructions
Isse ' /1
.age 3 o) 4
3>ct:pos<=
C
C
/L min>#urst:<=
for(E>n=E8=E--)
9
if(#urst:E<7min)
9
min>#urst:E<=
pos>E=
C
C
printf(?!:Ad<-8?*process:pos<)=
ct:pos<>#urst:pos<D3=
#urst:pos<>;=
3>ct:pos<=
L/ for(E>=E7>n-=EDD)
for(i>= i7>n-E=iDD)
9
if(#urst:i<8#urst:iD<)
9
temp>#urst:i<=
#urst:i<>#urst:iD<=
#urst:iD<>temp=
temp>process:i<=
process:i<>process:iD<=
process:iD<>temp=
temp>a:i<=
a:i<>a:iD<=
a:iD<>temp=
temp>ct:i<=
ct:i<>ct:iD<=
ct:iD<>temp=
temp>#:i<=
#:i<>#:iD<=
#:iD<>temp=
Originate! "#e$ie%e!
&y'
(ppro$e! by'
#e$ision No
#e$ision Date' E))e*ti$e
Date
Er+ ,eena-shi Er+ #+.+ .ra!han // ----NIL--- (01+ 2//3
Haryana Enineerin !o""ee
#$%$DH&'
HEC/CE/CSE-33/!-(
E3periment Instructions
Isse ' /1
.age 4 o) 4
C
C
for(i>=i7>n=iDD)
9
if(#urst:i<8;)
9
printf(?!:Ad<-8?*process:i<)=
ct:i<>3D#urst:i<=
3>ct:i<=
C
C
//)ait:<>;=
for(i>=i7>n=iDD)
9
)ait:i<>ct:i<-(a:i<D#:i<)=
sum>sumD)ait:i<=
C
avg>(float)sum/n=
printf(?@n!&GCESS@t,&&IN,O /IJE @t computation time@t0,I/IK-
/IJE@n?)=
for(i>=i7>n=iDD)
9
printf(?Ad@t@t?*process:i<)=
printf(?Ad@t@tAd@t@tAd@n?*a:i<*ct:i<*)ait:i<)=
C
printf(?@n/he average )aiting time is Af?*avg)=
getch()=
C
Originate! "#e$ie%e!
&y'
(ppro$e! by'
#e$ision No
#e$ision Date' E))e*ti$e
Date
Er+ ,eena-shi Er+ #+.+ .ra!han // ----NIL--- (01+ 2//3
Haryana Enineerin !o""ee
#$%$DH&'
HEC/CE/CSE-33/!-+
E3periment Instructions
Isse ' /1
.age 1 o) 2
1+/ (I,4 Implementation of )orst* #est and first fit for contiguous allocation
assuming randoml% generated free space list.
2+/ SCO.E' /his !ractical )ill help the students to implement the )orst* #est and
first fit for contiguous allocation assuming randoml% generated free space list.
3+/ CODIN1'
6include7stdio.h8
6include7conio.h8
void main()
9
int i*process*num*re5*siMe:;<*occup%:;<=
clrscr()=
printf(?@n Enter the num#r of partitions4?)=
scanf(?Ad?*Bnum)=
for(i>=i7>num=iDD)
9
printf(?Enter the siMe of Adth partition4?*i)=
scanf(?Ad?*BsiMe:i<)=
C
for(i>=i7>num=iDD)
9
printf(?Is Ad #locP occupied(Ko-;*Qes-)4?*i)=
scanf(?Ad?*Boccup%:i<)=
C
printf(?@n Enter the siMe of re5uest4?)=
scanf(?Ad?*Bre5)=
/LL Calculates #locP to #e allocated according to the Ist fitLL/
for(i>=i7>num=iDD)
9
Originate! "#e$ie%e!
&y'
(ppro$e! by'
#e$ision No
#e$ision Date' E))e*ti$e
Date
Er+ ,eena-shi Er+ #+.+ .ra!han // ----NIL--- (01+ 2//3
Haryana Enineerin !o""ee
#$%$DH&'
HEC/CE/CSE-33/!-.
E3periment Instructions
Isse ' /1
.age 2 o) 2
if(occup%:i<>>;BBsiMe:i<8>re5)
9
printf(?,llocated #locP acc. to Ist fit is Ad?*i)=
occup%:i<>=
#reaP=
C
C
#estR)orstRfit(num*re5*occup%*siMe)=
getch()=
C
Originate! "#e$ie%e!
&y'
(ppro$e! by'
#e$ision No
#e$ision Date' E))e*ti$e
Date
Er+ ,eena-shi Er+ #+.+ .ra!han // ----NIL--- (01+ 2//3
Haryana Enineerin !o""ee
#$%$DH&'
HEC/CE/CSE-33/!-.
E3periment Instructions
Isse ' /1
.age 1 o) 3
1+/ (I,' Implementation of &esource ,llocation -raph
2+/ SCO.E' /his !ractical )ill help the students to implement &esource ,llocation
-raph.
3+/ CODIN1'
6include7stdio.h8
6include7conio.h8
6include7graphics.h8
void main()
9
int gd>SE/EC/*gm=
int t:<>9(;*((*$((*3((*'((C*l>$;;*
#:<>9;;*$;;*3;;*';;*(;;C*d>3;;*
3:<>9+;*(;*$';*33;C*%>+;=
int s*process*res*ins:+<*i*E*P*a:+<*r:+<*all:+<:+<*re5:+<:+<=
char str:;<=
clrscr()=
initgraph(Bgd*Bgm*??)=
printf(?@nEnter the num#er of processes4?)=
scanf(?Ad?*Bprocess)=
printf(?@nEnter the num#er of resources4?)=
scanf(?Ad?*Bres)=
for(i>=i7>res=iDD)
9
printf(?@nEnter the num#er of instance of resource Ad4?*i)=
scanf(?Ad?*Bins:i<)=
C
for(i>=i7>process=iDD)
9
printf(?@nEnter the num#er of resources allocated to process Ad4?*i)=
scanf(?Ad?*Ba:i<)=
printf(?@nEnter the resources allocated to process Ad4?*i)=
for(E>=E7>a:i<=E
Originate! "#e$ie%e!
&y'
(ppro$e! by'
#e$ision No
#e$ision Date' E))e*ti$e
Date
Er+ ,eena-shi Er+ #+.+ .ra!han // ----NIL--- (01+ 2//3
Haryana Enineerin !o""ee
#$%$DH&'
HEC/CE/CSE-33/!-.
E3periment Instructions
Isse ' /1
.age 2 o) 3
scanf(?Ad?*Ball:i<:E<)=
printf(?@nEnter the num#er of resources re5uested #% process Ad4?*i)=
scanf(?Ad?*Br:i<)=
printf(?@nEnter the resources re5uested #% process Ad4?*i)=
for(E>=E7>r:i<=EDD)
scanf(?Ad?*Bre5:i<:E<)=
C
clrscr()=
for(i>=i7>process=iDD)
9
circle(3:i<*%*';)=
itoa(i*str*;)=
outte3t3%(3:i<*%-'1*str)=
C
for(i>=i7>res=iDD)
9
rectangle(t:i<*l*#:i<*d)=
itoa(i*str*;)=
outte3t3%(#:i<-$$*dD1*str)=
s>ins:i<=
for(E>=E7>s=EDD)
putpi3el(t:i<D$;*lD$;LE*&ES)=
C
for(i>=i7>process=iDD)
9
for(E>=E7>a:i<=EDD)
9
setcolor(-&EEK)=
line(3:i<*%D';*t:all:i<:E<<D$;*l)=
line(3:i<*%D';*3:i<-(*%D'.)=
line(3:i<*%D';*3:i<D(*%D'.)=
C
Originate! "#e$ie%e!
&y'
(ppro$e! by'
#e$ision No
#e$ision Date' E))e*ti$e
Date
Er+ ,eena-shi Er+ #+.+ .ra!han // ----NIL--- (01+ 2//3
Haryana Enineerin !o""ee
#$%$DH&'
HEC/CE/CSE-33/!-.
E3periment Instructions
Isse ' /1
.age 3 o) 3
for(E>=E7>r:i<=EDD)
9
setcolor(&ES)=
line(3:i<*%D';*t:re5:i<:E<<D$;*l)=
line(t:re5:i<:E<<D$;*l*t:re5:i<:E<<-(D$;*l-()=
line(t:re5:i<:E<<D$;*l*t:re5:i<:E<<D(D$;*l-()=
C
C
dela%((;;)=
getch()=
restorecrtmode=
closegraph=
C
Haryana Enineerin !o""ee
#$%$DH&'
HEC/CE/CSE-33/!-1
E3periment Instructions
Isse ' /1
.age 1 o) 3
Originate! "#e$ie%e!
&y'
(ppro$e! by'
#e$ision No
#e$ision Date' E))e*ti$e
Date
Er+ ,eena-shi Er+ #+.+ .ra!han // ----NIL--- (01+ 2//3
(I,' Implement a !rogram for Conversion of &esource ,llocation -raph
to 0ait For -raph.
SCO.E' /his !ractical )ill help the students to convert &esource ,llocation -raph
into 0ait for -raph.
CODIN1'
6include7stdio.h8
6include7conio.h8
6include7graphics.h8
void main()
9
int gd>SE/EC/*gm=
int nr*np*pr:+<:+<*rp:+<*i*E*temp*pp:(<:(<=
int cir:(<:3<>9;;*(;*3;*3;;*(;*3;*;;*3;;*3;*3;;*3;;*3;*$;;*(;*3;C=
printf(?EK/E& /HE KG. GF &ESGI&CES !OE,SE@n?)=
scanf(?Ad?*Bnr)=
printf(?EK/E& /HE KG. GF !&GCESSES@n?)=
scanf(?Ad?*Bnp)=
clrscr()=
printf(?@t 666EK/E&IK- /HE &ETIES/ J,/&IU666@n@n@n?)=
for(i>=i7>np=iDD)
9
for(E>=E7>nr=EDD)
9
printf(?Is !Ad re5uesting for &Ad@t V?*i*E)=
scanf(?Ad?*Bpr:i<:E<)=
C
C
clrscr()=
printf(?@t 666EK/E&IK- /HE ,SSI-KJEK/ J,/&IU666@n@n@n?)=
Haryana Enineerin !o""ee
#$%$DH&'
HEC/CE/CSE-33/!-1
E3periment Instructions
Isse ' /1
.age 2o) 3

Originate! "#e$ie%e!
&y'
(ppro$e! by'
#e$ision No
#e$ision Date' E))e*ti$e
Date
Er+ ,eena-shi Er+ #+.+ .ra!han // ----NIL--- (01+ 2//3
for(i>=i7>np=iDD)
9
printf(?Enter the process no. to )hich &Ad is assigned@t?*i)=
scanf(?Ad?*Brp:i<)=
C
for(i>=i7>np=iDD)
9
for(E>=E7>nr=EDD)
9
if(pr:i<:E<>>)
9
temp>rp:E<=
pp:i<:temp<>$3'=
C
C
C
for(i>=i7>np=iDD)
9
for(E>=E7>nr=EDD)
9
if(pp:i<:E<F>$3')
9
pp:i<:E<>;=
C
else
9
pp:i<:E<>=
C
C
C
clrscr()=
printf(?@t 666!&IK/IK- /HE 0,I/ FG& J,/&IU666@n@n@n?)=
for(i>=i7>np=iDD)
9

Haryana Enineerin !o""ee
#$%$DH&'
HEC/CE/CSE-33/!-1
E3periment Instructions
Isse ' /1
.age 3 o) 3
Originate! "#e$ie%e!
&y'
(ppro$e! by'
#e$ision No
#e$ision Date' E))e*ti$e
Date
Er+ ,eena-shi Er+ #+.+ .ra!han // ----NIL--- (01+ 2//3
for(E>=E7>nr=EDD)
9
printf(?Ad?*pp:i<:E<)=
C
printf(?@n?)=
C
getch()=
clrscr()=
initgraph(Bgd*Bgm*?c4@@tc@@#gi?)=
setcolor(0HI/E)=
circle(cir:;<:;<*cir:;<:<*cir:;<:$<)=
outte3t3%(cir:;<:;<*cir:;<:<*? !?)=
circle(cir:<:;<*cir:<:<*cir:<:$<)=
outte3t3%(cir:<:;<*cir:<:<*? !$?)=
circle(cir:$<:;<*cir:$<:<*cir:$<:$<)=
outte3t3%(cir:$<:;<*cir:$<:<*? !3?)=
circle(cir:3<:;<*cir:3<:<*cir:3<:$<)=
outte3t3%(cir:3<:;<*cir:3<:<*? !'?)=
circle(cir:'<:;<*cir:'<:<*cir:'<:$<)=
outte3t3%(cir:'<:;<*cir:'<:<*? !(?)=
for(i>=i7>np=iDD)
9
for(E>=E7>nr=EDD)
9
if(pp:i<:E<>>)
9
line(cir:i-<:;<*cir:i-<:<*cir:E-<:;<*cir:E-<:<)=
C
C
C
getch()=
closegraph()=
restorecrtmode()=
C
Originate! "#e$ie%e!
&y'
(ppro$e! by'
#e$ision No
#e$ision Date' E))e*ti$e
Date
Er+ ,eena-shi Er+ #+.+ .ra!han // ----NIL--- (01+ 2//3
Haryana Enineerin !o""ee
#$%$DH&'
HEC/CE/CSE-33/!-.
E3periment Instructions
Isse ' /1
.age 1 o) 2
(I,' Implement a !rogram /o Find 0ait For -raph for &esources.
SCO.E' /his !ractical )ill help the students to find 0ait for -raph. for given
resorces
CODIN1'
6include7conio.h8
6include7stdio.h8
6include7graphics.h8
void main()
9
int gd>SE/EC/*gm*i*E*P=
int res*proc*alloc:+<*ass:+<:+<*path:+<:+<=
int 3:<>9.;*.;*$;*.;*.;*.;C=
int %:<>9+;*+;*2;*1;*1;*+;C=
clrscr()=
initgraph(Bgd*Bgm*? ?)=
printf(?@nEnter the num#er of resources4?)=
scanf(?Ad?*Bres)=
printf(?@nEnter the num#er of processes4?)=
scanf(?Ad?*Bproc)=
for(i>=i7>res=iDD)
9
printf(?Enter the process allocated to resource Ad4?*i)=
scanf(?Ad?*Balloc:i<)=
C
for(E>=E7>proc=EDD)
for(i>=i7>res=iDD)
9
Originate! "#e$ie%e!
&y'
(ppro$e! by'
#e$ision No
#e$ision Date' E))e*ti$e
Date
Er+ ,eena-shi Er+ #+.+ .ra!han // ----NIL--- (01+ 2//3
Haryana Enineerin !o""ee
#$%$DH&'
HEC/CE/CSE-33/!-.
E3periment Instructions
Isse ' /1
.age 2 o) 2
printf(?Is resource Ad allocated to process Ad4?*i*E)=
scanf(?Ad?*Bass:E<:i<)=
C
for(i>=i7>proc=iDD)
for(E>=E7>proc=EDD)
path:i<:E<>;=
for(i>=i7>proc=iDD)
for(E>=E7>res=EDD)
9
if(ass:i<:E<>>)
path:i<:alloc:E<<>=
C
clrscr()=
for(i>=i7>proc=iDD)
9
circle(3:i<*%:i<*$;)=
C
for(i>=i7>proc=iDD)
for(E>=E7>proc=EDD)
if(path:i<:E<>>)
line(3:i<*%:i<*3:E<*%:E<)=
getch()=
C
Originate! "#e$ie%e!
&y'
(ppro$e! by'
#e$ision No
#e$ision Date' E))e*ti$e
Date
Er+ ,eena-shi Er+ #+.+ .ra!han // ----NIL--- (01+ 2//3

You might also like