Untitled
unknown
plain_text
a year ago
888 B
2
Indexable
Never
#include<stdio.h> #include<unistd.h> main() { int i,pid; if(pid==-1) { perror("fork failed"); exit(0); } else if(pid==0) { printf("\n Child process starts"); for(i=0; i<5; i++) { printf("\n Child process %d is called",i); } printf("\n Child process ends"); } else { printf("\n Parent process ends"); } exit(0); } #include<stdio.h> #include<conio.h> main() { int i,m,n,tot,s[20]; printf("Enter total memory size:"); scanf("%d",&tot); printf("Enter no. of pages:"); scanf("%d",&n); printf("Enter memory for OS:"); scanf("%d",&m); for(i=0;i<n;i++) { printf("Enter size of page%d:",i+1); scanf("%d",&s[i]); } tot=tot-m; for(i=0;i<n;i++) { if(tot>=s[i]) { printf("Allocate page %d\n",i+1); tot=tot-s[i]; } else printf("process p%d is blocked\n",i+1); } printf("External Fragmentation is=%d",tot); getch(); }