CS 162 Midterm 2, Fall 2003: Locality, Virtual Memory, Disk Scheduling, Exams of Operating Systems

A university computer science midterm exam from the university of california, berkeley, department of electrical engineering and computer sciences, computer science division, cs 162, fall 2003. The exam covers topics such as principles of locality, virtual memory, disk scheduling, inode table, and page replacement. Students are required to answer questions related to these topics, including defining and distinguishing the principles of temporal and spatial locality, calculating page size and memory consumption in a virtual memory system, determining the order of request servicing in different disk scheduling algorithms, and analyzing the number of page faults in various page replacement algorithms.

Typology: Exams

2012/2013

Uploaded on 04/02/2013

shailesh_pr1c
shailesh_pr1c 🇮🇳

4.7

(7)

60 documents

1 / 6

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
UNIVERSITY OF CALIFORNIA
College of Engineering
Department of Electrical Engineering
and Computer Sciences
Computer Science Division
CS 162, Fall, 2003 Prof. Alan Jay Smith
Midterm 2, October 29, 2003
1. Define and distinguish the principles of temporal and spatial locality. Give two
examples of how the principles of locality are exploited in a computer system.
pf3
pf4
pf5

Partial preview of the text

Download CS 162 Midterm 2, Fall 2003: Locality, Virtual Memory, Disk Scheduling and more Exams Operating Systems in PDF only on Docsity!

UNIVERSITY OF CALIFORNIA

College of Engineering Department of Electrical Engineering and Computer Sciences Computer Science Division

CS 162, Fall, 2003 Prof. Alan Jay Smith

Midterm 2, October 29, 2003

  1. Define and distinguish the principles of temporal and spatial locality. Give two examples of how the principles of locality are exploited in a computer system.
  1. Virtual Memory:

In a computer with 32-bit virtual address (A virtual address specifies a byte number) we subdivide the virtual address into 4 pieces as follows: 8-bit, 4-bit, 8-bit, 12-bit. We use a 3-level page table, such that the first 8 bits are used to index the page table for the first level, 4 bits for the second level, 8 bits for the third level, and 12 bits for the byte within page. Each page table entry is 48 bits, and contains a physical address (42 bits), 3 protection bits, valid, reference and dirty bits. Answer the following questions, showing how you reach the answer. A simple number will not receive any credit.

a. What is the page size in such a system? Explain your answers. (4)

b. How much memory is consumed by the page table, and how much is wasted by internal fragmentation for a process that has 64K of memory starting at address 0? (Don’t forget to include internal fragmentation in the page table.) Assume that we don’t allocate any page tables that have no valid entries in them. (6)

c. What is an inverted page table? If you use a global (i.e. shared by all processes, with a process ID) inverted page table, and you want to ensure that the page table was never more than 50% full, and the physical memory size is 32 MB, how many entries does the page table have? Why?

  1. What is the inode table? What is the process open file table? Why do we use both, rather than putting a copy of the inode in the open file table entry? (15)
  1. Page Replacement (18)

Given the following reference string: 5 4 3 2 5 4 6 5 4 3 2 6

determine the number of page faults when there are 3 or 4 page frames, for each of LRU, OPT and FIFO replacement.

Show your work.

LRU

FIFO

OPT