Tutorial Week 7
Q1: Answer the following questions about the tables.
- Compute what each process still might request and display in the columns labeled "still needs".
- Is the system in a safe or unsafe state? Why?
- Is the system deadlocked? Why or why not?
- Which processes, if any, are or may become deadlocked?
- Assume a request from p3 arrives for (0,1,0,0)
- Can the request be safely granted immediately?
- In what state (deadlocked, safe, unsafe) would immediately granting the request leave the system?
- Which processes, if any, are or may become deadlocked if the request is granted immediately?
|current allocation||maximum demand||still needs|
Files and file systems
Q2: The Unix inode structure contains a reference count. What is the reference count for? Why can't we just remove the inode without checking the reference count when a file is deleted?
Q3: Inode-based filesystems typically use block groups. Each block group consists of a number of contiguous physical disk blocks. Inodes for a given block group are stored in the same physical location as the block groups. What are the advantages of this scheme? Are they any disadvantages?
Q4: Assume an inode with 10 direct blocks, as well as single, double and triple indirect block pointers. Taking into account creation and accounting of the indirect blocks themselves, what is the largest possible number of block reads and writes in order to:
- Read 1 byte
- Write 1 byte
Assume the inode is cached in memory.
Q5: On Unix systems, the open syscall supports a number of flags. Look at the man page for open to discover what these flags do, and then explain why they might be used:
- O_RDONLY, O_WRONLY, O_RDWR
Q6: Most operating systems require opening a file before using it. Why do they require this? What are the consequences of designing a system that doesn't require a file to be opened before it is used?