Operating Systems Sample Exam Questions1. Describe the two general roles of an operating system, and elaborate why these roles are important.
Using a simple system call as an example (e.g. getpid, or uptime),
describe what is generally involved in providing the result, from the
point of calling the function in the C library to the point where that
3. Why must the operating system be
more careful when accessing input to a system call (or producing the
result) when the data is in memory instead of registers?
4. Is putting security checks in the C library a good or a bad idea? Why?
5. Describe the three state process model, describe what transitions are valid between the three states, and describe an event that might cause such a transition.
Multi-programming (or multi-tasking) enables more than a single process
to apparently execute simultaneously. How is this achieved on a
7. What is a process? What are attributes of a process?
8. What is the function of the ready queue?
9. What is the relationship between threads and processes?
10. Describe how a multi-threaded application can be supported by a user-level threads package. It may be helpful to consider (and draw) the components of such a package, and the function they perform.
11. Name some advantages and disadvantages of user-level threads.
12. Why are user-level threads packages generally cooperatively scheduled?
13. Enumerate the advantages and disadvantages of supporting multi-threaded applications with kernel-level threads.
Describe a sequence the sequence of step that occur when a timer
interrupt occurs that eventually results in a context switch to another
15. Context switching between two threads of
execution within the operating system is usually performed by a small
assembly language function. In general terms, what does this small
function do internally?
16. What is a race condition? Give an example.
17. What is a critical region? How do they relate to controlling access to shared resources?
18. What are three requirements of any solution to the critical sections problem? Why are the requirements needed?
19. Why is turn passing a porr solution to the critical sections problem?
Interrupt disabling and enabling is a common approach to implementing
mutual exclusion, what are its advantages and disadvantages?
What is a test-and-set instruction? How can it be used to implement
mutual exclusion? Consider using a fragment of psuedo-assembly language
aid you explanation.
22. What is the producer consumer problem? Give an example of its occurence in operating systems.
23. A semaphore
is a blocking synchronisation primitive. Describe how they work with
the aid of pseudo-code. You can assume the existance of a
thread_block() and a thread_wakeup() function.
24. Describe how to implement a lock using semaphores.
25. What are monitors and condition variables?
26. What is deadlock? What is startvation? How do they differ from each other?
27. What are the four condtions required for deadlock to occur?
28. Describe four general strategies for dealing with deadlocks.
For single unit resources, we can model resource allocation and
requests as a directed graph connecting processes and resources. Given
such a graph, what is involved in deadlock detection.
30. Is the following system of four processes with 2 resources deadlocked?
Current allocation matrix
Current request matrix
If the availability vector is as below, is the system above still deadlocked?
Is the system deadlocked if the availability is
Assuming the operating system detects the system is deadlocked,
what can the operating system do to recover from deadlock?
32. What must the banker's algorithm know a priori in order to prevent deadlock?
33. Describe the general strategy behind dealock prevention, and give an example of a practical deadlock prevention method.
34. Filesystems can support sparse files, what
does this mean? Give an example of an application's file
organisation that might benefit from a file system's sparse file
35. Give an example of a scenario that might benefit from a file system supporting an append-only access write.
Give a scenario where choosing a large filesystem block size might be a
benefit; give an example where it might be a hinderance.
37. Give an example where contiguous allocation of file blocks on disks can be used in practice.
38. What file access pattern is particularly suited to chained file allocation on disk?
39. What file allocation strategy is most appropriate for random access files?
40. Compare bitmap-based allocation of blocks on disk with a free block list.
How can the block count in an inode differ from the (file size / block
size) rounded up to the nearest integer. Can the block count be
greater, smaller, or both.
42. Why might the direct blocks be stored in the inode itself?
Given that the maximum file size of combination of direct, single
indirection, double indirection, and triple indirection in an
inode-based filesystem is approximately the same as a filesystem soley
using triple indirection, why not simply use only triple indirection to
locate all file blocks?
44. What is the maximum file
size supported by a file system with 16 direct blocks, single, double,
and triple indirection? The block size is 512 bytes. Disk block numbers
can be stored in 4 bytes.
45. The berkely fast filesystem
(and Linux Ext2fs) use the idea of block groups. Describe what this
idea is and what improvements block groups have over the simple
filesystem layout of the System V file system (s5fs).
What is the reference count field in the inode? You should
consider its relationship to directory entries in you answer.
47. The filesystem buffer cache
does both buffering and caching. Describe why buffering is needed.
Describe how buffering can improve performance (potentially to the
detriment of file system robustness). Describe how the caching
component of the buffer cache improves performance.
48. What does flushd do on a UNIX system?
49. Why might filesystems managing external storage devices do write-through caching (avoid buffering writes) even though there is a detrimental affect on performance.
50. Describe the difference between external and internal fragmentation.
Indicate which of the two are most likely to be an issues on a) a
simple memory memory mangement machine using base limit registers and
static partitioning, and b) a similar machine using dynamic
51. List and describe the four memory allocation
algorithms covered in lectures. Which two of the four are more
commonly used in practice?
52. Base-limit MMUs can support swapping. What is swapping? Can swapping permit an application requiring 16M memory to run on a machine with 8M of RAM?
53. Describe page-based virtual memory. You should consider pages, frames, page tables, and Memory Management Units in your answer.
Give some advantages of a system with page-based virtual memory
compared to a simply system with base-limit registers that
55. Describe segmentation-based virtual memory. You
should consider the components of a memory address, the segment table
and its contents, and how the final physical address is formed in your
56. What is a translation look-aside buffer? What is contained in each entry it contains?
57. Some TLBs support address space identifiers (ASIDS), why?
58. Describe a two-level page table? How does it compare to a simple page table array?
59. What is an inverted page table? How does it compare to a two-level page table?
60. What are temporal locality and spatial locality?
61. What is the working set of a process?
62. How does page size of a particular achitecture affect working set size?
63. What is thrashing? How might it be detected? How might one recover from it once detected?
64. Enumerate some pros and cons for increasing the page size.
65. Describe two virtual memory page fetch policies. Which is less common in practice? Why?
What operating system event might we observe and use as input to an
algorithm that decides how many frames an application receives
(i.e. an algorithm that determines the application's resident set size)?
67. Name and describe four page replacement algorithms. Critically compare them with each other.
68. Describe buffering in
the I/O subsystem of an operating system. Give reasons why it is
required, and give a case where it is an advantage, and a case where it
is a disadvantage.
69. Device controllers are generally becoming
more complex in the functionality they provide (e.g. think about the
difference between implementing a serial port with a flip-flop
controlled by the CPU and a multi-gigabit network adapter with the
TCP/IP stack on the card itself). What effect might this have on the
operating system and system performance?
70. Compare I/O based on polling with interrupt-driven I/O. In what situation would you favour one technique over the other?
71. Explain how the producer-consumer problem is relevant to operating system I/O.
72. What is disk interleaving? What problem is it trying to solve?
73. What is cylinder skew? What problem is it trying to solve?
74. Name four disk-arm scheduling algorithms. Outline the basic algorithm for each.
75. What are the three general goals of computer security?
76. Which of the three goals of computer security is the following an attack on:
a) Network snooping
b) A distributed denial of service attack
c) Modifiying your marks in the student records database
Give an example of why it is important to consider the skill and
resources available to likely intruders when designing computer
security mechanisms and policies to defend against those intruders?
You are desigining an authentication mechanism to be used by a
user with a web client to authenticate it to a web server. The
network connection is known to be easily snoopable, but confidentiality
of traffic after authentication is of no concern. What authentication
protocol covered in lectures would be most appropriate and why.
79. Describe what a buffer overrun attack is.
80. What is the principle of least privilege?
Why is the setuid root facility in UNIX generally a violation of the
principle? Give an illustrative example of that violation.
Running active web content in a web browser securely is a difficult
problem. JAVA (with its controlled interpretation of the downloaded
code) is one approach to the problem, ActiveX with its digitally signed
code to guarantee authenticity is another approach. Give an advantage
and a disadvantage of each approach.
82. What is the difference between mandatory access control and discretionary access control?
83. What are access control lists and capabilties, and how do they relate to the protection matrix model of representing authority in a system.
Explain how it is easier to apply the principle of least privilege in a
capability-based system compared to an access-control-list-based system.
85. What is a trusted computing base?
The Bell-La Padula Multilevel security policy is a security policy
designed to keep secret information secret. Describe the model
including the properties that must be guaranteed for secrecy to be
87. What is a covert channel?
88. Which of RAID 1 or RAID 5 would you use in the following scenarios and why:
a) A transaction database that performs many thousands of updates per second.
b) A web server that serves almost entirely static web content.
Compare RAID 0, RAID 1, and RAID 5 in terms of performance improvement,
ability to withstand failure, and space overhead require to implement
the particular RAID level.
90. Why is it generally correct to favour I/O bound processes over CPU-bound processes?
91. What is the difference between preemptive scheduling and non-preemptive scheduling? What is the issue with the latter?
92. Given an initial set of batch jobs, show that shortest job first minimises average turn-around time.
93. Describe round robin scheduling. What is the parameter associated with the scheduler? What is the issue in chosing the parameter?
The traditional UNIX scheduler is a priority-based round robin
scheduler (also called a multi-level round robin schduler). How does
the scheduler go about favouring I/O bound jobs over long-running
95. In a lottery scheduler with 40 tickets. How
how I distribute the tickets amongst 4 processes (A, B, C, D) such that
each process gets 10%, 5%, 60%, and 25% respectively?
96. What is the problem that a fair share scheduler strives to address?
97. In a real-time system with a periodic task set,, how are priorities assigned to each of the periodic tasks?
98. What is an EDF scheduler? What is its advantage over a rate monotic scheduler?
Describe why the use of spinlocks might be more appropriate
than blocking locks on a multiprocessor when compared to a
uniprocessor. Is there a trade-off between spinning and blocking on a
100. Is a single ready queue on a multiprocessor a good idea? Why?
101. What is thread afinity. Why might it improve performance?