Operating Systems - Sample Final 2008 | ECS 150, Exams of Operating Systems

Material Type: Exam; Class: Operating Systems; Subject: Engineering Computer Science; University: University of California - Davis; Term: Fall 2008;

Typology: Exams

Pre 2010

Uploaded on 07/30/2009

koofers-user-hle
koofers-user-hle 🇺🇸

9 documents

1 / 1

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
ECS 150, Operating Systems Fall Quarter 2008
Sample Final
1. How does the working-set model relate process scheduling and memory management?
Answer: The Working Set Principle says that all pages of the working set of a process must be resident for the
process to run, and no page in a running process’ working set can be removed from memory while the process is
running. The memory manager and process schedulers must work together to ensure this principle is followed.
2. What is an access control matrix?
Answer: An access control matrix is a matrix that describes what rights processes have over files. The rows
correspond to subjects (processes) and the columns correspond to subjects and objects (files). Each entry in the
matrix contains the rights that the subject in the row has over the subject or object in the column.
3. What is the difference between deadlock and starvation?
Answer: Deadlock occurs when two processes are blocked, waiting for the other to do something (like release
resources). Starvation occurs when timing prevents one (or more) processes from acquiring a resource or per-
forming some action.
4. Three procedures, A, B, and C, are to be linked together into one process and loaded into memory. The length
of each procedure is 600 words. Consider the following memory management schemes:
(a) Paging: page size is 1000 words, page tables occupy 1 page each.
(b) Segmentation: segment table size is 1000 words.
(c) Paged segmentation: page size is 1000 words, page tables occupy 1 page each, segment table size is 1000
words.
Assume that all procedures and all tables are in memory. For each of the three systems, what is the total occupied
memory space (i.e., the space that cannot be used by another process)? This includes the space occupied by the
procedures and the various tables, as well as space wasted due to the fixed page size.
Answer:
(a) The page table is 1 page, and the three procedures make up a program that is 1800 words long, so it
occupies 2 pages. Hence the total occupied memory is 3 pages or 3000 words.
(b) The segment table occupies 1000 words. Each of the procedures occupies a segment of 600 words. Hence
the total memory occupied is 2800 words.
(c) Here, the segment table occupies 1000 words. Each procedure occupies 1 segment, and each segment
contains 1 page. So each segment is 1000 words long. Each page table for the segment is 1000 words,
so each segment and corresponding page table occupies 2000 words. Hence the program occupies 6000
words; adding in space for the segment table, the memory used is 7000 words.
5. Recall that the link count field in a MINIX inode contains the number of directory entries pointing to the inode,
something that can equally well be determined by looking at the directories themselves. Why is this field used?
Answer: This field is used for efficiency purposes; it is far quicker to reference it to determine the link count
than to scan the file system. For example, if a file is to be deleted, its disk blocks are returned to the free list
only if the file’s link count is 1 (meaning there are no other links to it). Determining whether or not to do this
without a link count field would require scanning all directories in the disk, which can take a long time.
6. Describe three ways that disk space may be allocated for a file.
Answer: Disk space may be allocated contiguously (one chunk the size of the file), in a linked fashion (where
each block of the file contains the address of the next block), or in an indexed fashion (where the first few blocks
contain the addresses either of blocks containing the data in the file or of other index blocks).
Version of November 30, 2008 at 11:01am Page 1 of 1

Partial preview of the text

Download Operating Systems - Sample Final 2008 | ECS 150 and more Exams Operating Systems in PDF only on Docsity!

ECS 150, Operating Systems Fall Quarter 2008

Sample Final

  1. How does the working-set model relate process scheduling and memory management?

Answer: The Working Set Principle says that all pages of the working set of a process must be resident for the process to run, and no page in a running process’ working set can be removed from memory while the process is running. The memory manager and process schedulers must work together to ensure this principle is followed.

  1. What is an access control matrix?

Answer: An access control matrix is a matrix that describes what rights processes have over files. The rows correspond to subjects (processes) and the columns correspond to subjects and objects (files). Each entry in the matrix contains the rights that the subject in the row has over the subject or object in the column.

  1. What is the difference between deadlock and starvation?

Answer: Deadlock occurs when two processes are blocked, waiting for the other to do something (like release resources). Starvation occurs when timing prevents one (or more) processes from acquiring a resource or per- forming some action.

  1. Three procedures, A, B, and C, are to be linked together into one process and loaded into memory. The length of each procedure is 600 words. Consider the following memory management schemes: (a) Paging: page size is 1000 words, page tables occupy 1 page each. (b) Segmentation: segment table size is 1000 words. (c) Paged segmentation: page size is 1000 words, page tables occupy 1 page each, segment table size is 1000 words. Assume that all procedures and all tables are in memory. For each of the three systems, what is the total occupied memory space (i.e., the space that cannot be used by another process)? This includes the space occupied by the procedures and the various tables, as well as space wasted due to the fixed page size.

Answer: (a) The page table is 1 page, and the three procedures make up a program that is 1800 words long, so it occupies 2 pages. Hence the total occupied memory is 3 pages or 3000 words. (b) The segment table occupies 1000 words. Each of the procedures occupies a segment of 600 words. Hence the total memory occupied is 2800 words. (c) Here, the segment table occupies 1000 words. Each procedure occupies 1 segment, and each segment contains 1 page. So each segment is 1000 words long. Each page table for the segment is 1000 words, so each segment and corresponding page table occupies 2000 words. Hence the program occupies 6000 words; adding in space for the segment table, the memory used is 7000 words.

  1. Recall that the link count field in a MINIX inode contains the number of directory entries pointing to the inode, something that can equally well be determined by looking at the directories themselves. Why is this field used?

Answer: This field is used for efficiency purposes; it is far quicker to reference it to determine the link count than to scan the file system. For example, if a file is to be deleted, its disk blocks are returned to the free list only if the file’s link count is 1 (meaning there are no other links to it). Determining whether or not to do this without a link count field would require scanning all directories in the disk, which can take a long time.

  1. Describe three ways that disk space may be allocated for a file.

Answer: Disk space may be allocated contiguously (one chunk the size of the file), in a linked fashion (where each block of the file contains the address of the next block), or in an indexed fashion (where the first few blocks contain the addresses either of blocks containing the data in the file or of other index blocks).

Version of November 30, 2008 at 11:01am Page 1 of 1