[Solved] UCS1411 Exercise 11-File Allocation Techniques

$25

File Name: UCS1411_Exercise_11_File_Allocation_Techniques.zip
File Size: 433.32 KB

SKU: [Solved] UCS1411 Exercise 11-File Allocation Techniques Category: Tag:
5/5 - (1 vote)

To develop a C program to implement the various file allocation techniques.

Algorithm:

  1. Get Main memory size and block size as input.
  2. Create a Main memory with n number of blocks of equal size.
  3. Main memory is maintained as Linked List with structure containing block id, Free / Filename, Link to next Memory block , Link to Next File block (only for Linked Allocation), File block table( integer array to hold block numbers only for Indexed Allocation)
  4. Get the number of files and their size as input.
  5. Calculate the no. of blocks needed for each file.
  6. Select the Allocation Algorithm.

For every algorithm display Directory information and File information.

  1. For Contiguous Allocation For each file do the following
    1. Generate a random number between 1 to n
    2. Check for continuous number of needed file free blocks starting from that random block no. If free then allot that file in those continuous blocks and update the directory structure.
    3. else repeat step 1
    4. If no continuous blocks are free then no enough memory error
    5. The Directory Structure should contain Filename, Starting Block, length (no. of blocks)
  2. For Linked Allocation- For each file do the following
    1. Generate a random number between 1 to n blocks.
    2. Check that block is free or not.
  • If free then allot it for file. Repeat step 1 to 3 for the needed number of blocks for file and create linked list in Main memory using the field Link to Next File block. Update the Directory entry which contains Filename, Start block number, Ending Block Number.
  1. Display the file blocks starting from start block number in Directory upto ending block number by traversing the Main memory Linked list using the field Link to Next File block.

20.For Indexed Allocation For each file do the following

  1. Generate a random number between 1 to n blocks for index block.
  2. Check if it is free else repeat index block selection
  • Generate needed number of free blocks in random order for the file and store those block numbers in index block as array in File block table array. Display the Directory structure which contains the filename and index blocknumber. Display the File Details by showing the index block numbers File Block Table.

SAMPLE INPUT & OUTPUT:

Main Memory size: 500

Size of each block in the disk: 10 KB

Number of files to be allocated: 5

Name of the File1: ****

Size of the file1: ****

FILE ALLOCATION TECHNIQUES

  1. Contiguous
  2. Linked
  3. Indexed

Choose the Allocation scheme: 1

CONTIGUOUS ALLOCATION

Directory

File Name Start length

***** *** ***

***** *** ***

***** *** ***

Choose the Allocation scheme: 2

LINKED ALLOCATION

Directory

File Name Start End

***** *** ***

***** *** ***

***** *** ***

Individual File listing

File name Data-block 1 Data-block j Data-block k Data-block l Data-block final

Choose the Allocation scheme: 3

INDEXED ALLOCATION

Directory

File Name Indexed Block

***** ***

***** ***

***** ***

Display the Index table for all the files in the following manner

File Name Block Indexed

*** Data-block 1 Data-block j

Data-block k

Data-block l

Data-block final

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] UCS1411 Exercise 11-File Allocation Techniques[Solved] UCS1411 Exercise 11-File Allocation Techniques
$25