CPSC 457 Operating Systems Final Exam Solution
CPSC 457 Operating Systems Final Exam Solution
CPSC 457 Operating Systems Final Exam Solution
OPERATING SYSTEMS
FINAL EXAM SOLUTION
Department of Computer Science
University of Calgary
Professor: Carey Williamson
December 10, 2008
This is a CLOSED BOOK exam. Textbooks, notes, laptops, calculators, personal digital
assistants, cell phones, and Internet access are NOT allowed.
It is a 120-minute exam, with a total of 100 marks. There are 18 questions, and 11 pages
(including this cover page). Please read each question carefully, and write your answers
legibly in the space provided. You may do the questions in any order you wish, but please
USE YOUR TIME WISELY.
When you are finished, please hand in your exam paper and sign out. Good luck!
Student Name:
Student ID:
Score:
/ 100 =
Multiple Choice
Choose the best answer for each of the following 12 questions, for a total of 12 marks.
1
3. During the boot process, a computer obtains its initial bootstrapping information from:
(a) a special boot block on disk
(b) the superblock in the root file system
(c) a pre-configured file vmunix within the file system
(d) the /tmp file system
(e) none of the above
8. Counting semaphores:
(a) generalize the notion of a binary semaphore
(b) are used for managing multiple instances of a resource
(c) have increment and decrement operations
(d) can use queueing to manage waiting processes
(e) all of the above
3
10. With asynchronous I/O, file system changes will be committed to disk when:
(a) the in-memory inode is updated
(b) the sync daemon runs
(c) the system administrator feels like doing it
(d) nightly file system backups are run
(e) the system is rebooted
13. For each of the following pairs of terms, identify the context(s) in which they occur.
Then define each term and clarify the key difference(s) between the two terms.
(a) (3 marks) host OS and guest OS
context: virtual machines
host OS: underlying OS layer, with access to physical hardware
guest OS: runs on top of host OS, provides services to user,
using the resources provided by the host OS
Virtual machines provide flexible execution environments for users.
(b) (3 marks) page and frame
context: (virtual) memory management
frame: fixed-size basic unit of physical memory allocation
page: fixed-size logical unit of process address space;
a page fits in a frame; any page can be put in any frame
(c) (3 marks) reference bit and dirty bit
context: paging-based memory management
reference bit: indicates if a page has been accessed (recently)
dirty bit: indicates if a page has been modified (relative to disk)
These bits influence decision-making in page replacement policies
(d) (3 marks) file and directory
context: file systems
file: a named logical collection of related info, as defined by user
directory: a logical collection of related files, as defined by user
The directory has metadata about files (name, size, location, etc)
(e) (3 marks) disk partition and file system volume
context: file and storage systems
disk partition: a logical piece of a disk (or set of disks)
file system volume: a partition that contains a file system
(as opposed to being empty or used as raw disk or swap space)
A partition can hold a file system
Processes
16
Memory Management
15
17. The following page shows some output from some file-system related commands on a
local Linux system. Use this output and your knowledge of Linux file systems to answer the
following questions.
(a) (1 mark) How many different file systems are accessible on this Linux system?
11
(b) (1 mark) Which file system is the fullest (in terms of percent occupancy)?
/home/research
(c) (1 mark) Which file system has the largest physical storage capacity?
/home/scratch
(d) (1 mark) Which file system has the fewest bytes currently stored?
/boot
(e) (1 mark) Which disk partition (if any) is being used for swap space?
/dev/sda3
(f) (1 mark) What is the type of the /tmp file system?
ext3
(g) (1 mark) What is the type of the /proc file system?
proc
(h) (1 mark) How many file systems are remotely mounted using NFS?
7
(i) (1 mark) Which file system is remotely mounted on server nsh?
/home/grads
(j) (1 mark) Is this NFS service provided using UDP or TCP?
TCP
(k) (2 marks) What block sizes are used for reading and writing via NFS?
32 KB for reading, 4 KB for writing
[carey@csl]$ df
Filesystem
1K-blocks
/dev/sda2
20315844
/dev/sda5
10581704
/dev/sda1
1019208
tmpfs
1684784
nsi:/export/research 247709760
nse:/export/scratch 3361364788
nsj:/export/proj/dsl 485097928
nsg:/export/ug
381885660
nsf:/export/ug
381885660
nsh:/export/grads
789574392
nsb:/export/ug
381885660
ext3
ext3
ext3
tmpfs
devpts
sysfs
proc
swap
Mounted on
/
/tmp
/boot
/dev/shm
/home/research
/home/scratch
/home/dsl
/home/ugc
/home/ugb
/home/grads
/home/uga
defaults
defaults
defaults
defaults
gid=5,mode=620
defaults
defaults
defaults
1
1
1
0
0
0
0
0
1
2
2
0
0
0
0
0
[carey@csl]$ mount
/dev/sda2 on / type ext3 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
/dev/sda5 on /tmp type ext3 (rw)
/dev/sda1 on /boot type ext3 (rw)
tmpfs on /dev/shm type tmpfs (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
nsi:/export/research on /home/research type nfs (rw,intr,tcp,rsize=32768,wsize=4096)
nse:/export/scratch on /home/scratch type nfs (rw,intr,tcp,rsize=32768,wsize=4096)
nsj:/export/proj/dsl on /home/dsl type nfs (rw,intr,tcp,rsize=32768,wsize=4096)
nsg:/export/ug on /home/ugc type nfs (rw,intr,tcp,rsize=32768,wsize=4096)
nsf:/export/ug on /home/ugb type nfs (rw,intr,tcp,rsize=32768,wsize=4096)
nsh:/export/grads on /home/grads type nfs (rw,intr,tcp,rsize=32768,wsize=4096)
nsb:/export/ug on /home/uga type nfs (rw,intr,tcp,rsize=32768,wsize=4096)
10
18. Throughout CPSC 457 this year, there were several recurring themes (i.e., ideas that
applied quite broadly across several topics).
(a) (5 marks) One of these themes was virtualization. Identify three contexts in which
virtualization was used as a solution technique. Briefly discuss the technical issues
involved, and the benefits of the virtualization approach to the problem.
virtual machines: can run multiple OS on same machine at same time
virtual memory: separates physical memory management from logical view
virtual file system: common API for all file systems (local or remote)
Virtualization abstracts away the physical hardware and its constraints,
providing simplicity and flexibility for the users.
(b) (5 marks) A second theme was hardware support. Identify three contexts in which
hardware support was used as a solution technique. Briefly discuss the technical issues
involved, and the benefits of a hardware-based approach to the problem.
multi-processors: hardware support for parallel computing
multi-core: hardware support for fine-grain thread concurrency
MMU/TLB: hardware support for address translation, page table lookup
test-and-set, SWAP: atomic hardware instructions for mutual exclusion
protection: distinguish user-mode priviliges from kernel-mode
Hardware solution provides fast, specialized, high-performance
solution for key OS features and requirements.
(c) (5 marks) A third theme was caching. Identify three contexts in which caching was
used as a solution technique. Briefly discuss the technical issues involved, and the
benefits of caching as a solution.
CPU: on-chip instruction/data caches to avoid memory latency
buffer cache: in-memory caching to avoid disk latency
disk cache: remember recent data blocks to avoid disk access latency
write cache: buffer outgoing writes to improve system performance
storage: sequential read-ahead and prefetch for I/O controller
file system: in-memory caching of superblock, inodes, directory info
NFS: client-side caching of info to avoid network latency
Caching optimizes for the common case, and improves performance.
11