Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

15 Problems for Old Exam 2 - Operating Systems | CS 471, Exams of Operating Systems

Exam 2 Material Type: Exam; Professor: Mukkamala; Class: OPERATING SYSTEMS; Subject: Computer Science; University: Old Dominion University; Term: Unknown 2005;

Typology: Exams

Pre 2010

Uploaded on 10/19/2008

koofers-user-k3d-1
koofers-user-k3d-1 🇺🇸

5

(1)

10 documents

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CS 471 – Exam 2
Name:___________________
Feb. 26 2002
Instructions: This exam must be mailed to cmo by midnight, April 25, 2002. You may submit
either a Word or a text file. The exam is open book, open notes.
1. (12 pts) Consider the following page reference string:
1 2 3 1 2 4 2 1 2 5 1 2 3 4
a. For a FIFO page replacement algorithm with 4 frames, how many page faults are generated?
Show work.
b. For a LRU page replacement algorithm with 4 frames, how many page faults are generated?
Show work.
c. For the Optimal page replacement algorithm with 4 frames, how many page faults are generated?
Show work.
2. (5 pts) If a page size is 2048, how many bits are required for the offset in the address?
3. (6 pts) Under what circumstances is hashing useful for virtual memory systems?
4. (6 pts) How does paged memory solved the external fragmentation problem? Why does it not solve
the internal fragmentation problem?
5. (6 pts) How does use of a “dirty” bit improve virtual memory performance?
6. (4 pts) In the semaphore solution for the bounded buffer problem, why are two, rather than one
semaphore needed? (Explain the purpose of each, that is, why it is necessary.)
7. (6 pts) In a system with paging, a process cannot access memory that it does not own. Why?
8. (6 pts) Many virtual memory systems use an approximation of an LRU algorithm.
a. Why is the LRU algorithm preferred?
b. Why is it not used?
9. (6 pts) Consider a system in which the unallocated space for a file system is kept in a free space list.
If this list were to become corrupted, could the operating system reconstruct it?
10. (6 pts) If a multiuser system begins to thrash,
a. How could the OS detect that it is in a thrashing state?
b. What reasonable actions could the OS take to reduce thrashing?
11. (6 pts) Consider a paged memory system (with no virtual memory). Suppose memory access time
is 40 nanoseconds and that it takes 15 nanoseconds to search the associative memory used to
store part of the page table. If the hit rate for this associative memory is 0.98, what is the effective
memory access time?
12. (8 pts) Consider the following code for TestAndSet operation intended to be used to provide mutual
exclusion:
boolean TestAndSet(boolean &target) {
boolean rv = target;
target = true;
return rv;
- 1 -
pf2

Partial preview of the text

Download 15 Problems for Old Exam 2 - Operating Systems | CS 471 and more Exams Operating Systems in PDF only on Docsity!

CS 471 – Exam 2

Name:___________________

Feb. 26 2002 Instructions: This exam must be mailed to cmo by midnight, April 25, 2002. You may submit either a Word or a text file. The exam is open book, open notes.

  1. (12 pts) Consider the following page reference string: 1 2 3 1 2 4 2 1 2 5 1 2 3 4 a. For a FIFO page replacement algorithm with 4 frames, how many page faults are generated? Show work. b. For a LRU page replacement algorithm with 4 frames, how many page faults are generated? Show work. c. For the Optimal page replacement algorithm with 4 frames, how many page faults are generated? Show work.
  2. (5 pts) If a page size is 2048, how many bits are required for the offset in the address?
  3. (6 pts) Under what circumstances is hashing useful for virtual memory systems?
  4. (6 pts) How does paged memory solved the external fragmentation problem? Why does it not solve the internal fragmentation problem?
  5. (6 pts) How does use of a “dirty” bit improve virtual memory performance?
  6. (4 pts) In the semaphore solution for the bounded buffer problem, why are two, rather than one semaphore needed? (Explain the purpose of each, that is, why it is necessary.)
  7. (6 pts) In a system with paging, a process cannot access memory that it does not own. Why?
  8. (6 pts) Many virtual memory systems use an approximation of an LRU algorithm. a. Why is the LRU algorithm preferred? b. Why is it not used?
  9. (6 pts) Consider a system in which the unallocated space for a file system is kept in a free space list. If this list were to become corrupted, could the operating system reconstruct it?
  10. (6 pts) If a multiuser system begins to thrash, a. How could the OS detect that it is in a thrashing state? b. What reasonable actions could the OS take to reduce thrashing?
  11. (6 pts) Consider a paged memory system (with no virtual memory). Suppose memory access time is 40 nanoseconds and that it takes 15 nanoseconds to search the associative memory used to store part of the page table. If the hit rate for this associative memory is 0.98, what is the effective memory access time?
  12. (8 pts) Consider the following code for TestAndSet operation intended to be used to provide mutual exclusion: boolean TestAndSet(boolean &target) { boolean rv = target; target = true; return rv; - 1 -

Why should this be a hardware instruction? Explain.

  1. (10 pts) Consider the following code fragment for managing a critical region shared by two processes: Shared variables: boolean flag[2]; Initially flag[0] = flag[1] = false. Process Pi: do { flag[i] := true; while (flag[j]) ; critical section flag [i] = false; remainder section } while (1); Why does this code fail to satisfy the progress requirement for mutual exclusion?
  2. (6 pts) In UNIX, an uninitialized pointer often produces a “segmentation fault.” Explain why UNIX calls this a segmentation error. What has happened in the OS to cause a segment problem?
  3. (6 pts) Consider the given segment table: Segment Base Length 0 1250 500 1 2500 250 2 90 100 3 350 580 4 2000 56 What are the physical addresses for each of the following logical addresses? a. 0, b. 1, c. 2, d. 3, e. 4, Pledged: I have neither given nor received help on this exam. Signature