File Management


File allocation algorithms (contiguous, chained, indexed)

  • File system resides on secondary storage (disks)
  • File system divides disks into several blocks of sectors (usually 512 bytes)
  • An allocation method refers to how disk blocks are allocated for files:
    • ContiguousContiguouswe only store at what block number and its length great for sequential and random Screenshot 2025-01-01 at 10.47.54 AM.png Explanation: * a disk is divided into 31 blocks * count file starts from block 0 and its length is 2 so it occupies block 0 and block 1 (where the blocks that we use to store a file is ordered)
    • LinkedLinked* There are 1-2 bytes that is used to store pointers to the next block * Each file is a linked list of disk blocks: blocks may be scattered anywhere on the disk * We store start and end blocks good for sequential, not random if the block contains a pointer, usually need more than one blocks to store the file unless the size of the file \< size of the block Screenshot 2025-01-01 at 11.09.15 AM.png (where one block is not entirely used to store data but pointers as well)
    • IndexedIndexed* Each file has its own index block(s) of pointers to its data blocks more complex Pasted image 20250101112138.png (where there is one block that stores the pointers to the data blocks)

Extra info:

  • Pros and cons of each allocation methodPros and cons of each allocation methodDescribe the 3 file allocation method including its advantages and disadvantages File allocation methods are crucial for managing how files are stored and accessed on secondary storage. Three common file allocation methods are contiguous allocation, chained allocation, and indexed allocation, each with distinct advantages and disadvantages. Contiguous allocation involves assigning a single continuous block of space for a file at the time of its creation. This method provides high performance f
  • Use cases of each allocation method?
  • Linked Free Space List on DiskLinked Free Space List on DiskThere is a list that stores blocks that are empty

Practice:

Answer:

  • 2019-1
    • a. 1023 + 1023 + 2 (pointer) => 3 Blocks
    • b. 1, 2, 3
    • c. 4, 5, 6, 7, 8, 9, 10, 11

Status: #idea
Tags: operating-systems > Final Exam MaterialsOperating Systems NotesDownloadMoreRAM.com - CloudRAM 2.0 study from the book bruh Mid Exam Materials Microprocessor µLinux vs Linux PThread Multilevel Scheduling: Round Robin & FCFS Computer Components Interrupts Process States Application Process Deeply Embedded Systems My OS Mid Exam Prep Notion Other people's notes: * Norberth's Notes * https://www.notion.so/Operation-System-12b1620f860e80cdb47aff5eb21febb8?pvs=21 * https://www.notion.so/f97c874f97bc48ab9944243d4380d3bd?pvs=21 * https://www.notion.


References

https://youtu.be/PBkZynNIZWk?list=PLBXapj649rh9UKCBfJEyEUN5Ulvfq1s96&t=2176