Question: Write a program in C++ to simulate managing files on disk. Define the disk as a one-dimensional array disk of size numOfSectors * sizeOfSector, where

Write a program in C++ to simulate managing files on disk. Define the disk as a one-dimensional array disk of size numOfSectors * sizeOfSector, where sizeOfSector indicates the number of characters stored in a one sector. (For the sake of debugging, make it a very small number.) A pool of available sectors is kept in a linked list sectors of three-field structures: two fields to indicate ranges of available sectors and one next field. Files are kept in a linked list files of fours-field structures: file name, the number of characters in the file, a pointer to a linked list of sectors where the contents of the file can be found, and the next field. a) In the first part, implement functions to save and delete files. Saving files requires claiming a sufficient number of sectors from pool, if available, The sectors may not be contiguous, so the linked list assigned to the file may contain several nodes. Then the contents of the file have to be written to the sectors assigned to the file. Deletion of a file only requires removing the nodes corresponding with this file (one from files and the rest from its own linked list of sectors) and transferring the sectors assigned to this file back to pool. No changes are made in disk.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!