All Exams Test series for 1 year @ ₹349 only
Question

To keep track of free blocks in a file system, one of the two approaches is generally used – using bitmaps (bit vectors) or using linked lists. Consider that the linked list approach is used to keep track of free blocks in a file system. Assume that the disk size is 16 GB, block size is 2 KB, and block numbers used are 32-bit long. A single pointer of size 4 bytes is used in each block of the list to point to the next block of the list. The number of blocks required to hold the free disk block numbers is ____________. (answer in integer)

Note: 1K=$2^{10}$ and 1G=$2^{30}$

File System Free Blocks Linked List Calculation

This solution details the calculation for the number of blocks required to manage free disk blocks using a linked list approach in a file system.

Calculating Disk Blocks

First, we determine the total number of blocks on the disk based on the given disk size and block size.

  • Disk Size = 16 GB = $16 \times 2^{30}$ bytes.
  • Block Size = 2 KB = $2 \times 2^{10}$ bytes.
  • Total Number of Blocks ($N$) = $\frac{\text{Disk Size}}{\text{Block Size}} = \frac{16 \times 2^{30}}{2 \times 2^{10}} = 8 \times 2^{20} = 2^3 \times 2^{20} = 2^{23}$ blocks.

Pointers Capacity per Block

Next, we calculate how many pointers (representing block numbers) can fit into a single disk block when it is used as a node in the linked list structure.

  • Block Size = 2 KB = 2048 bytes.
  • Pointer Size = 4 bytes (as block numbers are 32-bit long).
  • Pointers per Block ($P$) = $\lfloor \frac{\text{Block Size}}{\text{Pointer Size}} \rfloor = \lfloor \frac{2048 \text{ bytes}}{4 \text{ bytes}} \rfloor = 512$ pointers.

Free List Storage Blocks

The number of blocks required for the linked list is determined by dividing the total number of blocks ($N$) by the capacity of each block ($P$), rounded up, to ensure all free disk block numbers can be accounted for.

  • Number of Blocks = $\lceil \frac{N}{P} \rceil$.
  • Substituting the values: Number of Blocks = $\lceil \frac{2^{23}}{512} \rceil = \lceil \frac{2^{23}}{2^9} \rceil = \lceil 2^{14} \rceil$.

This calculation determines the minimum number of blocks needed to store the linked list structure for tracking free disk blocks.

Final Answer

The number of blocks required to hold the free disk block numbers is an integer value.

16417

Was this answer helpful?

Important Questions from File System

  1. A mechanism for arranging controlled access to a shared resource, like a file, is called:

  2. Which UNIX/Linux command is used to make all files and sub-directories in the directory “progs” executable by all users?

  3. In Linux operating system environment ________ command is used to print a file.

  4. Consider the following statements :

    (a) UNIX provides three types of permissions

    Read

    Write

    Execute

    (b) UNIX provides three sets of permissions

    permission for owner

    permission for group

    permission for others

    Which of the above statement/s is/are true ?

  5. Match the following WINDOWS system calls and UNIX system calls with reference to process control and File manipulation.

    Windows

    UNIX

    A. Create-process( )

    I. Open( )

    B. WaitForSingleObject( )

    II. Close( )

    C. CreateFile( )

    III. Fork( )

    D. CloseHandle( )

    IV. Wait( )

Need Expert Advice?

Start Your Preparation with Prepp Mobile App

Download the app from Google Play & App Store
Download the app from Google Play & App Store
Prepp Mobile App