0% found this document useful (0 votes)
32 views4 pages

19bcs2848 RTS-1.3

The document discusses sequential file allocation. It describes sequential file allocation as storing records one after another physically and logically. It also briefly describes linked and indexed file allocation methods. The implementation section provides steps to write a program to implement sequential file allocation including getting memory partition sizes, process details, using first, best and worst fit algorithms to allocate memory and analyzing the results.

Uploaded by

19bcs2856
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views4 pages

19bcs2848 RTS-1.3

The document discusses sequential file allocation. It describes sequential file allocation as storing records one after another physically and logically. It also briefly describes linked and indexed file allocation methods. The implementation section provides steps to write a program to implement sequential file allocation including getting memory partition sizes, process details, using first, best and worst fit algorithms to allocate memory and analyzing the results.

Uploaded by

19bcs2856
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Course Name: Real Time System Lab Course Code: CSP-457

Experiment:1.3

Aim: Write a Program to implement Sequential File Allocation method.

Software Required: Dev C++

Description: A file is a collection of data, usually stored on disk. As a logical entity, a file
enables to divide data into meaningful groups. As a physical entity, a file should be
considered in terms of its organization. The term "file organization" refers to the way in
which data is stored in a file and, consequently, the method(s) by which it can be accessed.

1.3.1 Sequential File Allocation: In this file organization, the records of the file are stored
one after another both physically and logically. That is, record with sequence number 16 is
located just after the 15th record. A record of a sequential file can only be accessed by
reading all the previous records.

1.3.2 Linked File Allocation: With linked allocation, each file is a linked list of disk
blocks; the disk blocks may be scattered anywhere on the disk. The directory contains a
pointer to the first and last blocks of the file. Each block contains a pointer to the next block.

1.3.3 Indexed File ALLOCATION: Indexed file allocation strategy brings all the pointers
together into one location: an index block. Each file has its own index block, which is an
array of disk-block addresses. The ith entry in the index block points to the ith block of the

Name: Shubham Bharti UID: 19BCS2848


file. The directory contains the address of the index block. To find and read the ith block, the
pointer in the ith index-block entry is used.

Course Name: Real Time System Lab Course Code: CSP-457 STEPS:
1. Start the program.
2. Get the number of memory partition and their sizes.
3. Get the number of processes and values of block size for each process.
4. First fit algorithm searches all the entire memory block until a hole which is big enough is
encountered.
5. It allocates that memory block for the requesting process.
6. Best-fit algorithm searches the memory blocks for the smallest hole which can be
allocated to requesting process and allocates it.
7. Worst fit algorithm searches the memory blocks for the largest hole and allocates it to the
process.
8. Analyses all the three memory management techniques and display the best algorithm
which utilizes the memory resources effectively and efficiently.
9. Stop the program.

Implementation:
#include <stdio.h>
#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;
printf("Files Allocated are : \n"); x: count=0;
printf(“Enter starting block and length of files: ”);
scanf("%d%d", &st,&len); for(k=st;k<(st+len);k++)

Name: Shubham Bharti UID: 19BCS2848


Course Name: Real Time System Lab Course Code: CSP-457 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))
printf(” The file is allocated to disk\n");
} else printf(” The file is not allocated
\n");
printf("Do you want to enter more file(Yes - 1/No - 0)"); scanf("%d", &c);
if(c==1) goto x; else exit(); getch(); }

Output:

Course Name: Real Time System Lab Course Code: CSP-457

Name: Shubham Bharti UID: 19BCS2848


Name: Shubham Bharti UID: 19BCS2848

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy