Posts

Showing posts from July, 2024

Operating Systems Lab Cycle - V Programs

  Cycle-5: Simulate all File Organization techniques --------------------------------------------------------------------------- a)    Write a C program to simulate Single Level Directory file Organization technique Aim: To write a C program for simulating Single level Directory file Organization technique Program: #include<stdio.h> //#include<conio.h> #include<string.h> void main() { int nf=0,i=0,j=0,ch; char mdname[10],fname[10][10],name[10]; //clrscr(); printf("Enter the directory name:"); scanf("%s",mdname); printf("Enter the number of files:"); scanf("%d",&nf); do { printf("Enter file name to be created:"); scanf("%s",name); for(i=0;i<nf;i++) { if(!strcmp(name,fname[i])) break; } if(i==nf) { strcpy(fname[j++],name); nf++; } else printf("There is already %s\n",name); printf("Do you want to enter another file(yes - 1 or no - 0):"); scanf("%d",&ch); } whil...

Operating Systems Lab Cycle -III Programs

  Cycle-3: Simulate the file allocation strategies -------------------------------------------------------------------------------- a)Write a c program for simulating the Sequential File Allocation algorithm   Aim: To write a c program to simulate Sequential File Allocation Strategy Program: #include<stdio.h> #include<conio.h> void main() {   int memory[25];   int i,len,startaddr,flag,endaddr,name;   for(i=0;i<25;i++)   {      memory[i]=0;      printf("%d",memory[i]);   }   printf("\n Enter file name(0 to quit):");   scanf("%d",&name);   while(name!=0)   {      printf("\n Enter length of file:");      scanf("%d",&len);      printf("\n enter starting location of the file :");      scanf("%d",&startaddr);      endaddr=sta...