(e) Assume that a disk has 32 tracks, with each track having 16 sectors and each sector is of size 512 Kilobytes. The cluster size in this system can be assumed to be as 2 sectors. A file having the name mcs012.txt is of size 16 MB. Assume that it is a new disk, and the first 8 clusters are occupied by the Operating System. Rest all the clusters are free. How can this file be allotted space on this disk? Also, show the content of FAT after the space allocation to this file. You may make suitable assumptions.

, , No Comments

To allot space for the file "mcs012.txt" on the disk with a specific file allocation table (FAT) structure, let's follow these steps:


Disk Information:

- Tracks: 32

- Sectors per Track: 16

- Sector Size: 512 Kilobytes

- Cluster Size: 2 sectors

- File Size: 16 Megabytes

- First 8 Clusters Reserved for OS


Steps:


1. Calculate Cluster Size in Bytes:

   - Cluster Size = 2 sectors * 512 Kilobytes = 1 Megabyte


2. Calculate Total Number of Clusters on Disk:

   - Total Clusters = Total Sectors / Sectors per Cluster

   - Total Sectors = Tracks * Sectors per Track

   - Total Clusters = 32 * 16 / 2 = 256 Clusters


3. Calculate File Size in Clusters:

   - File Size in Clusters = File Size / Cluster Size

   - File Size = 16 Megabytes = 16 * 1024 Kilobytes = 16 * 1024 * 1024 Bytes

   - File Size in Clusters = 16 * 1024 * 1024 / 1 Megabyte = 16 Clusters


4. Allocate Clusters for the File:

   - Start allocating clusters from the first free cluster after the OS clusters.

   - Let's assume the file starts from Cluster 9.


5. Update File Allocation Table (FAT):

   - Update the FAT entries corresponding to the allocated clusters.

   - Mark the last cluster with an end-of-file indicator.


 Content of FAT:


Assuming the file starts from Cluster 9, the FAT entries would be updated as follows:


- Cluster 9: Next Cluster = 10

- Cluster 10: Next Cluster = 11

- ...

- Cluster 23: Next Cluster = 255 (End of File)


This means that the clusters from 9 to 23 are allocated for the file "mcs012.txt," and the last cluster (23) indicates the end of the file.


Please note that FAT entries are typically represented in hexadecimal format, and the numbers mentioned above are for illustrative purposes. The actual FAT entries would involve hexadecimal values indicating cluster numbers. The specific details may vary based on the actual FAT implementation. 

0 टिप्पणियाँ:

Post a Comment