Opearting System-II Slips




Slip1_1

#include<stdio.h>

int A[10][10], M[10][10], N[10][10];

int AV[10], Safe[10], Finish[10], R[10][10], nor, nop;

void AcceptData(intX[][10])

{

int i, j;

for (i = 0; i < nop; i++)

{

printf("P%d\n", i);

for (j = 0; j < nor; j++)

{

printf("%c:", 65 + j); scanf("%d", &X[i][j]);

}

}

}

void AcceptAvailable()

{

int i;

for (i = 0; i < nor; i++)

{

printf("%c:", 65 + i);

scanf("%d", &AV[i]);

}

}

void AcceptRequest(intR[][10])

{

int i;

for (i = 0; i < nor; i++)

{

printf("%c:", 65 + i);

scanf("%d", &R[i]);

}

}

void DisplayData()

{

Available

A

B

3

3

C

2int i, j; printf("\n\tAllocation\t\tMax\t\tNeed\n"); printf("\t");

for (i = 0; i < 3; i++)

{

for (j = 0; j < nor; j++)

{

printf("%4c", 65 + j);

}

printf("\t");

}

for (i = 0; i < nop; i++){

printf("\nP%d\t", i);

for (j = 0; j < nor; j++)

{

printf("%4d", A[i][j]);

}

printf("\t");

for (j = 0; j < nor; j++)

{

printf("%4d", M[i][j]);

}

printf("\t");

for (j = 0; j < nor; j++) printf("%4d", N[i][j]);

}

printf("\nAvailable\n"); for (j = 0; j < nor; j++)

{

printf("%4d", AV[j]);

}

}

void CalcNeed()

{

int i, j;

for (i = 0; i < nop; i++)

{

for (j = 0; j < nor; j++)

{

N[i][j] = M[i][j] - A[i][j];

}

}

}

int CheckNeed(intpno)

{

int i;

for (i = 0; i < nor; i++)

{

if (N[pno][i] > AV[i])

{

return 0;

}

}

return 1;

}

int main()

{

printf("\nEnter Number of Process :"); scanf("%d", &nop);

printf("\nEnter Number of Resources :"); scanf("%d", &nor);

printf("Enter Allocation\n"); AcceptData(A);

printf("Enter MAX Requirement\n"); AcceptData(M);

printf("Enter Availability\n"); AcceptAvailable();

CalcNeed(); DisplayData();

}

 Slip1_2

#include<stdio.h>

#include<stdlib.h>

int main()

{

int RQ[100],i,n,TotalHeadMoment=0,initial;

printf("Enter the number of Requests\n");

scanf("%d",&n);

printf("Enter the Requests sequence\n");

for(i=0;i<n;i++)

scanf("%d",&RQ[i]);

printf("Enter initial head position\n");

scanf("%d",&initial);

// logic for FCFS disk scheduling

for(i=0;i<n;i++)

{

TotalHeadMoment=TotalHeadMoment+abs(RQ[i]-initial);

initial=RQ[i];

}

printf("Total head moment is %d",TotalHeadMoment);return 0;

}

Slip 4_1
#include<stdio.h>
int A[10][10],M[10][10],N[10][10],Av[10],nor,nop;
void AcceptData(int X[][10])
{
int i,j;
for(i=0;i<nop;i++)
{
printf("P%d\n",i);
for(j=0;j<nor;j++)
{
printf("%c: ",65+j);
scanf("%d",&X[i][j]);
}
}
}
void AcceptAvailability()
{
int i;
for(i=0;i<nor;i++)
{
printf("%c: ",65+i);
scanf("%d",&Av[i]);
}
}
void DisplayData()
{
int i,j;
printf("\n\tAllocation\t\tMax\t\tNeed\n");
printf("\t");
for(i=0;i<3;i++)
{
for(j=0;j<nor;j++)
printf("%4c",65+j);
printf("\t");
}
for(i=0;i<nop;i++)
{
printf("\nP%d\t",i);
for(j=0;j<nor;j++)
printf("%4d",A[i][j]);
printf("\t");
for(j=0;j<nor;j++)
printf("%4d",M[i][j]);
printf("\t");
for(j=0;j<nor;j++)
printf("%4d",N[i][j]);
}
printf("\nAvailable\n");
for(j=0;j<nor;j++)
printf("%4d",Av[j]);
}
1
4
6
0
4
5
4
4
5void CalcNeed()
{
int i,j;
for(i=0;i<nop;i++)
for(j=0;j<nor;j++)
N[i][j] = M[i][j] - A[i][j];
}
void main()
{
printf("\nEnter No.of Processes & No.of Resources: ");
scanf("%d %d",&nop,&nor);
printf("Enter Allocation\n");
AcceptData(A);
printf("Enter Max Requirement\n");
AcceptData(M);
printf("Enter Availability\n");
AcceptAvailability();
CalcNeed();
DisplayData();
}
Slip4_2
#include <stdio.h>
#include <math.h>
int main()
{
int queue[20], n, head, i, j, k, seek = 0, max, diff, temp, queue1[20],
queue2[20], temp1 = 0, temp2 = 0;
float avg;
printf("Enter the max range of disk\n");
scanf("%d", &max);
printf("Enter the initial head position\n");
scanf("%d", &head);
printf("Enter the size of queue request\n");
scanf("%d", &n);
printf("Enter the queue of disk positions to be read\n");
for (i = 1; i <= n; i++)
{
scanf("%d", &temp);
if (temp >= head){
queue1[temp1] = temp;
temp1++;
}
else
{
queue2[temp2] = temp;
temp2++;
}
}
for (i = 0; i < temp1 - 1; i++)
{
for (j = i + 1; j < temp1; j++)
{
if (queue1[i] > queue1[j])
{
temp = queue1[i];
queue1[i] = queue1[j];
queue1[j] = temp;
}
}
}
for (i = 0; i < temp2 - 1; i++)
{
for (j = i + 1; j < temp2; j++)
{
if (queue2[i] < queue2[j])
{
temp = queue2[i];
queue2[i] = queue2[j];
queue2[j] = temp;
}
}
}
for (i = 1, j = 0; j < temp1; i++, j++)
queue[i] = queue1[j];
queue[i] = max;for (i = temp1 + 2, j = 0; j < temp2; i++, j++)
queue[i] = queue2[j];
queue[i] = 0;
queue[0] = head;
for (j = 0; j <= n + 1; j++)
{
diff = abs(queue[j + 1] - queue[j]);
seek += diff;
printf("Disk head moves from %d to %d with seek %d\n", queue[j],
queue[j + 1], diff);
}
printf("Total seek time is %d\n", seek);
avg = seek / (float)n;
printf("Average seek time is %f\n", avg);
return 0;
}
Slip6_1
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
struct file
{
char filename[20];
int filesize;
int startblock;
int endblock;
};
typedef struct file f;
struct node
{
int blockno;
struct node *next;
};
typedef struct node block;
block *freelist=NULL,*allocate=NULL,*lasta=NULL;
f f1[20];
int no=1,d,size,count=1,countfblock=0;
block *getblock()
{
block *temp;
temp=(block *)malloc(sizeof(block));
temp->blockno=no;
no++;
temp->next=NULL;
return(temp);
}
block * addblock(block *ptr)
{
block *temp;
temp=(block *)malloc(sizeof(block));
temp->blockno=ptr->blockno;
temp->next=NULL;
return(temp);
}
block *create()
{
block *temp,*last=NULL,*list=NULL;
int i;
for(i=0;i<d;i++)
{
temp=getblock();
if(list==NULL)
{
list=temp;
last=temp;
}
else
{
last->next=temp;
last=temp;
}}
return(list);
}
block *createalloclist()
{
block *temp,*ptr=freelist,*prev;
int i;
f1[count].startblock=ptr->blockno;
for(i=0;i<f1[count].filesize && ptr!=NULL;i++)
{
temp=addblock(ptr);
f1[count].endblock=temp->blockno;
prev=ptr;
freelist=ptr->next;
ptr=ptr->next;
if(allocate==NULL)
{
allocate=temp;
lasta=temp;
}
else
{
lasta->next=temp;
lasta=temp;
}
}
return(allocate);
}
void displaylist(block *list1)
{
block *ptr;
for(ptr=list1;ptr!=NULL;ptr=ptr->next)
printf("%d->",ptr->blockno);
}
void countfree(block *list1)
{
block *ptr;
for(ptr=list1;ptr->next!=NULL;ptr=ptr->next)
countfblock++;
}
void acceptfile()
{printf("\nEnter the file name:");
scanf("%s",&f1[count].filename);
printf("\nEnter file size in blocks:");
scanf("%d",&f1[count].filesize);
}
void displayfile()
{
int i;
printf("\nFile name\t\tFile size\t\tstart block\t\tEnd block");
for(i=1;i<=count;i++)
{
printf("\n%s",f1[i].filename);
printf("\t\t\t%d",f1[i].filesize);
printf("\t\t\t%d",f1[i].startblock);
printf("\t\t\t%d",f1[i].endblock);
}
}
int main()
{
int ch,result;
char fname[20];
printf("\nEnter the size of disk in blocks");
scanf("%d",&d);
freelist=create();
while(1)
{
printf("\n1: Allocate space for newly created file.");
printf("\n2: Show used and free space on disk.");
printf("\n3: Exit");
printf("\nEnter the choice");
scanf("%d",&ch);
switch(ch)
{
case 1:
acceptfile();
countfree(freelist);
if(countfblock>=f1[count].filesize)
{
allocate=createalloclist();
displayfile();
count++;
}
else
printf("\nNo sufficient space to allocate");
break;
case 2:
printf("\nFree list:");
displaylist(freelist);
printf("\nAllocated list: ");
displaylist(allocate);
break;
case 3:
exit(0);
}
}
}
Slip6_2
#include<stdio.h>
#include<stdlib.h>
int main()
{
int RQ[100],i,j,n,TotalHeadMoment=0,initial,size,move;
printf("Enter the number of Requests\n");
scanf("%d",&n);
printf("Enter the Requests sequence\n");
for(i=0;i<n;i++)
scanf("%d",&RQ[i]);
printf("Enter initial head position\n");
scanf("%d",&initial);
printf("Enter total disk size\n");
scanf("%d",&size);
printf("Enter the head movement direction for high 1 and for low 0\n");
scanf("%d",&move);
// logic for C-Scan disk scheduling
/*logic for sort the request array */
for(i=0;i<n;i++)
{
for( j=0;j<n-i-1;j++)
{
if(RQ[j]>RQ[j+1])
{
int temp;
temp=RQ[j];
RQ[j]=RQ[j+1];
RQ[j+1]=temp;
}
}
}
int index;
for(i=0;i<n;i++)
{
if(initial<RQ[i])
{
index=i;
break;
}
}
// if movement is towards high value
if(move==1)
{
for(i=index;i<n;i++)
{
TotalHeadMoment=TotalHeadMoment+abs(RQ[i]-initial);
initial=RQ[i];
}
// last movement for max sizeTotalHeadMoment=TotalHeadMoment+abs(size-RQ[i-1]-1);
/*movement max to min disk */
TotalHeadMoment=TotalHeadMoment+abs(size-1-0);
initial=0;
for( i=0;i<index;i++)
{
TotalHeadMoment=TotalHeadMoment+abs(RQ[i]-initial);
initial=RQ[i];
}
}
// if movement is towards low value
else
{
for(i=index-1;i>=0;i--)
{
TotalHeadMoment=TotalHeadMoment+abs(RQ[i]-initial);
initial=RQ[i];
}
// last movement for min size
TotalHeadMoment=TotalHeadMoment+abs(RQ[i+1]-0);
/*movement min to max disk */
TotalHeadMoment=TotalHeadMoment+abs(size-1-0);
initial =size-1;
for(i=n-1;i>=index;i--)
{
TotalHeadMoment=TotalHeadMoment+abs(RQ[i]-initial);
initial=RQ[i];
}
}
printf("Total head movement is %d",TotalHeadMoment);
return 0;
}
Slip7_1
#include<stdio.h>
#include<stdlib.h>
int ind,A[10][10],M[10][10],N[10][10],Av[10],Safe[10],Finish[10],nor,nop,work[10],req[10][10];
void AcceptData(int X[][10])
{
int i,j;
for(i=0;i<nop;i++)
{
printf("P%d:\n",i);for(j=0;j<nor;j++)
{
printf("%c:",65+j);
scanf("%d",&X[i][j]);
}
}
}
void AcceptAvailability()
{
int i;
for(i=0;i<nor;i++)
{
printf("%c",65+i);
scanf("%d",&Av[i]);
work[i]=Av[i];
}
}
void DisplayData()
{
int i,j;
printf("\n\tAllocation\t\tMax\t\tNeed\n");
printf("\t");
for(i=0;i<3;i++)
{
for(j=0;j<nor;j++)
printf("%4c",65+j);
printf("\t");
}
for(i=0;i<nop;i++)
{
printf("\nP%d\t",i);
for(j=0;j<nor;j++)
printf("%4d",A[i][j]);
printf("\t");
for(j=0;j<nor;j++)
printf("%4d",M[i][j]);
printf("\t");
for(j=0;j<nor;j++)
printf("%4d",N[i][j]);
}
printf("\nAvailable\n”);
for(j=0;j<nor;j++)
printf("%4d",work[j]);
}
void CalcNeed()
{
int i,j;
for(i=0;i<nop;i++)
for(j=0;j<nor;j++)
N[i][j]=M[i][j]-A[i][j];
}
void Resource_Request(int no)
{
int i,f11=0,f12=0;
for(i=0;i<nor;i++)
{
if(req[no][i]<=N[no][i])
f11=1;
else
f11=0;
}
if(f11==0)
{
printf("\n Error!Process has exceeded its maximum claim");
exit(0);}
if(f11==1)
{
for(i=0;i<nor;i++)
{
if(req[no][i]<=work[i])
f12=1;
else
f12=0;
}
if(f12==0)
{
printf("\n Process has to wait for resources");
exit(0);
}
}
if(f11==1 && f12==1)
{
for(i=0;i<nor;i++)
{
work[i]=work[i]-req[no][i];
A[no][i]=A[no][i]+req[no][i];
N[no][i]=N[no][i]-req[no][i];
}
}
}
int checkNeed(int pno)
{
int i;
for(i=0;i<nor;i++)
if(N[pno][i]>work[i])
return(0);
return(1);
}
void Banker()
{
int i=0,j=0,k=0,flag=0;
while(flag<2)
{
if(!Finish[i])
{
printf("\nNeed%d(",i);
for(j=0;j<nor;j++)
printf("%d",N[i][j]);
if(!checkNeed(i))
{
printf("\b)>Work");
for(j=0;j<nor;j++)
printf("%d",work[j]);
printf("\b)");
printf("\nNeed Cannot be satisfied,consider next process");
}
else
{
printf("b)<=Work(");
for(j=0;j<nor;j++)
printf("%d,",work[j]);
printf("\b)");
printf("\nNeed can be satisfied,so allocate required resources");
printf("\nWork(%d)=",i);
for(j=0;j<nor;j++)
{
work[j]+=A[i][j];
}
for(j=0;j<nor;j++)printf("%4d",work[j]);
printf("\nAfter P%d terminates it will release all its resources\n",i);
Safe[k++]=i;
Finish[i]=1;
}
}
if((i+1)%nop==0)
flag++;
i=(i+1)%nop;
}
if(k==nop)
{
printf("\nSystem is in safe state...");
printf("\nSafe Sequence:");
for(i=0;i<k;i++)
printf("P%d->",Safe[i]);
printf("\b\b");
}
else
{
printf("\nSystem is in not safe state...");
}
}
int main()
{
int i;
printf("\nEnter no of processes & No of Resources:");
scanf("%d%d",&nop,&nor);
printf("Enter Allocation\n");
AcceptData(A);
printf("Enter Max Requirement\n");
AcceptData(M);
printf("Enter Availability\n");
AcceptAvailability();
CalcNeed();
DisplayData();
Banker();
printf("\n Enter Process number from which request arrives:");
scanf("%d",&ind);
printf("\nEnter request for process%d\n",ind);
for(i=0;i<nor;i++)
{
printf("%c",65+i);
scanf("%d",&req[ind][i]);
}
for(i=0;i<nop;i++)
Finish[i]=0;
for(i=0;i<nor;i++)
work[i]=Av[i];
Resource_Request(ind);
Banker();
return(0);
}
Slip7_2
#include <stdio.h>#include <math.h>
int main()
{
int queue[20], n, head, i, j, k, seek = 0, max, diff, temp, queue1[20],
queue2[20], temp1 = 0, temp2 = 0;
float avg;
printf("Enter the max range of disk\n");
scanf("%d", &max);
printf("Enter the initial head position\n");
scanf("%d", &head);
printf("Enter the size of queue request\n");
scanf("%d", &n);
printf("Enter the queue of disk positions to be read\n");
for (i = 1; i <= n; i++)
{
scanf("%d", &temp);
if (temp >= head)
{
queue1[temp1] = temp;
temp1++;
}
else
{
queue2[temp2] = temp;
temp2++;
}
}
for (i = 0; i < temp1 - 1; i++)
{
for (j = i + 1; j < temp1; j++)
{
if (queue1[i] > queue1[j])
{
temp = queue1[i];
queue1[i] = queue1[j];
queue1[j] = temp;
}
}
}
for (i = 0; i < temp2 - 1; i++)
{
for (j = i + 1; j < temp2; j++)
{
if (queue2[i] < queue2[j])
{
temp = queue2[i];
queue2[i] = queue2[j];
queue2[j] = temp;
}
}
}
for (i = 1, j = 0; j < temp1; i++, j++)
queue[i] = queue1[j];
queue[i] = max;
for (i = temp1 + 2, j = 0; j < temp2; i++, j++)
queue[i] = queue2[j];
queue[i] = 0;
queue[0] = head;for (j = 0; j <= n + 1; j++)
{
diff = abs(queue[j + 1] - queue[j]);
seek += diff;
printf("Disk head moves from %d to %d with seek %d\n", queue[j],
queue[j + 1], diff);
}
printf("Total seek time is %d\n", seek);
avg = seek / (float)n;
printf("Average seek time is %f\n", avg);
return 0;
}
Slip8_1
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
struct freelist
{
int start;
int size;
struct freelist *next;
};
struct usedlist
{
char fname[10];
int fstart;
int fsize;
};
struct freelist *head=NULL,*new=NULL,*temp,*prev,*temp1;
struct usedlist dir_ent[10];
int dir_index=0;
main()
{
int ch,i;
char filename[10];
create();
do
{
printf("\n*****menu*******\n");
printf("1.Create file\n");
printf("2. Show Free and Used Block list\n");
printf("3. exit\n");
printf("Enter your choice: ");
scanf("%d",&ch);
switch(ch)
{
case 1: allocate();
break;
case 2: printf("\nThe free list is");
printf("\nStartBlock\tSize\n");
for (temp=head;temp!=NULL; temp=temp->next)
{
printf("%d",temp->start);
printf("\t%d\n",temp->size);
}
printf("The used list is");
printf("\nFilename\tStart\tLength\n");
for(i=0;i<dir_index;i++)
{
printf("%s\t%d\t\t%d\n",dir_ent[i].fname,dir_ent[i].fstart,dir_ent[i].fsize);
}
break;
case 3: exit(0);
break;
}
}while (ch!=3);
}
create()
{int no_of_blocks;
printf("Enter number of blocks\n");
scanf("%d",&no_of_blocks);
new = (struct freelist*)malloc(sizeof(struct freelist));
head=new;
new->start=0;
new->size=no_of_blocks;
new->next=NULL;
}
allocate()
{
int s, allocated=0;
char filename[10];
printf("enter file name \n");
scanf("%s",filename);
printf("enter size of a file in blocks\n");
scanf("%d",&s);
for(temp=head;temp!=NULL;)
{
if(temp->size < s)
temp=temp->next;
else
{
//temp->size-=s;
strcpy(dir_ent[dir_index].fname,filename);
dir_ent[dir_index].fstart=temp->start;
temp->start+=s;
dir_ent[dir_index].fsize=s;
dir_index++;
allocated=1;
break;
}
if (temp==NULL && allocated==0)
printf("Disk space not available\n");
}
}
Slip8_2
#include<stdio.h>
#include<stdlib.h>
int main()
{
int RQ[100],i,n,TotalHeadMovement=0,initial,count=0;
printf("Enter the number of Requests\n");
scanf("%d",&n);
printf("Enter the Requests sequence\n");
for(i=0;i<n;i++)
scanf("%d",&RQ[i]);
printf("Enter initial head position\n");
scanf("%d",&initial);
//sstf disk schedulingwhile(count!=n)
{
int min=1000,d,index;
for(i=0;i<n;i++)
{
d=abs(RQ[i]-initial);
if(min>d)
{
min=d;
index=i;
}
}
TotalHeadMovement=TotalHeadMovement+min;
initial=RQ[index];
// 1000 is for max
// you can use any number
RQ[index]=1000;
count++;
}
printf("Total head movement is %d",TotalHeadMovement);
return 0
Slip13_1
#include<stdio.h> 
#include<stdlib.h> 
int ind,A[10][10],M[10][10],N[10][10],Av[10],Safe[10],Finish[10],nor,nop,work[10],req[10][10]; 
void AcceptData(int X[][10]) 
int i,j; 
for(i=0;i<nop;i++) 
printf("P%d:\n",i); 
for(j=0;j<nor;j++) 
printf("%c:",65+j); 
scanf("%d",&X[i][j]); 
void AcceptAvailability() 
int i; 
for(i=0;i<nor;i++) 
printf("%c",65+i); 
scanf("%d",&Av[i]); 
work[i]=Av[i]; 
void DisplayData() 
int i,j; 
printf("\n\tAllocation\t\tMax\t\tNeed\n"); 
printf("\t"); 
for(i=0;i<3;i++) 
for(j=0;j<nor;j++) 
printf("%4c",65+j); 
printf("\t"); 
for(i=0;i<nop;i++) 
printf("\nP%d\t",i); 
for(j=0;j<nor;j++) 
printf("%4d",A[i][j]); 
printf("\t"); 
for(j=0;j<nor;j++) 
printf("%4d",M[i][j]); 
printf("\t"); 
for(j=0;j<nor;j++) 
printf("%4d",N[i][j]); 
printf("\nAvailable\n”); 
for(j=0;j<nor;j++) 
printf("%4d",work[j]); 
void CalcNeed() 
int i,j; 
for(i=0;i<nop;i++) 
for(j=0;j<nor;j++) 
N[i][j]=M[i][j]-A[i][j]; 
void Resource_Request(int no) 
int i,f11=0,f12=0; 
for(i=0;i<nor;i++) 
if(req[no][i]<=N[no][i]) 
f11=1; 
else 
f11=0; 
if(f11==0) 
printf("\n Error!Process has exceeded its maximum claim"); 
exit(0); 
if(f11==1) 
for(i=0;i<nor;i++) 
if(req[no][i]<=work[i]) 
f12=1; 
else 
f12=0; 
if(f12==0) 
printf("\n Process has to wait for resources"); 
exit(0); 
if(f11==1 && f12==1) 
for(i=0;i<nor;i++) 
work[i]=work[i]-req[no][i]; 
A[no][i]=A[no][i]+req[no][i]; 
N[no][i]=N[no][i]-req[no][i]; 
int checkNeed(int pno) 
int i; 
for(i=0;i<nor;i++) 
if(N[pno][i]>work[i]) 
return(0); 
return(1); 
void Banker() 
int i=0,j=0,k=0,flag=0; 
while(flag<2) 
if(!Finish[i]) 
printf("\nNeed%d(",i); 
for(j=0;j<nor;j++) 
printf("%d",N[i][j]); 
if(!checkNeed(i)) 
printf("\b)>Work"); 
for(j=0;j<nor;j++) 
printf("%d",work[j]); 
printf("\b)"); 
printf("\nNeed Cannot be satisfied,consider next process"); 
else 
printf("b)<=Work("); 
for(j=0;j<nor;j++) 
printf("%d,",work[j]); 
printf("\b)"); 
printf("\nNeed can be satisfied,so allocate required resources"); 
printf("\nWork(%d)=",i); 
for(j=0;j<nor;j++) 
work[j]+=A[i][j]; 
for(j=0;j<nor;j++) 
printf("%4d",work[j]); 
printf("\nAfter P%d terminates it will release all its resources\n",i); 
Safe[k++]=i; 
Finish[i]=1; 
if((i+1)%nop==0) 
flag++; 
i=(i+1)%nop; 
if(k==nop) 
printf("\nSystem is in safe state..."); 
printf("\nSafe Sequence:"); 
for(i=0;i<k;i++) 
printf("P%d->",Safe[i]); 
printf("\b\b"); 
else 
printf("\nSystem is in not safe state..."); 
int main() 
int i; 
printf("\nEnter no of processes & No of Resources:"); 
scanf("%d%d",&nop,&nor); 
printf("Enter Allocation\n"); 
AcceptData(A); 
printf("Enter Max Requirement\n"); 
AcceptData(M); 
printf("Enter Availability\n"); 
AcceptAvailability(); 
CalcNeed(); 
DisplayData(); 
Banker(); 
printf("\n Enter Process number from which request arrives:"); 
scanf("%d",&ind); 
printf("\nEnter request for process%d\n",ind); 
for(i=0;i<nor;i++) 
printf("%c",65+i); 
scanf("%d",&req[ind][i]); 
for(i=0;i<nop;i++) 
Finish[i]=0; 
for(i=0;i<nor;i++) 
work[i]=Av[i]; 
Resource_Request(ind); 
Banker(); 
return(0); 
Slip13_2
#include <stdio.h>
#include <math.h>
int main()
{
int queue[20], n, head, i, j, k, seek = 0, max, diff, temp, queue1[20],
queue2[20], temp1 = 0, temp2 = 0;
float avg;
printf("Enter the max range of disk\n");
scanf("%d", &max);
printf("Enter the initial head position\n");
scanf("%d", &head);
printf("Enter the size of queue request\n");
scanf("%d", &n);
printf("Enter the queue of disk positions to be read\n");
for (i = 1; i <= n; i++)
{
scanf("%d", &temp);
if (temp >= head)
{
queue1[temp1] = temp;
temp1++;
}
else
{
queue2[temp2] = temp;
temp2++;
}
}
for (i = 0; i < temp1 - 1; i++)
{
for (j = i + 1; j < temp1; j++)
{
if (queue1[i] > queue1[j])
{
temp = queue1[i];
queue1[i] = queue1[j];
queue1[j] = temp;
}
}
}
for (i = 0; i < temp2 - 1; i++)
{
for (j = i + 1; j < temp2; j++)
{
if (queue2[i] < queue2[j])
{
temp = queue2[i];
queue2[i] = queue2[j];
queue2[j] = temp;
}
}
}
for (i = 1, j = 0; j < temp1; i++, j++)
queue[i] = queue1[j];
queue[i] = max;
for (i = temp1 + 2, j = 0; j < temp2; i++, j++)
queue[i] = queue2[j];
queue[i] = 0;
queue[0] = head;
for (j = 0; j <= n + 1; j++)
{
diff = abs(queue[j + 1] - queue[j]);seek += diff;
printf("Disk head moves from %d to %d with seek %d\n", queue[j],
queue[j + 1], diff);
}
printf("Total seek time is %d\n", seek);
avg = seek / (float)n;
printf("Average seek time is %f\n", avg);
return 0;
}
Slip14_1
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
struct freelist
{
int start;
int size;struct freelist *next;
};
struct usedlist
{
char fname[10];
int fstart;
int fsize;
};
struct freelist *head=NULL,*new=NULL,*temp,*prev,*temp1;
struct usedlist dir_ent[10];
int dir_index=0;
main()
{
int ch,i;
char filename[10];
create();
do
{
printf("\n*****menu*******\n");
printf("1.Create file\n");
printf("2. Show Free and Used Block list\n");
printf("3. exit\n");
printf("Enter your choice: ");
scanf("%d",&ch);
switch(ch)
{
case 1: allocate();
break;
case 2: printf("\nThe free list is");
printf("\nStartBlock\tSize\n");
for (temp=head;temp!=NULL; temp=temp->next)
{
printf("%d",temp->start);
printf("\t%d\n",temp->size);
}
printf("The used list is");
printf("\nFilename\tStart\tLength\n");
for(i=0;i<dir_index;i++)
{
printf("%s\t%d\t\t%d\n",dir_ent[i].fname,dir_ent[i].fstart,dir_ent[i].fsize);
}
break;
case 3: exit(0);
break;
}
}while (ch!=3);
}
create()
{
int no_of_blocks;
printf("Enter number of blocks\n");
scanf("%d",&no_of_blocks);
new = (struct freelist*)malloc(sizeof(struct freelist));
head=new;
new->start=0;
new->size=no_of_blocks;
new->next=NULL;
}
allocate()
{int s, allocated=0;
char filename[10];
printf("enter file name \n");
scanf("%s",filename);
printf("enter size of a file in blocks\n");
scanf("%d",&s);
for(temp=head;temp!=NULL;)
{
if(temp->size < s)
temp=temp->next;
else
{
//temp->size-=s;
strcpy(dir_ent[dir_index].fname,filename);
dir_ent[dir_index].fstart=temp->start;
temp->start+=s;
dir_ent[dir_index].fsize=s;
dir_index++;
allocated=1;
break;
}
if (temp==NULL && allocated==0)
printf("Disk space not available\n");
}
}
Slip14_2
#include<stdio.h>
#include<stdlib.h>
int main()
{
int RQ[100],i,n,TotalHeadMovement=0,initial,count=0;
printf("Enter the number of Requests\n");
scanf("%d",&n);
printf("Enter the Requests sequence\n");
for(i=0;i<n;i++)
scanf("%d",&RQ[i]);
printf("Enter initial head position\n");
scanf("%d",&initial);
//sstf disk scheduling
while(count!=n)
{
int min=1000,d,index;
for(i=0;i<n;i++)
{
d=abs(RQ[i]-initial);
if(min>d)
{
min=d;
index=i;
}
}
TotalHeadMovement=TotalHeadMovement+min;
initial=RQ[index];
// 1000 is for max
// you can use any numberRQ[index]=1000;
count++;
}
printf("Total head movement is %d",TotalHeadMovement);
return 0;
Slip15_1
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
struct file
{
char filename[20];
int filesize;
int startblock;
int endblock;
};
typedef struct file f;
struct node
{
int blockno;
struct node *next;
};
typedef struct node block;
block *freelist=NULL,*allocate=NULL,*lasta=NULL;
f f1[20];
int no=1,d,size,count=1,countfblock=0;
block *getblock()
{
block *temp;
temp=(block *)malloc(sizeof(block));
temp->blockno=no;
no++;
temp->next=NULL;
return(temp);
}
block * addblock(block *ptr)
{
block *temp;
temp=(block *)malloc(sizeof(block));
temp->blockno=ptr->blockno;
temp->next=NULL;
return(temp);
}
block *create()
{
block *temp,*last=NULL,*list=NULL;
int i;for(i=0;i<d;i++)
{
temp=getblock();
if(list==NULL)
{
list=temp;
last=temp;
}
else
{
last->next=temp;
last=temp;
}
}
return(list);
}
block *createalloclist()
{
block *temp,*ptr=freelist,*prev;
int i;
f1[count].startblock=ptr->blockno;
for(i=0;i<f1[count].filesize && ptr!=NULL;i++)
{
temp=addblock(ptr);
f1[count].endblock=temp->blockno;
prev=ptr;
freelist=ptr->next;
ptr=ptr->next;
if(allocate==NULL)
{
allocate=temp;
lasta=temp;
}
else
{
lasta->next=temp;
lasta=temp;
}
}
return(allocate);
}
{printf("\nEnter the file name:");
scanf("%s",&f1[count].filename);
printf("\nEnter file size in blocks:");
scanf("%d",&f1[count].filesize);
}
void displayfile()
{
int i;
printf("\nFile name\t\tFile size\t\tstart block\t\tEnd block");
for(i=1;i<=count;i++)
{
printf("\n%s",f1[i].filename);
printf("\t\t\t%d",f1[i].filesize);
printf("\t\t\t%d",f1[i].startblock);
printf("\t\t\t%d",f1[i].endblock);
}
}
int main()
{
int ch,result;
char fname[20];
printf("\nEnter the size of disk in blocks");
scanf("%d",&d);
freelist=create();
while(1)
{
printf("\n1: Allocate space for newly created file.");
printf("\n2: Show used and free space on disk.");
printf("\n3: Exit");
printf("\nEnter the choice");
scanf("%d",&ch);
switch(ch)
{
case 1:
acceptfile();
countfree(freelist);
if(countfblock>=f1[count].filesize)
{
allocate=createalloclist();
displayfile();
count++;
}
else
printf("\nNo sufficient space to allocate");
break;
case 2:
printf("\nFree list:");
displaylist(freelist);
printf("\nAllocated list: ");displaylist(allocate);
break;
case 3:
exit(0);
}
}
}
Slip15_2
#include<stdio.h>
#include<stdlib.h>
int main()
{
int RQ[100],i,j,n,TotalHeadMoment=0,initial,size,move;
printf("Enter the number of Requests\n");
scanf("%d",&n);
printf("Enter the Requests sequence\n");
for(i=0;i<n;i++)
scanf("%d",&RQ[i]);
printf("Enter initial head position\n");
scanf("%d",&initial);
printf("Enter total disk size\n");
scanf("%d",&size);
printf("Enter the head movement direction for high 1 and for low 0\n");
scanf("%d",&move);
// logic for C-Scan disk scheduling
/*logic for sort the request array */
for(i=0;i<n;i++)
{
for( j=0;j<n-i-1;j++)
{
if(RQ[j]>RQ[j+1])
{
int temp;
temp=RQ[j];
RQ[j]=RQ[j+1];
RQ[j+1]=temp;
}
}
}}
int index;
for(i=0;i<n;i++)
{
if(initial<RQ[i])
{
index=i;
break;
}
}
// if movement is towards high value
if(move==1)
{
for(i=index;i<n;i++)
{
TotalHeadMoment=TotalHeadMoment+abs(RQ[i]-initial);
initial=RQ[i];
}
// last movement for max size
TotalHeadMoment=TotalHeadMoment+abs(size-RQ[i-1]-1);
/*movement max to min disk */
TotalHeadMoment=TotalHeadMoment+abs(size-1-0);
initial=0;
for( i=0;i<index;i++)
{
TotalHeadMoment=TotalHeadMoment+abs(RQ[i]-initial);
initial=RQ[i];
}
}
// if movement is towards low value
else
{
for(i=index-1;i>=0;i--)
{
TotalHeadMoment=TotalHeadMoment+abs(RQ[i]-initial);
initial=RQ[i];
}
// last movement for min size
TotalHeadMoment=TotalHeadMoment+abs(RQ[i+1]-0);
/*movement min to max disk */
TotalHeadMoment=TotalHeadMoment+abs(size-1-0);
initial =size-1;
for(i=n-1;i>=index;i--)
{
TotalHeadMoment=TotalHeadMoment+abs(RQ[i]-initial);
initial=RQ[i];
}
}
printf("Total head movement is %d",TotalHeadMoment);
return 0;
Slip17_1
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define BLOCK_SIZE 1024
int *disk;
int *free_blocks;
int *index_table;
int n_blocks;
void initialize_disk(int n) {
/*
* Initializes a disk with n number of blocks and randomly marks some blocks as allocated.
*/
int i;
disk = (int *) malloc(n * sizeof(int));
free_blocks = (int *) malloc(n * sizeof(int));
index_table = (int *) calloc(10, sizeof(int)); // Assume we have 10 filesn_blocks = n;
srand(time(NULL));
for (i = 0; i < n; i++) {
if ((double) rand() / RAND_MAX < 0.5) {
disk[i] = 1;
} else {
disk[i] = 0;
free_blocks[free_blocks[0] + 1] = i;
free_blocks[0]++;
}
}
}
void show_bit_vector() {
/*
* Shows the bit vector for the disk.
*/
int i, j;
printf("Bit Vector:\n");
for (i = 0; i < n_blocks; i += 10) {
for (j = i; j < i + 10; j++) {
if (j >= n_blocks) {
break;
}
printf("%d ", disk[j]);
}
printf("\n");
}
}
void show_directory() {
/*
* Shows the directory for the disk.
*/
int i, j;
printf("Directory:\n");
for (i = 0; i < 10; i++) {
printf("%d: ", i);
for (j = 0; j < index_table[i]; j++) {
printf("%d ", index_table[i * BLOCK_SIZE + j]);
}
printf("\n");
}
}void delete_file(int file_index) {
/*
* Deletes a file from the disk by setting its blocks to free.
*/
int i, block_index;
for (i = 0; i < index_table[file_index]; i++) {
block_index = index_table[file_index * BLOCK_SIZE + i];
disk[block_index] = 0;
free_blocks[free_blocks[0] + 1] = block_index;
free_blocks[0]++;
}
index_table[file_index] = 0;
}
int main() {
int choice, file_index;
printf("Enter the number of blocks on the disk: ");
scanf("%d", &n_blocks);
initialize_disk(n_blocks);
while (1) {
printf("\nMenu:\n");
printf("1. Show Bit Vector\n");
printf("2. Show Directory\n");
printf("3. Delete a File\n");
printf("4. Exit\n");
printf("Enter your choice: ");
scanf("%d", &choice);
switch (choice) {
case 1:
show_bit_vector();
break;
case 2:
show_directory();
break;
case 3:
printf("Enter the index of the file to delete: ");
scanf("%d", &file_index);
delete_file(file_index);
printf("File %d deleted.\n", file_index);
break;
case 4:return 0;
default:
printf("Invalid choice. Please try again.\n");
break;
}
}
}
Slip17_2
#include <stdio.h>
#include <stdlib.h>
#define DIRECTION_LEFT 0
#define DIRECTION_RIGHT 1
int abs(int x) {
return x >= 0 ? x : -x;
}
int compare(const void *a, const void *b) {
return *(int *) a - *(int *) b;
}
void print_request_order(int *request_order, int n) {
/*
* Prints the order in which the disk requests are served.
*/
int i;
printf("Order of requests served: ");
for (i = 0; i < n; i++) {
printf("%d ", request_order[i]);
}
printf("\n");
}
void print_head_movements(int head_movements) {
/*
* Prints the total number of head movements.*/
printf("Total number of head movements: %d\n", head_movements);
}
int main() {
int n_blocks, head_pos, direction, n_requests, i, j, k, head_movements = 0, min_request,
max_request, *requests, *request_order;
printf("Enter the total number of disk blocks: ");
scanf("%d", &n_blocks);
printf("Enter the current head position: ");
scanf("%d", &head_pos);
printf("Enter the disk request string (separated by spaces): ");
scanf("%d", &n_requests);
requests = (int *) malloc(n_requests * sizeof(int));
request_order = (int *) malloc(n_requests * sizeof(int));
for (i = 0; i < n_requests; i++) {
scanf("%d", &requests[i]);
}
printf("Enter the direction (0 for left, 1 for right): ");
scanf("%d", &direction);
qsort(requests, n_requests, sizeof(int), compare);
for (i = 0; i < n_requests; i++) {
if (requests[i] >= head_pos) {
break;
}
}
k = i;
if (direction == DIRECTION_LEFT) {
min_request = 0;
max_request = k - 1;
for (i = k - 1; i >= 0; i--) {
request_order[max_request - i] = requests[i];
}
for (i = k; i < n_requests; i++) {
request_order[i] = requests[i];
}
} else {
min_request = k;
max_request = n_requests - 1;
for (i = k; i < n_requests; i++) {
request_order[i - k] = requests[i];
}for (i = k - 1; i >= 0; i--) {
request_order[n_requests - 1 - i] = requests[i];
}
}
for (i = 0; i < n_requests; i++) {
head_movements += abs(request_order[i] - head_pos);
head_pos = request_order[i];
}
print_request_order(request_order, n_requests);
print_head_movements(head_movements);
return 0;
}
Slip18_1
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
// function to display the bit vector
void showBitVector(int* bitVector, int n) {
printf("Bit Vector: ");
for (int i = 0; i < n; i++) {
printf("%d ", bitVector[i]);
}
printf("\n");
}
// function to create a new filevoid createNewFile(int* bitVector, int n, int* directory) {
int fileSize, numBlocks;
printf("Enter the file size: ");
scanf("%d", &fileSize);
numBlocks = (fileSize + 511) / 512; // 512 bytes per block
int freeBlocks[numBlocks];
int freeBlockCount = 0;
for (int i = 0; i < n; i++) {
if (bitVector[i] == 0) {
freeBlocks[freeBlockCount++] = i;
if (freeBlockCount == numBlocks) {
break;
}
}
}
if (freeBlockCount != numBlocks) {
printf("Not enough free space!\n");
return;
}
int fileId;
for (fileId = 0; directory[fileId] != -1; fileId++);
directory[fileId] = freeBlocks[0];
for (int i = 0; i < numBlocks; i++) {
bitVector[freeBlocks[i]] = 1;
if (i < numBlocks - 1) {
bitVector[freeBlocks[i]] = freeBlocks[i + 1];
} else {
bitVector[freeBlocks[i]] = -1;
}
}
printf("File created with ID %d\n", fileId);
}
// function to display the directory
void showDirectory(int* directory) {
printf("Directory:\n");
for (int i = 0; directory[i] != -1; i++) {
printf("%d: block %d\n", i, directory[i]);
}
}
// function to delete a file
void deleteFile(int* bitVector, int* directory) {
int fileId;printf("Enter the ID of the file to delete: ");
scanf("%d", &fileId);
if (directory[fileId] == -1) {
printf("File not found!\n");
return;
}
int blockId = directory[fileId];
while (blockId != -1) {
bitVector[blockId] = 0;
blockId = bitVector[blockId + 1];
}
directory[fileId] = -1;
printf("File deleted\n");
}
// main function
int main() {
srand(time(NULL));
int n;
printf("Enter the number of blocks on the disk: ");
scanf("%d", &n);
int bitVector[n];
for (int i = 0; i < n; i++) {
bitVector[i] = rand() % 2; // randomly mark some blocks as allocated
}
int directory[n];
for (int i = 0; i < n; i++) {
directory[i] = -1; // initialize directory with -1 (empty)
}
int choice;
do {
printf("\n1. Show Bit Vector\n2. Create New File\n3. Show Directory\n4. Delete File\n5.
Exit\n");
printf("Enter your choice: ");
scanf("%d", &choice);
switch (choice) {
case 1:
showBitVector(bitVector, n);
break;
case 2:
createNewFile(bitVector, n, directory);
break;
case 3:
showDirectory(directory);break;
case 4:
deleteFile(bitVector, directory);
break;
case 5:
printf("Exiting...\n");
break;
default:
printf("Invalid choice!\n");
}
} while (choice != 5);
return 0;
}
Slip18_2
#include <stdio.h>
#include <stdlib.h>
#define MAX_SIZE 100
void swap(int *a, int *b) {
int temp = *a;
*a = *b;
*b = temp;
}
void sort(int arr[], int size) {
for (int i = 0; i < size - 1; i++) {
for (int j = i + 1; j < size; j++) {
if (arr[i] > arr[j]) {
swap(&arr[i], &arr[j]);
}
}
}
}
int main() {int total_blocks, head_pos, num_requests, requests[MAX_SIZE], i, j, k, pos, direction,
head_moments;
// Accept inputs from user
printf("Enter total number of disk blocks: ");
scanf("%d", &total_blocks);
printf("Enter the disk request string (up to %d requests): ", MAX_SIZE);
for (i = 0; i < MAX_SIZE; i++) {
scanf("%d", &requests[i]);
if (requests[i] == -1) {
break;
}
}
num_requests = i;
printf("Enter current head position: ");
scanf("%d", &head_pos);
printf("Enter direction (0 for left, 1 for right): ");
scanf("%d", &direction);
// Add current head position to requests
requests[num_requests++] = head_pos;
// Sort requests in ascending order
sort(requests, num_requests);
// Find index of head position
for (i = 0; i < num_requests; i++) {
if (requests[i] == head_pos) {
break;
}
}
pos = i;
// Serve requests in SCAN order
head_moments = 0;
printf("Order of request served:\n");
if (direction == 1) { // Right
for (i = pos; i < num_requests; i++) {
printf("%d ", requests[i]);
head_moments += abs(requests[i] - head_pos);
head_pos = requests[i];}
for (i = num_requests - 2; i >= 0; i--) {
printf("%d ", requests[i]);
head_moments += abs(requests[i] - head_pos);
head_pos = requests[i];
}
} else { // Left
for (i = pos; i >= 0; i--) {
printf("%d ", requests[i]);
head_moments += abs(requests[i] - head_pos);
head_pos = requests[i];
}
for (i = 1; i < num_requests; i++) {
printf("%d ", requests[i]);
head_moments += abs(requests[i] - head_pos);
head_pos = requests[i];
}
}
printf("\nTotal number of head movements: %d\n", head_moments);
return 0;
}
Slip25_1
#include <stdio.h>
#include <stdlib.h>
int main() {
int n, head, i, j, temp, total_head_movements = 0;
printf("Enter the total number of disk blocks: ");
scanf("%d", &n);
int disk_queue[n];
printf("Enter the disk request string: ");
for(i = 0; i < n; i++) {
scanf("%d", &disk_queue[i]);
}
printf("Enter the current head position: ");
scanf("%d", &head);
int direction;
printf("Enter the direction (0 for left, 1 for right): ");
scanf("%d", &direction);
for(i = 0; i < n-1; i++) {
for(j = i+1; j < n; j++) {
if(disk_queue[i] > disk_queue[j]) {
temp = disk_queue[i];
disk_queue[i] = disk_queue[j];
disk_queue[j] = temp;}
}
}
int index;
for(i = 0; i < n; i++) {
if(disk_queue[i] >= head) {
index = i;
break;
}
}
if(direction == 0) {
for(i = index-1; i >= 0; i--) {
printf("%d ", disk_queue[i]);
total_head_movements += abs(disk_queue[i] - head);
head = disk_queue[i];
}
for(i = index; i < n; i++) {
printf("%d ", disk_queue[i]);
total_head_movements += abs(disk_queue[i] - head);
head = disk_queue[i];
}
}
else {
for(i = index; i < n; i++) {
printf("%d ", disk_queue[i]);
total_head_movements += abs(disk_queue[i] - head);
head = disk_queue[i];
}
for(i = index-1; i >= 0; i--) {
printf("%d ", disk_queue[i]);
total_head_movements += abs(disk_queue[i] - head);
head = disk_queue[i];
}
}
printf("\nTotal number of head movements: %d", total_head_movements);
return 0;
}
Slip25_2
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define MAX 200

typedef struct dir
{
char fname[20];
int start;
struct dir *next;
}NODE;

NODE *first,*last;

int n,fb,bit[MAX];

void init()
{
int i;

printf("Enter total no.of disk blocks:");
scanf("%d",&n);

fb = n;

for(i=0;i<10;i++)
{
int k = rand()%n;
if(bit[k]!=-2)
{
bit[k]=-2;
fb--;
}
}
}

void show_bitvector()
{
int i;
for(i=0;i<n;i++)
printf("%d ",bit[i]);
printf("\n");
}

void show_dir()
{
NODE *p;
int i;

printf("File\tChain\n");

p = first;
while(p!=NULL)
{
printf("%s\t",p->fname);
i = p->start;
while(i!=-1)
{
printf("%d->",i);
i=bit[i];
}
printf("NULL\n");

p=p->next;
}
}

void create()
{
NODE *p;
char fname[20];
int i,j,nob;

printf("Enter file name:");
scanf("%s",fname);

printf("Enter no.of blocks:");
scanf("%d",&nob);

if(nob>fb)
{
printf("Failed to create file %s\n",fname);
return;
}

for(i=0;i<n;i++)
{
if(bit[i]==0) break;
}

p = (NODE*)malloc(sizeof(NODE));
strcpy(p->fname,fname);
p->start=i;
p->next=NULL;

if(first==NULL)
first=p;
else
last->next=p;

last=p;

fb-=nob;

j=i+1;
nob--;

while(nob>0)
{
if(bit[j]==0)
{
bit[i]=j;
i=j;
nob--;
}
j++;
}

bit[i]=-1;
printf("File %s created successully.\n",fname);
}

void delete()
{
char fname[20];
NODE *p,*q;
int nob=0,i,j;

printf("Enter file name to be deleted:");
scanf("%s",fname);

p = q = first;
while(p!=NULL)
{
if(strcmp(p->fname,fname)==0)
break;

q=p;
p=p->next;
}

if(p==NULL)
{
printf("File %s not found.\n",fname);
return;
}

i = p->start;
while(i!=-1)
{
nob++;
j = i;
i = bit[i];
bit[j] = 0;
}

fb+=nob;

if(p==first)
first=first->next;
else if(p==last)
{
last=q;
last->next=NULL;
}
else
q->next = p->next;

free(p);

printf("File %s deleted successfully.\n",fname);
}

int main()
{
int ch;

init();

while(1)
{
printf("1.Show bit vector\n");
printf("2.Create new file\n");
printf("3.Show directory\n");
printf("4.Delete file\n");
printf("5.Exit\n");
printf("Enter your choice (1-5):");
scanf("%d",&ch);

switch(ch)
{
case 1:
show_bitvector();
break;
case 2:
create();
break;
case 3:
show_dir();
break;
case 4:
delete();
break;
case 5:
exit(0);
}
}

return 0;
}


Post a Comment

0 Comments