PRACTICE SET
Operating Systems Practice Set 4
Unit 4 · File Systems and Disk Scheduling
Time: 45 MinutesTotal Marks: 25
Note: Answer all questions. Write your own answer first, then compare it with the answer given below each question.
SECTION A
1.Answer all questions in brief. 2 × 5 = 10| Q.No | Questions | Marks |
|---|
| (a) | What is a file? List four file attributes. | 2 | | Answer A file is a named collection of related information stored on secondary storage. Attributes: name, identifier, type, location, size, protection (permissions), and time and date of creation and last use. | | (b) | Compare contiguous and linked allocation. | 2 | | Answer Contiguous allocation gives a file a run of adjacent blocks: fast sequential and direct access, but it suffers external fragmentation and a file is hard to grow. Linked allocation chains a file's blocks with pointers: no external fragmentation and easy growth, but only sequential access is efficient and each block loses space to a pointer. | | (c) | What is an inode? | 2 | | Answer An inode is the UNIX data structure that describes a file: owner, permissions, size, timestamps, link count and the addresses of its data blocks (12 direct pointers plus single, double and triple indirect pointers). The file's name is kept in the directory, not in the inode. | | (d) | Differentiate between seek time and rotational latency. | 2 | | Answer Seek time is the time to move the disk arm to the cylinder that holds the data. Rotational latency is the further time for the required sector to rotate under the head. Disk scheduling algorithms try to reduce total seek time. | | (e) | Differentiate between RAID 0 and RAID 1. | 2 | | Answer RAID 0 stripes data across disks for speed and offers no redundancy: losing one disk loses the data. RAID 1 mirrors every block on two disks: it survives one disk failure but uses twice the storage. |
SECTION B
2.Answer all questions. 5 × 3 = 15| Q.No | Questions | Marks |
|---|
| (a) | A UNIX inode has 12 direct pointers and one single, one double and one triple indirect pointer. Blocks are 4 KB and a block pointer is 4 bytes. How much data can be reached through each kind of pointer? | 5 | | Answer Pointers per block = 4 KB ÷ 4 bytes = 1024. Direct: 12 × 4 KB = 48 KB. Single indirect: 1024 × 4 KB = 4 MB. Double indirect: 1024 × 1024 × 4 KB = 4 GB. Triple indirect: 1024 × 1024 × 1024 × 4 KB = 4 TB. Maximum file size ≈ 48 KB + 4 MB + 4 GB + 4 TB, about 4 TB. | | (b) | The disk queue holds requests for cylinders 98, 183, 37, 122, 14, 124, 65, 67 and the head is at cylinder 53 (cylinders 0–199). Find the total head movement for FCFS, SSTF, SCAN (moving towards 0) and LOOK (moving towards 0). | 5 | | Answer FCFS: 53→98→183→37→122→14→124→65→67 = 45 + 85 + 146 + 85 + 108 + 110 + 59 + 2 = 640 cylinders. SSTF: 53→65→67→37→14→98→122→124→183 = 12 + 2 + 30 + 23 + 84 + 24 + 2 + 59 = 236 cylinders. SCAN (towards 0): 53→37→14→0, then 65→67→98→122→124→183 = 53 + 183 = 236 cylinders. LOOK (towards 0): 53→37→14, then 65→67→98→122→124→183 = 39 + 169 = 208 cylinders. LOOK gives the least movement here because the arm turns at the last request instead of travelling to cylinder 0. | | (c) | Explain single-level, two-level and tree-structured directories. | 5 | | Answer Single-level: all files of all users are in one directory. Simple, but every name must be unique and there is no grouping. Two-level: each user has a User File Directory under a Master File Directory. Users are isolated and may reuse names, but they cannot group their own files or easily share files. Tree-structured: directories may contain files and subdirectories to any depth. Each file has an absolute path from the root and a relative path from the current directory. It allows grouping and efficient search; sharing a file between directories needs links, which leads to acyclic-graph directories. |
|