Sie sind auf Seite 1von 55

//.PROGRAM FOR SIMULATION OF FCFS CHEDULING ALGORITHM..// #include<stdio.h> main() { float avgwt,avgtt; char pname[1 ![1 !,c[1 !

[1 !; int wt[1 !,tt[1 !,"t[1 !,at[1 !,t,#,i,n,sum$ ,s"t$ ,ttime,%,ss$ ; printf(&'n'n (nter the num"er of processes) &); scanf(&*d&,+n); printf(&'n'n (nter the ,-.( , /0123 34.( and -1145-6 34.( of the process&); for(i$ ;i<n;i77) { printf(&'n'n ,-.( ) &); scanf(&*s&,+pname[i!); printf(&'n'n /0123 34.( ) &); scanf(&*d&,+"t[i!); printf(&'n'n -1145-6 34.( ) &); scanf(&*d&,+at[i!); 8 for(i$ ;i<n;i77) for(%$i71;%<n;%77) { if(at[i!>at[%!) { t$at[i!; at[i!$at[%!; at[%!$t; #$"t[i!; "t[i!$"t[%!; "t[%!$#; strcp9(c[i!,pname[i!); strcp9(pname[i!,pname[%!);

strcp9(pname[%!,c[i!); 8 8 wt[ !$ ; for(i$ ;i<n;i77) { wt[i71!$wt[i!7"t[i!; sum$sum7(wt[i!:at[i!); s"t$s"t7(wt[i71!:at[i!); tt[i!$wt[i!7"t[i!; ss$ss7"t[i!; 8 avgwt$(float) sum;n; avgtt$(float)s"t;n; printf(&'n'n -verage waiting time $ *f&,avgwt); printf(&'n'n -verage turn:around time $ *f&,avgtt); printf(&'n'n <-,33 =>-13'n&); for(i$ ;i<n;i77) printf(&?'t*s't&,pname[i!); printf(&'n&); for(i$ ;i<n;i77) printf(&*d't't&,wt[i!); printf(&*d'n&,ss); printf(&'n&); 8

OUTPUT: [root@localhost A!# .;a.out (nter the num"er of processes) B (nter the ,-.( , /0123 34.( and -1145-6 34.( of the process ,-.( ) p1 /0123 34.( ) B -1145-6 34.( ) ,-.( ) pC /0123 34.( ) D -1145-6 34.( ) C ,-.( ) pE /0123 34.( ) F -1145-6 34.( ) B ,-.( ) pB /0123 34.( ) E -1145-6 34.( ) E -verage waiting time $ G. time $ 1C. <-,33 =>-13 ? p1 ? pC ? pB ? pE B 1E 1G CB -verage turn:around

//PROGRAM FOR SIMULATION OF SJF SCHEDULING ALGORITHM.// #include<stdio.h> main() { float avgwt,avgtt; char pname[1 ![1 !,c[1 ![1 !; int wt[1 !,tt[1 !,"t[1 !,at[1 !,t,#,i,n,sum$ ,s"t$ ,ttime,%,ss$ ; printf(&'n'n (nter the num"er of processes) &); scanf(&*d&,+n); printf(&'n'n (nter the ,-.(, /012334.(, and -1145-634.( of the processes &); for(i$ ;i<n;i77) { printf(&'n'n ,-.( ) &); scanf(&*s&,+pname[i!); printf(&'n'n /0123 34.( ) &); scanf(&*d&,+"t[i!); printf(&'n'n -1145-6 34.( ) &); scanf(&*d&,+at[i!); 8 for(i$ ;i<n;i77) for(%$i71;%<n;%77) { if(at[i!$$at[%!) if("t[i!>"t[%!) { t$at[i!; at[i!$at[%!; at[%!$t; #$"t[i!; "t[i!$"t[%!; "t[%!$#; strcp9(c[i!,pname[i!); strcp9(pname[i!,pname[%!);

strcp9(pname[%!,c[i!); 8 if(at[i!H$at[%!) if("t[i!>"t[%!) { t$at[i!; at[i!$at[%!; at[%!$t; #$"t[i!; "t[i!$"t[%!; "t[%!$#; strcp9(c[i!,pname[i!); strcp9(pname[i!,pname[%!); strcp9(pname[%!,c[i!); 8 8 wt[ !$ ; for(i$ ;i<n;i77) { wt[i71!$wt[i!7"t[i!; sum$sum7(wt[i!:at[i!); s"t$s"t7(wt[i71!:at[i!); tt[i!$wt[i! 7"t[i!; ss$ss7"t[i!; 8 printf(&'n'n <-,33 =>-13&); printf(&'n'n :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 'n&); for(i$ ;i<n;i77) printf(&?'t *s't&,pname[i!); printf(&'n:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::'n&); for(i$ ;i<n;i77) printf(&*d't't&,wt[i!); printf(&*d'n&,ss);

printf(&'n::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::&); printf(&'n'n 3otal I-434,< 34.( $ *d &,sum); printf(&'n'n 3otal 301,-1J0,K 34.( $ *d &,s"t); avgwt$(float)sum;n; avgtt$(float)s"t;n; printf(&'n'n -verage I-434,< 34.( $ *f &,avgwt); printf(&'n'n -verage 301,-1J0,K 34.( $ *f &,avgtt); 8 OUTPUT: (nter the num"er of processes) L (nter the ,-.(, /012334.(, and -1145-634.( of the processes ,-.( ) p /0123 34.( ) C -1145-6 34.( ) ,-.( ) p1 /0123 34.( ) B -1145-6 34.( ) ,-.( ) pC /0123 34.( ) L -1145-6 34.( ) ,-.( ) pE /0123 34.( ) G -1145-6 34.( ) ,-.( ) pB /0123 34.( ) F -1145-6 34.( ) <-,33 =>-13 ? p ? p1 ? pC ? pE ? pB C G 11 1M CL 3otal I-434,< 34.( $ EG 3otal 301,-1J0,K 34.( $ G1 -verage I-434,< 34.( $ M.C

//PROGRAM FOR SIMULATION OF RR SCHEDULING ALGORITHM// #include<stdio.h> main() { int pt[1 ![1 !,a[1 ![1 !,at[1 !,pname[1 ![1 !,i,%,n,N$ ,#,sum$ ; float avg; printf(&'n'n (nter the num"er of processes ) &); scanf(&*d&,+n); for(i$ ;i<1 ;i77) { for(%$ ;%<1 ;%77) { pt[i![%!$ ; a[i![%!$ ; 8 8 for(i$ ;i<n;i77) { %$ ; printf(&'n'n (nter the process time for process *d ) &,i71); scanf(&*d&,+pt[i![%!); 8 printf(&'n'n (nter the time slice ) &); scanf(&*d&,+#); printf(&'n'n&); for(%$ ;%<1 ;%77) { for(i$ ;i<n;i77) { a[CO%![i!$N; if((pt[i! [%!<$#)++(pt[i![%!H$ )) {

pt[i![%71!$ ; printf(& *d P*d *d'n&,N,i71,N7pt[i![%!); N7$pt[i![%!; a[CO%71![i!$N; 8 else if(pt[i![%!H$ ) { pt[i![%71!$pt[i![%!:#; printf(& *d P*d *d'n&,N,i71,(N7#)); N7$#; a[CO%71! [i!$N; 8 else { a[CO%![i!$ ; a[CO%71![i!$ ; 8 8 8 for(i$ ;i<n;i77) sum7$a[ ![i!; for(i$ ;i<n;i77) { for(%$1;%<1 ;%77) { if((a[%![i!H

$ )++(a[%71![i!H$ )++((%71)*C$$ )) sum7$((a[%71![i!:a[%![i!)); 8 8 avg$(float)sum;n; printf(&'n'n -verage waiting time $ *f msec&,avg); sum$avg$ ; for(%$ ;%<n;%77)

{ i$1; while(a[i![%!H$ ) i7$1; sum7$a[i:1![%!; 8 avg$(float)sum;n; printf(&'n'n -verage turnaround time $ *f msec'n'n&,avg); 8

OUTPUT: [root@localhost A!# .;a.out (nter the num"er of processes ) B (nter the process time for process 1 ) F (nter the process time for process C ) E (nter the process time for process E ) G (nter the process time for process B ) 1 (nter the time slice ) C P1 C C PC B B PE G G PB M M P1 D D PC 1 1 PE 1C 1C P1 1B 1B PE 1G 1G P1 1F

-verage waiting time $ F.CL

msec -verage turnaround time $ 1C.ML

msec

//PROGRAM FOR SIMULATION OF PRIORITY SCHEDULING ALGORITHM// #include<stdio.h> main() { float avgwt,avgtt; char pname[1 ![1 !,c[1 ![1 !; int wt[1 !,tt[1 !,"t[1 !,pt[1 !,t,#,i,n,sum$ ,s"t$ ,ttime,%,ss$1 ; printf(&'n'n (nter the num"er of processes ) &); scanf(&*d&,+n); printf(&'n'n (nter the ,-.( and /012334.( &); for(i$ ;i<n;i77) { printf(&'n'n ,-.( ) &); scanf(&*s&,+pname[i!); printf(&'n'n /012334.( ) &); scanf(&*d&,+"t[i!); 8 printf(&'n'n (nter the priorities of the processes &); for(i$ ;i<n;i77) { printf(&'n'n Priorit9 of process*d ) &,i71); scanf(&*d&,+pt[i!); 8 for(i$ ;i<n;i77) for(%$i71;%<n;%77) { if(pt[i!>pt[%!) { t$pt[i!; pt[i!$pt[%!; pt[%!$t; #$"t[i!;

"t[i!$"t[%!; "t[%!$#; strcp9(c[i!,pname[i!); strcp9(pname[i!,pname[%!); strcp9(pname[%!,c[i!); 8 8 wt[ !$ ; for(i$ ;i<n;i77) { wt[i71!$wt[i!7"t[i!; sum$sum7wt[i!; s"t$s"t7wt[i71!; tt[i!$wt[i!7"t[i!; ss$ss7"t[i!; 8 printf(&'n'n <-,33 =>-13&); printf(&'n:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::'n&); for(i$ ;i<n;i77) printf(&?'t*s't&,pname[i!); printf(&'n:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::'n&); for(i$ ;i<n;i77) printf(&*d't't&,wt[i!); printf(&*d'n&,ss); printf(&'n:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::'n&); printf(&'n'n 3otal I-434,< 34.( of the process $ *d&,sum); printf(&'n'n 3otal 301,-1J0,K 34.( of the process $ *d&,s"t); avgwt$(float)sum;n; avgtt$(float)s"t;n; printf(&'n'n -verage I-434,< 34.( of the process $ *f&,avgwt); printf(&'n'n -verage 301,-1J0,K 34.( of the process $ *f&,avgtt); 8

OUTPUT: [root@localhost A!# .;a.out (nter the num"er of processes ) B (nter the ,-.( and /012334.( ,-.( ) p1 /012334.( ) F ,-.( ) pC /012334.( ) E ,-.( ) pE /012334.( ) G ,-.( ) pB /012334.( ) 1 (nter the priorities of the processes Priorit9 of process1 ) 1 Priorit9 of processC ) L Priorit9 of processE ) C Priorit9 of processB ) B <-,33 =>-13 ? p1 ? pE ? pB ? pC F 1B 1L CF 3otal I-434,< 34.( of the process $ EM 3otal 301,-1J0,K 34.( of the process $ LL -verage I-434,< 34.( of the process $ D.CL -verage 301,-1J0,K 34.( of the process $ 1E.ML

//PROGRAM FOR INTER-PROCESS COMMUNICATION USING PIPES// #include<stdio.h> #include<unistd.h> #include<s9s;ipc.h> #include<s9s;uio.h> #include<s9s;t9pes.h> main() { int pid,pfd[C!,n,a,",c; if(pipe(pfd)$$:1) { printf(&'n(rror in pipe connection'n&); eQit(1); 8 pid$forN(); if(pid> ) { printf(&'nParent Process&);' printf(&'n'n'tRi"onacci 2eries&); printf(&'n(nter the limit for the series)&); scanf(&*d&,+n); close(pfd[ !); write(pfd[1!,+n,siSeof(n)); close(pfd[1!); eQit( ); 8 else { close(pfd[1!); read(pfd[ !,+n,siSeof(n)); printf(&'n=hild Process&); a$ ;

"$1; close(pfd[ !); printf(&'nRi"onacci 2eries is)&); printf(&'n'n*d'n*d&,a,"); while(n>C) { c$a7"; printf(&'n*d&,c); a$"; "$c; n::; 8 88

OUTPUT: [root@localhost A!# .;a.out Parent Process the series)L =hild Process Ri"onacci 2eries is) 11CE Ri"onacci 2eries (nter the limit for

//.PROGRAM FOR PRODUCER CONSUMER PROBLEM .// #include<stdio.h> int muteQ$1,full$ ,empt9$E,Q$ ; main() { int n; void producer(); void consumer(); int wait(int); int signal(int); printf(&'n1.P1JK0=(1'nC.=J,20.(1'nE.(T43'n&); while(1) { printf(&'n(,3(1 UJ01 =>J4=('n&); scanf(&*d&,+n); switch(n) { case 1) if((muteQ$$1)++(empt9H$ )) producer(); else printf(&/0RR(1 42 R066&); "reaN; case C) if((muteQ$$1)++(fullH$ )) consumer(); else printf(&/0RR(1 42 (.P3U&); "reaN; case E) eQit( ); "reaN;

8 8 8 int wait(int s) { return(::s); 8 int signal(int s) { return(77s); 8 void producer() { muteQ$wait(muteQ); full$signal(full); empt9$wait(empt9); Q77; printf(&'nproducer produces the item*d&,Q); muteQ$signal(muteQ); 8 void consumer() { muteQ$wait(muteQ); full$wait(full); empt9$signal(empt9); printf(&'n consumer consumes item*d&,Q); Q::; muteQ$signal(muteQ); 8

OUTPUT: [root@localhost A!# .;a.out 1.P1JK0=(1 C.=J,20.(1 E.(T43

(,3(1 UJ01 =>J4=( 1 producer produces the item1 (,3(1 UJ01 =>J4=( 1 producer produces the itemC (,3(1 UJ01 =>J4=( C consumer consumes itemC (,3(1 UJ01 =>J4=( C consumer consumes item1 (,3(1 UJ01 =>J4=( C /0RR(1 42 (.P3U (,3(1 UJ01 =>J4=( E

//PROGRAM FOR DIRECTORIES MANAGEMENTS// #include<s9s;t9pes.h> #include<dirent.h> #include<stdio.h> main(int c,charO arg[!) { K41 Od; struct dirent Or; int i$ ; d$opendir(arg[1!); printf(&'n't ,-.( JR 43(. 'n&); while((r$readdir(d)) H$ ,066) { printf(&'t *s 'n&,r:>dVname); i$i71; 8 printf(&'n 3J3-6 ,0./(1 JR 43(. 4, 3>-3 K41(=3J1U 42 *d 'n&,i); 8

OUTPUT: [root@localhost A!# cc dr.c [root@localhost A!# .;a.out la"Vprint ,-.( JR 43(. rrVoutput.doc . .. priVoutput.doc s%fVoutput.doc fcfsVoutput.doc

ipcVpipeVoutput.doc

proVconVpro"Voutput.doc

3J3-6 ,0./(1 JR 43(. 4, 3>-3 K41(=3J1U 42 F

//PROGRAM FOR I/O SYSTEM CALLS// #include<stdio. h> #include<s9s;st at.h> #include<time. h> main(int ag,charOarg[!) { char "uf[1 !; struct stat s; int fd1,fdC,n; fd1$open(arg[1!, ); fdC$creat(arg[C!, MMM); stat(arg[C!,+s); if(fdC$$:1) printf(&(11J1 4, =1(-34J,&); while((n$read(fd1,"uf,siSeof("uf)))> ) { if(write(fdC,"uf,n)H$n) { close(fd1); close(fdC); 8 8 printf(&'t'n 04K RJ1 R46(.......>*d 'n R46( -==(22 34.(.....>*s 'n R46( .JK4R4(K 34.(........>*s 'n R46( 4:,JK( ,0./(1......>*d 'n P(1.4224J, RJ1 R46(.....> *o'n'n&,s.stVuid,ctime(+s.stVatime),ctime(+s.stVmtime),s.stVmode); close(fd1); close(fdC); 8

OUTPUT: [root@localhost A!# cc ios9s.c [root@localhost A!# .;a.out 04K RJ1 R46(.......> R46( -==(22 34.(.....>3hu -pr F 1)CE)LB C 1 R46( .JK4R4(K 34.(........>3hu -pr F 1)CE)LB C 1 R46( 4:,JK( ,0./(1......>EECG1 P(1.4224J, RJ1 R46(.....>1 11 1 1B

//PROGRAM FOR UNIX COMMAND SIMULATION (GREP)// #include<stdio.h> #include<string.h> main(int ag,charO arg[!) { char "uf[C !,line[C !; int i,%,n,fd1,count$ ,opt; if(ag$$B) { fd1$open(arg[E!, ); if(strcmp(arg[1!,&:c&)$$ ) opt$C; if(strcmp(arg[1!,&:i&)$$ ) opt$E; 8 else if(ag$$E) { fd1$open(arg[C!, ); opt$1; 8 if(fd1$$:1) printf(&error in opening&); %$ ; switch(opt) { case 1) while((n$read(fd1,"uf,siSeof(line)))> ) { for(i$ ;i<n;i77,%77) { if("uf[i!H$W'nW) line[%!$"uf[i!; else { line[%!$W'nW; if(strstr(line,arg[1!)H$ )

write(1,line,%71); 8 8 8 "reaN; case C) while((n$read(fd1,"uf,siSeof(line)) )> ) { for(i$ ;i<n;i77,%77) { if("uf[i!H$W'nW) line[%!$"uf[i!; else { line[%!$W'nW; if(strstr(line,arg[C!)H $ ) count$count71; %$:1; 8 8 8 printf(&*d 'n&,count); "reaN; case E) while((n$read(fd1,"uf,siSeof(line)))> ) { for(i$ ;i<n;i77,%77) { if("uf[i!H$W'nW) line[%!$"uf[i!; else { line[%!$W'nW; if(strcasestr(line,arg[C!)H$ )

write(1,line,%71); %$:1; 8 8 8 "reaN; 8 close(fd1); 8

OUTPUT: [root@localhost A!# cat tst sd d s a - 2 K [root@localhost A!# .;a.out :i a tst a - [root@localhost A!# .;a.out :c a tst 1 [root@localhost A!# .;a.out :c - tst 1 [root@localhost A!# .;a.out :c sd tst 1 [root@localhost A!# .;a.out :c s tst C

//PROGRAM FOR PROCESS MANAGEMENTS// #include<stdio.h> main(int arc,charOar[!) { int pid; char s[1 !; pid$forN(); if(pid< ) printf(&error&); else if(pid> ) { wait(,066); printf(&'n Parent Process)'n&); printf(&'n'tParent Process id) *d't'n&,getpid()); eQeclp(&cat&,&cat&,ar[1!,(charO) ); error(&canXt eQecute cat *s,&,ar[1!); 8 else { printf(&'n=hild process)&); printf(&'n't=hildprocess parent id)'t *d&,getppid()); sprintf(s,&'n't=hild process id )'t*d&,getpid()); write(1,s,strlen(s)); printf(& &); printf(& &); printf(& &); eQecvp(ar[C!,+ar[C!); error(&canXt eQecute *s&,ar[C!); 88

OUTPUT: [root@localhost A!# .;a.out tst date =hild process) =hild process id ) Parent Process) Parent Process id)E1EG sd d s a 2 K E1EM 2at -pr 1 C)BL)EC 423 C 1

[root@localhost A!# cat tst sd d s a - 2 K

//PROGRAM FOR FIRST FIT...// #include<conio.h> #include<stdio.h> #include<stdli".h> #include<time.h> struct allocate { int pid; int stVadd; int endVadd; struct allocate OneQt; 8; struct freeVlist { int stVadd; int endVadd; struct freeVlist OneQt; 8; struct process { int pid; int siSe; 8; struct process pro[1 !; struct freeVlist Oflist$,066; struct allocate Oalot$,066; void displa9Valot(struct allocate OtempVa) { printf(&'n'n allocated list)&);

printf(&'n$$$$$$$$$$$$$$$$&); while(tempVaH$,066) { printf(&'n process)*d stVadd) *d endVadd)*d &,tempVa:>pid,tempVa:>stVadd,tempVa>endVadd); tempVa$tempVa: >neQt; 8 8 void displa9Vfree(struct freeVlist OtempVf) { printf(&'n'n free list)&); printf(&'n$$$$$$$$$$$$$$$$$&); while(tempVfH$,066) { printf(&'n stVadd)*d endVadd)*d&,tempVf:>stVadd,tempVf:>endVadd); tempVf$tempVf:>neQt; 8 8 void insert(int p) { struct freeVlist OtempVf; struct allocate OtempVa,OpreVa; int i,n; do { srand((unsigned int)time((timeVtO),066)); n$rand()*L; 8while(n$$ ); printf(&'n'n no. of process)*d&,n); for(i$ ;i<n;i77) {

pro[i!.pid$i7p; do { pro[i!.siSe$rand()*E

; 8while(pro[i!.siSe$$ ); 8 for(i$ ;i<n;i77)

{ printf(&'n'n process to "e inserted)*d siSe)*d&,pro[i!.pid,pro[i!.siSe); tempVf$flist; tempVa$alot; while(tempVfH$,066 ++ tempVf:>endVadd:tempVf:>stVadd < pro[i!.siSe) { tempVf$tempVf:>neQt; 8 if(tempVfH$,066) { preVa$(struct allocateO)malloc(siSeof(struct allocate)); preVa:>stVadd$tempVf:>stVadd; preVa: >endVadd$tempVf:>stVadd$tempVf:>stVadd7pro[i!.siSe; preVa:>pid$pro[i!.pid; if(tempVa$$,066) { alot$preVa; preVa:>neQt$,066; 8 else { while(tempVa:>neQtH $,066) { tempVa$tempVa:>neQt; 8 tempVa:>neQt$preVa;

preVa:>neQt$,066; 8 8 else printf(&'n there is not enough space&); displa9Valot(alot); displa9Vfree(flist); getch(); 8 8 void main() { int no,n,i,nod,ndpid; struct process pro[1 !; struct freeVlist OtempVf,OfreeValot,OpreVf; struct allocate OtempVa,OpreVa; clrscr(); alot$,066; flist$(struct freeVlistO)malloc(siSeof(struct freeVlist)); flist:>stVadd$ ; flist: >endVadd$1 CB; flist:>neQt$,066; insert( ); do { srand((unsigned int)time((timeVtO),066)); nod$rand()*C; 8while(nod$$ ); printf(&'n'n no.of process deletion)*d&,nod); for(i$ ;i<nod;i77) { printf(&'n'n'n process to "e deleted)&);

scanf(&*d&,+ndpid); tempVa$alot; tempVf$flist; while(tempVaH$,066 ++ tempVa:>pidH $ndpid) { preVa$tempVa; tempVa$tempVa:>neQt; 8 if(tempVaH$,066) { if(alot$$tempVa) alot$tempVa:>neQt; else preVa:>neQt$tempVa:>neQt; preVf$,066; while(tempVfH$,066 ++ tempVf:>stVadd < tempVa:>stVadd) { preVf$tempVf; tempVf$tempVf:>neQt; 8 if(preVfH $,066 ++ preVf:>endVadd$$tempVa:>stVadd) preVf:>endVadd$tempVa:>endVadd; else if(preVfH$,066++tempVfH$,066++tempVf:>stVadd$$tempVa:>endVadd) tempVf: >stVadd$tempVa:>stVadd; else { freeValot$(struct freeVlistO)malloc(siSeof(struct freeVlist)); freeValot:>stVadd$tempVa:>stVadd; freeValot:>endVadd$tempVa:>endVadd; if(preVfH $,066) preVf:>neQt$freeValot; freeValot:>neQt$tempVf; if(flist$$tempVf)

{ flist$freeValot; 8 8 free(tempVa); 8 else printf(&'n process not in memor9&); tempVf$flist; while(tempVfH$,066) { if(tempVf:>endVadd$$tempVf:>neQt:>stVadd) { tempVf: >endVadd$tempVf:>neQt:>endVadd; tempVf:>neQt$tempVf:>neQt:>neQt; 8 tempVf$tempVf: >neQt; 8 displa9Valot(alot); displa9Vfree(flist); getch(); 8 insert(1 ); 8

OUTPUT: no. of process)E process to "e inserted) siSe)1C allocated list) $$$$$$$$$$$$$$$$ process) stVadd) endVadd)1C free list) $$$$$$$$$$$$$$$$$ stVadd)1C endVadd)1 CB process to "e inserted)1 siSe)1FL allocated list) $$$$$$$$$$$$$$$$ process) stVadd) endVadd)1C process)1 stVadd)1C endVadd)E L free list) $$$$$$$$$$$$$$$$$ stVadd)E L endVadd)1 CB process to "e inserted)C siSe)CBG allocated list) $$$$$$$$$$$$$$$$ process) stVadd) endVadd)1C process)1 stVadd)1C endVadd)E L process)C stVadd)E L endVadd)LL1 free list) $$$$$$$$$$$$$$$$$ stVadd)LL1 endVadd)1 CB no.of process deletion)1 process to "e deleted) allocated list) $$$$$$$$$$$$$$$$ process)1 stVadd)1C endVadd)E L process)C stVadd)E L endVadd)LL1 free list) $$$$$$$$$$$$$$$$$ stVadd) endVadd)1C stVadd)LL1 endVadd)1 CB

no. of process)E process to "e inserted)1 siSe)1DL allocated list) $$$$$$$$$$$$$$$$ process)1 stVadd)1C endVadd)E L process)C stVadd)E L endVadd)LL1 process)1 stVadd)LL1 endVadd)MBG free list) $$$$$$$$$$$$$$$$$ stVadd) endVadd)1C stVadd)MBG endVadd)1 CB process to "e inserted)11 siSe)DG allocated list) $$$$$$$$$$$$$$$$ process)1 stVadd)1C endVadd)E L process)C stVadd)E L endVadd)LL1 process)1 stVadd)LL1 endVadd)MBG process)11 stVadd) endVadd)DG free list) $$$$$$$$$$$$$$$$$ stVadd)DG endVadd)1C stVadd)MBG endVadd)1 CB process to "e inserted)1C siSe)1BF allocated list) $$$$$$$$$$$$$$$$ process)1 stVadd)1C endVadd)E L process)C stVadd)E L endVadd)LL1 process)1 stVadd)LL1 endVadd)MBG process)11 stVadd) endVadd)DG process)1C stVadd)MBG endVadd)FDB free list) $$$$$$$$$$$$$$$$$ stVadd)DG endVadd)1C stVadd)FDB endVadd)1 CB

//PROGRAM FOR BEST FIT...// #include<conio.h> #include<stdio.h> #include<stdli".h> #include<time.h> struct allocate { int pid; int stVadd; int endVadd; struct allocate OneQt; 8; struct freeVlist { int stVadd; int endVadd; struct freeVlist OneQt; 8; struct process { int pid; int siSe; 8; struct process pro[1 !; struct freeVlist Oflist$,066; struct allocate Oalot$,066;

void displa9Valot(struct allocate OtempVa) {

printf(&'n'n allocated list)&); printf(&'n$$$$$$$$$$$$$$$$&); while(tempVaH$,066) { printf(&'n process)*d stVadd)*d endVadd)*d &,tempVa:>pid,tempVa:>stVadd,tempVa: >endVadd); tempVa$tempVa:>neQt; 8 8 void displa9Vfree(struct freeVlist OtempVf) { printf(&'n'n free list)&); printf(&'n$$$$$$$$$$$$$$$$$&); while(tempVfH$,066) { printf(&'n stVadd)*d endVadd)*d&,tempVf:>stVadd,tempVf:>endVadd); tempVf$tempVf:>neQt; 8 8 void insert(int p) { struct freeVlist OtempVf; struct allocate OtempVa,OpreVa; int i,n; do { srand((unsigned int)time((timeVtO),066)); n$rand()*1 ; 8while(n$$ ); printf(&'n'n no. of process)*d&,n);

for(i$ ;i<n;i77) { pro[i!.pid$i7p; do { pro[i!.siSe$rand()*LL ; 8while(pro[i!.siSe$$ ); 8 for(i$ ;i<n;i77) { printf(&'n'n process to "e inserted)*d siSe)*d&,pro[i!.pid,pro[i!.siSe); tempVf$flist; tempVa$alot; while(tempVfH$,066 ++ tempVf:>endVadd:tempVf:>stVadd < pro[i!.siSe) { tempVf$tempVf:>neQt; 8 if(tempVfH$,066) { preVa$(struct allocateO)malloc(siSeof(struct allocate)); preVa:>stVadd$tempVf:>stVadd; preVa: >endVadd$tempVf:>stVadd$tempVf:>stVadd7pro[i!.siSe; preVa:>pid$pro[i!.pid; if(tempVa$$,066) { alot$preVa; preVa:>neQt$,066; 8 else { while(tempVa:>neQtH $,066) { tempVa$tempVa:>neQt;

8 tempVa:>neQt$preVa; preVa:>neQt$,066; 8 8 else printf(&'n there is not enough space&); displa9Valot(alot); displa9Vfree(flist); getch(); 8 8 void "estfit(int p) { struct freeVlist OtempVf,OenoughVhole; struct allocate OtempVa,OpreVa; int i,n,remVspace; do { srand((unsigned int)time((timeVtO),066)); n$rand()*1 ; 8 while(n$$ ); printf(&'n no of processes)*d&,n); for(i$ ;i<n;i77) { pro[i!.pid$i7p; do { pro[i!.siSe$rand()*C ; 8 while(pro[i!.siSe$$ ); 8

for(i$ ;i<n;i77) { printf(&'n process to "e inserted)*d siSe)*d&,pro[i!.pid,pro[i!.siSe); tempVf$flist; tempVa$alot; enoughVhole$,066; remVspace$1 CB; while(tempVfH$,066) { if(tempVf:>endVadd : tempVf:>stVadd >$ pro[i!.siSe) { if(tempVf:>endVadd : tempVf: >stVadd : pro[i!.siSe<remVspace) { remVspace$tempVf:>endVadd : tempVf:>stVadd : pro[i!.siSe; enoughVhole$tempVf; 8 8 tempVf$tempVf:>neQt; 8 if(enoughVholeH$,066) { preVa$(struct allocateO)malloc(siSeof(struct allocate)); preVa:>stVadd$enoughVhole: >stVadd; preVa:>endVadd$enoughVhole:>stVadd$enoughVhole:>stVadd 7 pro[i!.siSe; preVa: >pid$pro[i!.pid; if(tempVa$$,066) { alot$preVa; preVa:>neQt$,066; 8 else { while(tempVa:>neQtH$,066)

{ tempVa$tempVa:>neQt; 8 tempVa:>neQt$preVa; preVa:>neQt$,066; 8 8 else printf(&'n there is not enough space&); displa9Valot(alot); displa9Vfree(flist); getch(); 8 8 void main() { int no,n,i,nod,ndpid; struct process pro[1 !; struct freeVlist OtempVf,OfreeValot,OpreVf; struct allocate OtempVa,OpreVa; clrscr(); alot$,066; flist$(struct freeVlistO)malloc(siSeof(struct freeVlist)); flist:>stVadd$ ; flist: >endVadd$1 CB; flist:>neQt$,066; insert( ); do { srand((unsigned int)time((timeVtO),066)); nod$rand()*L; 8while(nod$$ );

printf(&'n'n no.of process deletion)*d&,nod); for(i$ ;i<nod;i77) { printf(&'n'n'n process to "e deleted)&); scanf(&*d&,+ndpid); tempVa$alot; tempVf$flist; while(tempVaH$,066 ++ tempVa:>pidH$ndpid) { preVa$tempVa; tempVa$tempVa:>neQt; 8 if(tempVaH$,066) { if(alot$$tempVa) alot$tempVa:>neQt; else preVa:>neQt$tempVa:>neQt; preVf$,066; while(tempVfH$,066 ++ tempVf:>stVadd < tempVa:>stVadd) { preVf$tempVf; tempVf$tempVf:>neQt; 8 if(preVfH$,066 ++ preVf:>endVadd$$tempVa:>stVadd) preVf: >endVadd$tempVa:>endVadd; else if(preVfH$,066++tempVfH$,066++tempVf: >stVadd$$tempVa:>endVadd) tempVf:>stVadd$tempVa:>stVadd; else { freeValot$(struct freeVlistO)malloc(siSeof(struct freeVlist)); freeValot:>stVadd$tempVa:>stVadd; freeValot: >endVadd$tempVa:>endVadd;

if(preVfH$,066) preVf:>neQt$freeValot; freeValot:>neQt$tempVf; if(flist$$tempVf) { flist$freeValot; 8 8 free(tempVa); 8 else printf(&'n process not in memor9&); tempVf$flist; while(tempVfH$,066) { if(tempVf:>endVadd$$tempVf:>neQt:>stVadd) { tempVf: >endVadd$tempVf:>neQt:>endVadd; tempVf:>neQt$tempVf:>neQt:>neQt; 8 tempVf$tempVf: >neQt; 8 displa9Valot(alot); displa9Vfree(flist); getch(); 8 "estfit(1 ); 8

OUTPUT: no. of process)M process to "e inserted) siSe)EL1 allocated list) $$$$$$$$$$$$$$$$ process) stVadd) endVadd)EL1 free list) $$$$$$$$$$$$$$$$$ stVadd)EL1 endVadd)1 CB process to "e inserted)1 siSe)BGG allocated list) $$$$$$$$$$$$$$$$ process) stVadd) endVadd)EL1 process)1 stVadd)EL1 endVadd)F1M free list) $$$$$$$$$$$$$$$$$ stVadd)F1M endVadd)1 CB process to "e inserted)C siSe)EEM there is not enough space allocated list) $$$$$$$$$$$$$$$$ process) stVadd) endVadd)EL1 process)1 stVadd)EL1 endVadd)F1M free list) $$$$$$$$$$$$$$$$$ stVadd)F1M endVadd)1 CB process to "e inserted)E siSe)B1 there is not enough space allocated list) $$$$$$$$$$$$$$$$ process) stVadd) endVadd)EL1 process)1 stVadd)EL1 endVadd)F1M free list) $$$$$$$$$$$$$$$$$ stVadd)F1M endVadd)1 CB process to "e inserted)B siSe)LBC there is not enough space

allocated list) $$$$$$$$$$$$$$$$ process) stVadd) endVadd)EL1 process)1 stVadd)EL1 endVadd)F1M free list) $$$$$$$$$$$$$$$$$ stVadd)F1M endVadd)1 CB process to "e inserted)L siSe)LBM there is not enough space allocated list) $$$$$$$$$$$$$$$$ process) stVadd) endVadd)EL1 process)1 stVadd)EL1 endVadd)F1M free list) $$$$$$$$$$$$$$$$$ stVadd)F1M endVadd)1 CB process to "e inserted)G siSe)FD allocated list) $$$$$$$$$$$$$$$$ process) stVadd) endVadd)EL1 process)1 stVadd)EL1 endVadd)F1M process)G stVadd)F1M endVadd)D G free list) $$$$$$$$$$$$$$$$$ stVadd)D G endVadd)1 CB no.of process deletion)B process to "e deleted) allocated list) $$$$$$$$$$$$$$$$ process)1 stVadd)EL1 endVadd)F1M process)G stVadd)F1M endVadd)D G free list) $$$$$$$$$$$$$$$$$ stVadd) endVadd)EL1 stVadd)D G endVadd)1 CB

process to "e deleted)C process not in memor9 allocated list) $$$$$$$$$$$$$$$$ process)1 stVadd)EL1 endVadd)F1M process)G stVadd)F1M endVadd)D G free list) $$$$$$$$$$$$$$$$$ stVadd) endVadd)EL1 stVadd)D G endVadd)1 CB process to "e deleted)E process not in memor9 allocated list) $$$$$$$$$$$$$$$$ process)1 stVadd)EL1 endVadd)F1M process)G stVadd)F1M endVadd)D G free list) $$$$$$$$$$$$$$$$$ stVadd) endVadd)EL1 stVadd)D G endVadd)1 CB process to "e deleted)B process not in memor9 allocated list) $$$$$$$$$$$$$$$$ process)1 stVadd)EL1 endVadd)F1M process)G stVadd)F1M endVadd)D G free list) $$$$$$$$$$$$$$$$$ stVadd) endVadd)EL1 stVadd)D G endVadd)1 CB no of processes)D process to "e inserted)1 siSe)1LL allocated list) $$$$$$$$$$$$$$$$ process)1 stVadd)EL1 endVadd)F1M process)G stVadd)F1M endVadd)D G process)1 stVadd) endVadd)1LL free list)

$$$$$$$$$$$$$$$$$ stVadd)1LL endVadd)EL1 stVadd)D G endVadd)1 CB process to "e inserted)11 siSe)BE allocated list) $$$$$$$$$$$$$$$$ process)1 stVadd)EL1 endVadd)F1M process)G stVadd)F1M endVadd)D G process)1 stVadd) endVadd)1LL process)11 stVadd)D G endVadd)DBD free list) $$$$$$$$$$$$$$$$$ stVadd)1LL endVadd)EL1 stVadd)DBD endVadd)1 CB process to "e inserted)1C siSe)1FF allocated list) $$$$$$$$$$$$$$$$ process)1 stVadd)EL1 endVadd)F1M process)G stVadd)F1M endVadd)D G process)1 stVadd) endVadd)1LL process)11 stVadd)D G endVadd)DBD process)1C stVadd)1LL endVadd)EBE free list) $$$$$$$$$$$$$$$$$ stVadd)EBE endVadd)EL1 stVadd)DBD endVadd)1 CB process to "e inserted)1E siSe)M allocated list) $$$$$$$$$$$$$$$$ process)1 stVadd)EL1 endVadd)F1M process)G stVadd)F1M endVadd)D G process)1 stVadd) endVadd)1LL process)11 stVadd)D G endVadd)DBD process)1C stVadd)1LL endVadd)EBE process)1E stVadd)EBE endVadd)EL free list)

$$$$$$$$$$$$$$$$$ stVadd)EL endVadd)EL1 stVadd)DBD endVadd)1 CB process to "e inserted)1B siSe)1G there is not enough space allocated list) $$$$$$$$$$$$$$$$ process)1 stVadd)EL1 endVadd)F1M process)G stVadd)F1M endVadd)D G process)1 stVadd) endVadd)1LL process)11 stVadd)D G endVadd)DBD process)1C stVadd)1LL endVadd)EBE process)1E stVadd)EBE endVadd)EL free list) $$$$$$$$$$$$$$$$$ stVadd)EL endVadd)EL1 stVadd)DBD endVadd)1 CB process to "e inserted)1L siSe)1 there is not enough space allocated list) $$$$$$$$$$$$$$$$ process)1 stVadd)EL1 endVadd)F1M process)G stVadd)F1M endVadd)D G process)1 stVadd) endVadd)1LL process)11 stVadd)D G endVadd)DBD process)1C stVadd)1LL endVadd)EBE process)1E stVadd)EBE endVadd)EL free list) $$$$$$$$$$$$$$$$$ stVadd)EL endVadd)EL1 stVadd)DBD endVadd)1 CB process to "e inserted)1G siSe)1DF there is not enough space allocated list) $$$$$$$$$$$$$$$$ process)1 stVadd)EL1 endVadd)F1M process)G stVadd)F1M endVadd)D G process)1 stVadd) endVadd)1LL process)11 stVadd)D G endVadd)DBD process)1C stVadd)1LL endVadd)EBE process)1E stVadd)EBE endVadd)EL free list)

$$$$$$$$$$$$$$$$$ stVadd)EL endVadd)EL1 stVadd)DBD endVadd)1 CB process to "e inserted)1M siSe)L1 allocated list) $$$$$$$$$$$$$$$$ process)1 stVadd)EL1 endVadd)F1M process)G stVadd)F1M endVadd)D G process)1 stVadd) endVadd)1LL process)11 stVadd)D G endVadd)DBD process)1C stVadd)1LL endVadd)EBE process)1E stVadd)EBE endVadd)EL process)1M stVadd)DBD endVadd)1 free list) $$$$$$$$$$$$$$$$$ stVadd)EL endVadd)EL1 stVadd)1 endVadd)1 CB process to "e inserted)1F siSe)BC there is not enough space allocated list) $$$$$$$$$$$$$$$$ process)1 stVadd)EL1 endVadd)F1M process)G stVadd)F1M endVadd)D G process)1 stVadd) endVadd)1LL process)11 stVadd)D G endVadd)DBD process)1C stVadd)1LL endVadd)EBE process)1E stVadd)EBE endVadd)EL process)1M stVadd)DBD endVadd)1 free list) $$$$$$$$$$$$$$$$$ stVadd)EL endVadd)EL1 stVadd)1 endVadd)1 CB

// PROGRAM

FOR WORST FIT...//

#include<conio.h> #include<stdio.h> #include<stdli".h> #include<time.h> struct allocate { int pid; int stVadd; int endVadd; struct allocate OneQt; 8; struct freeVlist { int stVadd; int endVadd; struct freeVlist OneQt; 8; struct process { int pid; int siSe; 8; struct process pro[1 !; struct freeVlist Oflist$,066; struct allocate Oalot$,066; void displa9Valot(struct allocate OtempVa) { printf(&'n'n allocated list)&); printf(&'n$$$$$$$$$$$$$$$$&); while(tempVaH$,066) { printf(&'n process)*d stVadd) *d endVadd)*d &,tempVa:>pid,tempVa:>stVadd,tempVa>endVadd); tempVa$tempVa: >neQt; 8 8 void displa9Vfree(struct freeVlist OtempVf) {

printf(&'n'n free list)&); printf(&'n$$$$$$$$$$$$$$$$$&); while(tempVfH$,066) { printf(&'n stVadd)*d endVadd)*d&,tempVf:>stVadd,tempVf:>endVadd); tempVf$tempVf: >neQt; 8 8 void insert(int p) { struct freeVlist OtempVf; struct allocate OtempVa,OpreVa; int i,n; do { srand((unsigned int)time((timeVtO),066)); n$rand()*1 ; 8while(n$$ ); printf(&'n'n no. of process)*d&,n); for(i$ ;i<n;i77) { pro[i!.pid$i7p; do { pro[i!.siSe$rand()*LL ; 8while(pro[i!.siSe$$ ); 8 for(i$ ;i<n;i77) { printf(&'n'n process to "e inserted)*d siSe)*d&,pro[i!.pid,pro[i!.siSe); tempVf$flist;

tempVa$alot; while(tempVfH$,066 ++ tempVf:>endVadd:tempVf:>stVadd < pro[i!.siSe) { tempVf$tempVf:>neQt; 8 if(tempVfH$,066) { preVa$(struct allocateO)malloc(siSeof(struct allocate)); preVa:>stVadd$tempVf:>stVadd; preVa: >endVadd$tempVf:>stVadd$tempVf:>stVadd7pro[i!.siSe; preVa:>pid$pro[i!.pid; if(tempVa$$,066) { alot$preVa; preVa:>neQt$,066; 8 else { while(tempVa:>neQtH $,066) { tempVa$tempVa:>neQt; 8 tempVa:>neQt$preVa; preVa:>neQt$,066; 8 8 else printf(&'n there is not enough space&); displa9Valot(alot); displa9Vfree(flist); getch(); 8 8

void worstfit(int p) { struct freeVlist OtempVf,O"igVhole; struct allocate OtempVa,OpreVa; int i,n; do { srand((unsigned int)time((timeVtO),066)); n$rand()*1 ; 8while(n$$ ); printf(&'n no.of process)*d&,n); for(i$ ;i<n;i77) { pro[i!.pid$i7p; do { pro[i!.siSe$rand()*CL ; 8 while(pro[i!.siSe$$ ); 8 for(i$ ;i<n;i77) { printf(&'n process to "e inserted) *d siSe ) *d&,pro[i!.pid,pro[i!.siSe); tempVf$flist; tempVa$alot; "igVhole$,066; while(tempVfH $,066) { if(tempVf:>endVadd:tempVf:>stVadd>$pro[i!.siSe) { if("igVhole$$,066) "igVhole$tempVf; else if(tempVf:>endVadd : tempVf:>stVadd > "igVhole:> endVadd : "igVhole:> stVadd)

"igVhole$tempVf; 8 tempVf$tempVf:>neQt; 8 if("igVholeH$ ,066) { preVa$(struct allocateO) malloc (siSeof(struct allocate)); preVa:>stVadd$"igVhole:>stVadd; preVa: >endVadd$"igVhole:>stVadd$"igVhole:>stVadd 7 pro[i!.siSe; preVa:>pid$pro[i!.pid; if(tempVa$$,066) { alot$preVa; preVa:>neQt$,066; 8 else { while(tempVa:>neQtH $,066) tempVa$tempVa:>neQt; tempVa:>neQt$ preVa; preVa:>neQt$,066; 8 8 else printf(&'n there is not enough space&); displa9Valot(alot); displa9Vfree(flist); getch(); 8 8 void main() {

int no,n,i,nod,ndpid; struct process pro[1 !; struct freeVlist OtempVf,OfreeValot,OpreVf; struct allocate OtempVa,OpreVa; clrscr(); alot$,066; flist$(struct freeVlistO)malloc(siSeof(struct freeVlist)); flist:>stVadd$ ; flist:>endVadd$1 CB; flist:>neQt$,066; insert( ); do { srand((unsigned int)time((timeVtO),066)); nod$rand()*L; 8while(nod$$ ); printf(&'n'n no.of process deletion)*d&,nod); for(i$ ;i<nod;i77) { printf(&'n'n'n process to "e deleted)&); scanf(&*d&,+ndpid); tempVa$alot; tempVf$flist; while(tempVaH$,066 ++ tempVa:>pidH$ndpid) { preVa$tempVa; tempVa$tempVa:>neQt; 8 if(tempVaH$,066) { if(alot$$tempVa) alot$tempVa:>neQt; else

preVa:>neQt$tempVa:>neQt; preVf$,066; while(tempVfH$,066 ++ tempVf:>stVadd < tempVa:>stVadd) { preVf$tempVf; tempVf$tempVf:>neQt; 8 if(preVfH$,066 ++ preVf: >endVadd$$tempVa:>stVadd) preVf:>endVadd$tempVa:>endVadd; else if(preVfH $,066++tempVfH$,066++tempVf:>stVadd$$tempVa:>endVadd) tempVf: >stVadd$tempVa:>stVadd; else { freeValot$(struct freeVlistO)malloc(siSeof(struct freeVlist)); freeValot:>stVadd$tempVa:>stVadd; freeValot:>endVadd$tempVa:>endVadd; if(preVfH $,066) preVf:>neQt$freeValot; freeValot:>neQt$tempVf; if(flist$$tempVf) { flist$freeValot; 8 8 free(tempVa); 8 else printf(&'n process not in memor9&); tempVf$flist; while(tempVfH$,066) { if(tempVf:>endVadd$$tempVf:>neQt:>stVadd) { tempVf: >endVadd$tempVf:>neQt:>endVadd;

tempVf:>neQt$tempVf:>neQt:>neQt; 8 tempVf$tempVf:>neQt; 8 displa9Valot(alot); displa9Vfree(flist); getch(); 8 worstfit(1 ); 8

OUTPUT: no. of process)D process to "e inserted) siSe)C1 allocated list) $$$$$$$$$$$$$$$$ process) stVadd) endVadd)C1 free list) $$$$$$$$$$$$$$$$$ stVadd)C1 endVadd)1 CB process to "e inserted)1 siSe)BGD allocated list) $$$$$$$$$$$$$$$$ process) stVadd) endVadd)C1 process)1 stVadd)C1 endVadd)BD free list) $$$$$$$$$$$$$$$$$ stVadd)BD endVadd)1 CB process to "e inserted)C siSe)E allocated list) $$$$$$$$$$$$$$$$ process) stVadd) endVadd)C1 process)1 stVadd)C1 endVadd)BD process)C stVadd)BD endVadd)LC free list) $$$$$$$$$$$$$$$$$ stVadd)LC endVadd)1 CB process to "e inserted)E siSe)MB allocated list) $$$$$$$$$$$$$$$$ process) stVadd) endVadd)C1 process)1 stVadd)C1 endVadd)BD process)C stVadd)BD endVadd)LC process)E stVadd)LC endVadd)LDB

free list) $$$$$$$$$$$$$$$$$ stVadd)LDB endVadd)1 CB process to "e inserted)B siSe)1FC allocated list) $$$$$$$$$$$$$$$$ process) stVadd) endVadd)C1 process)1 stVadd)C1 endVadd)BD process)C stVadd)BD endVadd)LC process)E stVadd)LC endVadd)LDB process)B stVadd)LDB endVadd)MMG free list) $$$$$$$$$$$$$$$$$ stVadd)MMG endVadd)1 CB process to "e inserted)L siSe)1 allocated list) $$$$$$$$$$$$$$$$ process) stVadd) endVadd)C1 process)1 stVadd)C1 endVadd)BD process)C stVadd)BD endVadd)LC process)E stVadd)LC endVadd)LDB process)B stVadd)LDB endVadd)MMG process)L stVadd)MMG endVadd)FMG free list) $$$$$$$$$$$$$$$$$ stVadd)FMG endVadd)1 CB process to "e inserted)G siSe)1FE there is not enough space allocated list) $$$$$$$$$$$$$$$$ process) stVadd) endVadd)C1 process)1 stVadd)C1 endVadd)BD process)C stVadd)BD endVadd)LC process)E stVadd)LC endVadd)LDB process)B stVadd)LDB endVadd)MMG process)L stVadd)MMG endVadd)FMG

free list)

$$$$$$$$$$$$$$$$$ stVadd)FMG endVadd)1 CB process to "e inserted)M siSe)B11 there is not enough space allocated list) $$$$$$$$$$$$$$$$ process) stVadd) endVadd)C1 process)1 stVadd)C1 endVadd)BD process)C stVadd)BD endVadd)LC process)E stVadd)LC endVadd)LDB process)B stVadd)LDB endVadd)MMG process)L stVadd)MMG endVadd)FMG free list) $$$$$$$$$$$$$$$$$ stVadd)FMG endVadd)1 CB process to "e inserted)F siSe)CDC there is not enough space allocated list) $$$$$$$$$$$$$$$$ process) stVadd) endVadd)C1 process)1 stVadd)C1 endVadd)BD process)C stVadd)BD endVadd)LC process)E stVadd)LC endVadd)LDB process)B stVadd)LDB endVadd)MMG process)L stVadd)MMG endVadd)FMG free list) $$$$$$$$$$$$$$$$$ stVadd)FMG endVadd)1 CB no.of process deletion)C process to "e deleted) allocated list) $$$$$$$$$$$$$$$$ process)1 stVadd)C1 endVadd)BD process)C stVadd)BD endVadd)LC process)E stVadd)LC endVadd)LDB process)B stVadd)LDB endVadd)MMG process)L stVadd)MMG endVadd)FMG free list)

$$$$$$$$$$$$$$$$$ stVadd) endVadd)C1 stVadd)FMG endVadd)1 CB process to "e deleted)1 allocated list) $$$$$$$$$$$$$$$$ process)C stVadd)BD endVadd)LC process)E stVadd)LC endVadd)LDB process)B stVadd)LDB endVadd)MMG process)L stVadd)MMG endVadd)FMG free list) $$$$$$$$$$$$$$$$$ stVadd) endVadd)BD stVadd)FMG endVadd)1 CB no.of process)G process to "e inserted) 1 siSe )1 L allocated list) $$$$$$$$$$$$$$$$ process)C stVadd)BD endVadd)LC process)E stVadd)LC endVadd)LDB process)B stVadd)LDB endVadd)MMG process)L stVadd)MMG endVadd)FMG process)1 stVadd) endVadd)1 L free list) $$$$$$$$$$$$$$$$$ stVadd)1 L endVadd)BD stVadd)FMG endVadd)1 CB process to "e inserted) 11 siSe )DE allocated list) $$$$$$$$$$$$$$$$ process)C stVadd)BD endVadd)LC process)E stVadd)LC endVadd)LDB process)B stVadd)LDB endVadd)MMG process)L stVadd)MMG endVadd)FMG process)1 stVadd) endVadd)1 L process)11 stVadd)1 L endVadd)1DF

free list)

$$$$$$$$$$$$$$$$$ stVadd)1DF endVadd)BD process to "e inserted) 1C siSe )G allocated list) $$$$$$$$$$$$$$$$ process)C stVadd)BD endVadd)LC process)E stVadd)LC endVadd)LDB process)B stVadd)LDB endVadd)MMG process)L stVadd)MMG endVadd)FMG process)1 stVadd) endVadd)1 L process)11 stVadd)1 L endVadd)1DF process)1C stVadd)1DF endVadd)CLF free list) $$$$$$$$$$$$$$$$$ stVadd)CLF endVadd)BD stVadd)FMG endVadd)1 CB process to "e inserted) 1E siSe )1 E allocated list) $$$$$$$$$$$$$$$$ process)C stVadd)BD endVadd)LC process)E stVadd)LC endVadd)LDB process)B stVadd)LDB endVadd)MMG process)L stVadd)MMG endVadd)FMG process)1 stVadd) endVadd)1 L process)11 stVadd)1 L endVadd)1DF process)1C stVadd)1DF endVadd)CLF process)1E stVadd)CLF endVadd)EG1 free list) $$$$$$$$$$$$$$$$$ stVadd)EG1 endVadd)BD stVadd)FMG endVadd)1 CB process to "e inserted) 1B siSe )MC allocated list) $$$$$$$$$$$$$$$$ process)C stVadd)BD endVadd)LC process)E stVadd)LC endVadd)LDB process)B stVadd)LDB endVadd)MMG process)L stVadd)MMG endVadd)FMG process)1 stVadd) endVadd)1 L process)11 stVadd)1 L endVadd)1DF process)1C

stVadd)FMG endVadd)1 CB stVadd)1DF endVadd)CLF process)1E stVadd)CLF endVadd)EG1 process)1B stVadd)FMG endVadd)DBF free list) $$$$$$$$$$$$$$$$$ stVadd)EG1 endVadd)BD stVadd)DBF endVadd)1 CB process to "e inserted) 1L siSe )1M allocated list) $$$$$$$$$$$$$$$$ process)C stVadd)BD endVadd)LC process)E stVadd)LC endVadd)LDB process)B stVadd)LDB endVadd)MMG process)L stVadd)MMG endVadd)FMG process)1 stVadd) endVadd)1 L process)11 stVadd)1 L endVadd)1DF process)1C stVadd)1DF endVadd)CLF process)1E stVadd)CLF endVadd)EG1 process)1B stVadd)FMG endVadd)DBF process)1L stVadd)EG1 endVadd)EMF free list) $$$$$$$$$$$$$$$$$ stVadd)EMF endVadd)BD stVadd)DBF endVadd)1 CB