|
-
April 5th, 2009, 03:36 AM
#1
write a program to simulate managing files on disk
Hal lo,
How to write a program 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 one sector. A pool of available sectors is kept in a linked list sectors of three-field structures: two fields to indicate range of available sectors and one next field. Files are kept in a linked list files of four-field structures: file name,the number of characters in the file, reference to a linked list of sectors where the contents of the file can be found, and the next field.
In the first part, implement methods 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.
If some one know how to do this please help me. Thank you
<Data Structures And Algorithms in Java By Adam Drozdek page 125>
Last edited by Dhac; April 5th, 2009 at 03:53 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|