What does the logical file system represent?
- Abstract interface as presented to the user
What are system calls?
- They provide a means to switch from user to protected mode
When a file is accessed using a 'read' system call, which is not true?
- File already opened by that process
- File control block updated
- File contents updated <<
- File read position incremented
How do directories support duplicated name for files?
- Each directory can have a file of the same name
Which of these statements is not true of a formatted partition?
- It is known as a volume
- It must contain the Operating System <<
- It can span multiple physical devices
- It must contain a directory table or table of contents
How should we allocate space for files?
- Reserve a continuous block on creation
- Find a space, fill it, find the next space
- Make a table where each segment points to the next segment
When tracking free space, what is the most simple method?
- Bit table
What is not true of a Unix inode?
- A list of all inodes is stored in main memory <<
- More than one file name can be associated with an inode
- Inode contains pointers to file blocks
- There is one-to-one mapping between inodes and files
How is recoverability in NTFS achieved?
- It uses a transaction-based approach to significant updates
- The critical file system data is duplicated
Processes and Threads
What is the purpose of the control block?
- It is used to load and store state when changing CPU state
- It also has information like permissions and where it is stored on disk
A new process is placed in "New" state rather than "Ready" or "Running". Why?
- The Operating System limits how many processes can be admitted at once
Which is not a means of process creation?
- Storing information to disk <<
- Operating system service
- User log on
- Created by another process
Which is not true of a suspended process?
- The process is not immediately available for execution
- The process must be waiting on an event <<
- The suspension could be caused by the parent process
- The process must be explicitly removed from this state
Why does the process control block need to store register values?
- When the process leaves the CPU the values could change
What do threads share with their parent process?
- Code, data, and files
Which is the best strategy, deadlock prevention or avoidance? It depends on the situation, deadlock is mostly handled by programs not the operating system. To prevent circular wait - have a strict order on resources and request lowest priority first.
What is deadlock?
- Processes are waiting for resources but none can proceed. Circular wait is the defining condition (along with mutual exclusion, hold and wait, and no pre-emption)
What does hold and wait mean in the context of concurrent programming?
- A process will not release a resource until it is not needed
What does pre-emption mean?
- Pre-emption is where the operating system stops or pauses a process in favour of one with higher priority
Which of these classic concurrency problems do not have the possibility of deadlock?
- Dining philosophers
- Readers and writers (in a simple case - no deadlock, it needs multiple read and write)
- Producer and consumer <<
- Single lane bridge
Which of the 4 conditions for deadlock can't be prevented?
- Mutual exclusion <<
- Hold and wait
- No pre-emption
- Circular wait
How do you prevent hold and wait?
- Force a process to request all resources at once. (Process being forced to release held resources when one is denied is pre-emption)
Which best describes the pros and cons of deadlock prevention?
- Pros - several alternative approaches. No need to know the maximum resource utilisation
- Cons - underutilisation of resources. Some approaches have significant computational overheads
How can you prevent hold and wait from occurring in order to prevent deadlock?
- Force a process to acquire all the locks needed for a critical section at the start of the section and do not enter the critical section without obtaining all
Which of the four conditions for deadlock cannot be prevented and why?
- Mutual exclusion because you have to be able to guarantee exclusive access to some types of measures
How often should you check for deadlocks?
- It is a balance between the cost of running the detection algorithm, the likelihood of deadlock occurring and the cost of recovery from deadlock
Say you have a situation in which a deadlock has been detected. Ten different processes have been identified as being involved in the deadlock. What are the problems with trying to recover from deadlock by killing processes?
- Depending how long it has been between the deadlock state arising and the detection, there may be more than one circular wait
- You cannot indiscriminately kill processes, some of them may be critical
- It is difficult to identify the process(es) that should be killed
How do you detect deadlock?
- Look for circular wait situations
Which best describes the pros and cons of deadlock detection and recovery?
- Pro - best use of resources
- Con - computational overhead and requires a means of rollback
- Time to complete the process vs the time it has been waiting
What is the goal of short term scheduling?
- To control which process is using the CPU
- Medium term scheduling is memory management
Why might you prefer short quanta for Round Robin scheduling?
- Short processes don't have too long to wait to finish
What is the problem with frequent pre-emption?
- Every context switch takes time
What is the principle of exponent averaging?
- Recent history is better than long ago history
Which is not relevant to multi-processor / core scheduling?
- Processor assignment
- User control <<
- Processor scheduling
What is the benefit of gang scheduling of threads?
- Less chance of synchronisation blocking
Why should multi-core schedulers consider cache associations?
- Processes with shared resources should share cache, and processes with cache conflicts shouldn't share cache
- Round Robin - write down what the queue looks like at each interrupt. Process A joins the back of the queue, perhaps before C arrives
What are the key differences between static and real-time scheduling?
- Static analysis creates a schedule or assigns priorities before the system runs. Dynamic approaches either perform run-time feasibility or perform best effort scheduling at run time (meeting deadlines as much as possible)
Which scheduling policy risks starvation for longer processes, so long as there is a steady supply of shorter processes?
- Shortest Job First (SJF)
What is fail-safe operation in the context of real-time scheduling?
- A system should continue running with degraded performance rather than halt
The following are all criteria by which scheduling algorithms are judged. Which of them is not a system-oriented scheduling criteria?
- Balancing of resources
- Processor utilisation
- Response time <<
Which of the following is not a user-oriented criterion for scheduling?
- Response time
- Turnaround time
- Throughput <<
Why could arranging scheduling such that processes were scheduled on the same processor each time, rather than any available processor, lead to an improvement in performance on a multi-processor system?
- Because the memory locations used by a process may remain in the cache between context switches
Why should resource contention be considered when scheduling on multi-core systems where cores share caches?
- Because if two threads sharing a cache are accessing different memory locations, they will be competing for cache resources
Why do service-based scheduling algorithms require estimation?
- Because they do not know in advance the service time for a process
What is the underlying problem with concurrent programming?
- The changes made by one thread can impact upon all others
Why are software solutions provided when there are hardware solutions that can solve the CSP?
- Software solutions provide a higher lever of abstraction
What is a mutex lock?
- A special variable with two methods, acquire() and release(). It usually employs busy waiting if a process ot thread tries to acquire the lock while another process or thread holds it
Why is interrupt disabling not a general solution to the critical section problem?
- Because it only works for uni-processor systems. On such a system, interrupts can be disabled to allow a sequence of instructions to execute as a single atomic action. For a multi-processor or multi-core system, interrupts would have to be disabled and every other processor/core prevented from executing during this period. Even if this were possible, it would lead to considerable inefficiency, as most processors would be likely to be executing completely independent code, and so be unnecessarily prevented from executing.
Which classic synchronisation problem will never suffer from deadlock or starvation?
- Producer and consumer
Which of these statements is true of semaphores?
- They are special integer variables with only three permitted operations: init(), wait() and signal()
What is the difference between a strong and a weak semaphore?
- With a strong semaphore, when a process is blocked it is put on a FIFO queue. For a weak semaphore, there is no guarantee when the process will become unblocked.
What is an atomic action?
- A section of code which is executed as a single instruction, all or nothing.
Which of these statements describes a monitor?
- A monitor is a high-level programming construct that encapsulates data so that only one thread or process may access it at any one time.
Why is protection a key function of the OS with respect to memory management?
- Open memory access can corrupt other processes
Why would you use static linking?
- To run the program on a platform without shared libraries
What sort of fragmentation do you get with dynamic fragmentation?
- External fragmentation because of gaps between processes
With 2MNB (2048KB) available memory how much would a 100KB program use in a buddy system?
How does segmentation relate to partitioning?
- Segments are like dynamic partitions
What is TLB?
- Fast associative memory to speed up page / frame mapping (Translation Lookaside Buffer)
Why is memory access about twice as slow with paging?
- You need two accesses
If you have 8 bit addresses + 3 bits for the segment number, what is the maximum segment size?
- 32 bytes (25)
What is the difference between fixed and dynamic partitioning?
- With fixed partitioning the operating system divides the memory into fixed-sized blocks. When a process is admitted, the operating system must find a partition large enough to accommodate it. With dynamic partitioning the operating system creates a partition for a process when it is admitted, making it exactly the size to accommodate the process.
What is the effective access time (EAT)?
- It is an estimation of the time required to access a memory location, given the various memory and secondary storage access times that might be required
What is paging in the context of memory management?
- It is the process of breaking memory into fixed-sized blocks, and processes into equivalent-sized blocks, then mapping them.
What hardware is needed to support paging?
- A page table is needed. The address is broken into the page number and offset, with the page number being used to look up the frame number in the page table. The address is then located by finding the corresponding frame for that page in the table, then using the offset to get the memory location within the frame.
What is swapping in the context of memory management?
- Swapping involves saving a running process to secondary storage, allowing that process's memory to be freed up fro use by other processes, and also restoring a process which has been saved in this way to main memory so that it can run.
What causes "thrashing" (when a process has to continually swap pages in and out of memory)?
- Too few frames allocated to the process(es)
What is the frame allocation problem?
- It is the problem of how many frames to allocate to each process
What is the purpose of the working set model?
- To determine if sufficient frames are allocated per process(es)
Why are inverted page tables sometimes used with demand paging?
- An inverted page table guarantees a fixed size data structure, but a regular page table would vary in size and might get too large
What is segmentation in the context of memory management?
- It is the process of breaking a process into its logical components, such as data and functions, and allocating memory for each of these components in separate blocks
How are base and limit registers used for memory management?
- The bounds of a logical memory reference are checked to make sure it does not exceed the limit, then base value is added to the logical value to get the physical address
What additional hardware is required to support segmentation?
- There must be a segment table. The values in this table are used to check and map logical addresses for each segment comparators and adders
Virtual Memory Management
What is demand paging?
- Not all pages of a process are loaded into memory at once
- Lazy demand paging - only loaded when accessed - slow and inefficient
What is a page fault?
- An interrupt caused by an attempt to access unloaded memory
Why does virtual paging increase effective access time?
- Two secondary accesses can be needed on a page fault
Why combine virtual paging and segmentation?
- Segmentation allows easier shared libraries
What is the purpose of page replacement algorithm?
- To decide which page should be swapped out if there is no free frame
Why is the optimal page replacement algorithm impossible to implement?
- No way of knowing which page should be swapped out
Why is local frame replacement likely to underutilise memory?
- Some processes won't need as many frames as allocated
Why can too many admitted processes lead to thrashing?
- Too few frames per process
Virtual memory allows a higher degree of multi-programming than a system without it. Why is this an advantage?
- There s more likelihood that when a process leaves the CPU another process will be in the ready state so be able to use it immediately
If you are using virtual memory with paging, what happens if a page fault arises due to not being found in main memory?
- If no free frame is available, another page is swapped out to accommodate the newly-loaded page. Once the page is loaded, the process that caused the page fault is returned to the ready queue.
What is Belady's anomaly?
- With first-in-first-out page replacement, sometimes an increase in frames for the process will lead to a higher number of page faults
Why is local page replacement more likely to underutilise memory than a global replacement policy?
- Because with a local policy, a process might be allocated more memory than it actually needs, but there is no mechanism to reallocate that excess to another process.
Which I/O device has the fastest transfer rate?
- Main memory - not an I/O device
- Gigabit Ethernet <<
What is the problem with devices with a very fast transfer rate?
- Data may be sent from the device faster than it can be handled
What is the purpose of buffering in I/O management?
- To ensure data is available when it is needed
- To avoid waiting for slow devices
- To handle bursts of activity to / from devices
- To smooth out peaks in I/O load
What is the difference between block and stream oriented buffers?
- Blocks have a fixed size but streams can be variable
What is the advantage of a circular buffer over a single buffer?
- It can handle larger bursts of data
Why are magnetic tapes still used as secondary storage?
- They provide cheap large scale storage
The queue item closest to the disk head is serviced next. Which algorithm is this?
- Shortest Seek Time First
What is the difference between SCAN and C-SCAN or LOOK and C-LOOK?
- The head only reads while travelling in one direction in the C versions
How does buffering improve I/O performance?
- By smoothing out the peaks in I/O demand
When a blocking I/O request is made by a process using interrupt-driven I/O, what happens to the processor?
- The requesting process is moved to a blocked state, freeing the processor for other processes
Why is I/O such a bottleneck in system performance?
- Because there are a high variety of I/O device types, many of which are slow
What is the advantage of a circular buffer over a large single buffer for stream-oriented I/O?
- There is no advantage, a single buffer of n entries is equivalent to a circular buffer with n single entries
What is the most significant problem with the shortest seek time first (SSTF) hard disk scheduling algorithm?
- Some I/O requests can suffer from starvation
C-SCAN and C-LOOK hard disk scheduling algorithms only read/write data while the disk heads are travelling in one direction. Why is this?
- It is more fair. If data is read/written in both directions, central disk locations are more favoured than those near the edges
How does OS design deal with the large range of I/O devices that must be supported?
- The I/O subsystem is implemented in a layered approach, with common layers at the top, and increasing levels of specialisation below.
Which is not an objective of OS security?
- Reliability <<
How to detect / prevent unauthorised disclosure?
- Good logging and log analysis
What is false positive when it comes to authentication?
- Authentication accepted when it shouldn't be (biometric is the most common)
Why is it better to never install unnecessary packages then remove them at a later date?
- Residual supporting packages might not be removed
Which is not a good reason for installing an intrusion detection system?
- To quickly quarantine attacks
- To stop users downloading malware
- To deter attackers
- To gain a better picture of intruder behaviour
Which is not an anti-virus approach to malware defence?
- Rootkit countermeasures
- Generic decryption <<
- Behaviour blocking system
- Digital immune system