Professional Documents
Culture Documents
Aim :
Problem Statement :
File allocation methods are different ways by which the operating system stores information in
File Allocation Strategies. Memory blocks, thus allowing the hard drive to be utilized effectively and the
file to be accessed.
Problem Analysis :
2. Get the number of processes & values of block size for each process
3. First fit algorithm searches all the entire memory block until a hole which is big enough
encountered.
4. Worst fit algorithm searches memory of largest blocks And allocates it to the process
Pseudo code :
1.void main()
2. {
Clrscr();
For(i=0;i<50;i++)
F[i]=0;
X: count=0;
Scanf(“%d%d”, &st,&len);
Program :
#include<conio.h>
Void main()
{
Int f[50], I, st, len, j, c, k, count = 0;
Clrscr();
For(i=0;i<50;i++)
F[i]=0;
X: count=0;
Scanf(“%d%d”, &st,&len);
For(k=st;k<(st+len);k++)
If(f[k]==0)
Count++;
If(len==count)
For(j=st;j<(st+len);j++)
If(f[j]==0)
F[j]=1;
Printf(“%d\t%d\n”,j,f[j]);
If(j!=(st+len-1))
Else
Scanf(“%d”, &c);
If(c==1)
Goto x;
Else
Exit();
Getch();
Output:
14 1
15 1
16 1
Test cases :
Findings :
1. Growing file problem may occur, initial space allocated may be sufficient but the file size may grow
over time
2. For large size blocks, allocation may get difficult as contiguous blocks may be scarce in the memory.