0% found this document useful (0 votes)
116 views4 pages

Tutorial (Chapter 9)

The document discusses operating system concepts related to demand paging including page faults, thrashing detection, page replacement algorithms, and techniques that work well or poorly in a demand paged environment. Some key points: 1) A page fault occurs when a process attempts to access a page not currently in memory, triggering the operating system to locate a free frame, perform I/O to load the needed page, and update tables before restarting the instruction. 2) Thrashing is detected by comparing CPU and disk utilization - high disk usage with low CPU indicates too many page faults from insufficient free frames. Reducing multiprogramming can eliminate thrashing by giving each process more frames. 3) Techniques like stacks
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
116 views4 pages

Tutorial (Chapter 9)

The document discusses operating system concepts related to demand paging including page faults, thrashing detection, page replacement algorithms, and techniques that work well or poorly in a demand paged environment. Some key points: 1) A page fault occurs when a process attempts to access a page not currently in memory, triggering the operating system to locate a free frame, perform I/O to load the needed page, and update tables before restarting the instruction. 2) Thrashing is detected by comparing CPU and disk utilization - high disk usage with low CPU indicates too many page faults from insufficient free frames. Reducing multiprogramming can eliminate thrashing by giving each process more frames. 3) Techniques like stacks
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Operating System (Chapter 9)

1. If a memory reference takes 100 nanoseconds and a search in the Translation Look-aside Buffer
(TLB) takes 20 nanoseconds, what is the effective access time if 85 percent of all page table
references are found in the TLB? (Assume that finding a page-table entry in the associative
registers takes zero time if the entry is there.)

a. TLB Hit: TLB search, memory access


b. TLB Miss: TLB search, page table search, memory access

c. Effective access time =


0.85 x 120 + 0.15 x 220
= 135 nanoseconds

2. When does a page fault occur? Describe the actions taken by the operating system when a page
fault occurs.
a. A page fault occurs when an access to page that has not been brought into main
memory takes place
b. The operating system verifies the memory access
i. If invalid (page is not in the process’ logical address space), abort the program
ii. If valid,
1. a free frame is located
2. I/O is requested to read the needed page into the free frame
3. Upon completion of I/O, the process table and page table are updated
and the instruction is restarted
3. Assume a page string for a process with m frames (initially all empty). The page reference string
has length p with n distinct page numbers occurring in it. For any page-replacement algorithms,

a. What is a lower bound on the number of page faults?


i. N
ii. Lowest possible is all distinct pages only need to be brought in ONCE
iii. This happened if there is enough frames for each unique pages;
iv. m >= n

b. What is an upper bound on the number of page faults?


i. P
ii. Highest possible is each and every page in the reference string causes a page
fault
iii. m < n and page replacement algorithm keeps choosing the wrong victims

4. What is the cause of thrashing? How does the system detect thrashing? Once it detects
thrashing, what can the system do to eliminate this problem?
a. Thrashing is caused by under allocation of the minimum number of pages required by a
process, forcing it to continuously page fault
b. The system can detect thrashing by evaluating the level of CPU utilization as compared
to the level of multiprogramming and disk utilization
c. Reducing the level of multiprogramming can eliminate it

5. Consider a demand-paged computer system where the degree of multiprogramming is currently


fixed at four. The system was recently measured to determine utilization of CPU and the paging
disk. The results are one of the following alternatives. For each case, what is happening? Can the
degree of multiprogramming be increased to increase the CPU utilization? Is the paging helping?
a. CPU utilization 13 percent; disk utilization 97 percent
i. Thrashing is occurring
ii. Increasing the degree of multiprogramming will reduce the frames available to
each process, thus making the thrashing worse
iii. Paging is not helping due to the number of available frames being too low

b. CPU utilization 87 percent; disk utilization 3 percent


i. CPU utilization is sufficiently high to leave things alone
ii. Can increase degree of multiprogramming since disk utilization doesn’t indicate
thrashing
iii. Paging is helping

c. CPU utilization 13 percent; disk utilization 3 percent


i. CPU seems underutilized, no thrashing
ii. Can increase degree of multiprogramming. Adding more processes may increase
the CPU utilization
iii. Paging is fine
6. Which of the following programming techniques and structures are “good” for a demand-paged
environment? Which are “not good”? Explain your answers.
a. Stack
i. Good
ii. Data access is sequential; operations are local
b. Hashed symbol table
i. Not good
ii. Data is scattered (not local)
c. Sequential search
i. Good
ii. Look one after another (local)
d. Binary search
i. Not good
ii. Have to retrieve large chunks of information for comparison; compare by halves
e. Pure code
i. Good
ii. Can be shared; code usually exhibit locality
f. Vector operations
i. Good
ii. Array manipulation, therefore sequential access
g. Indirection
i. Not good
ii. Contains jumps to different memory location than code

7. Consider a demand-paging system with the following time-measured utilizations:


CPU utilization 20%
Paging disk 97.7%
Other I/O devices 5%.
Which (if any) of the following will (probably) improve CPU utilization? Explain your answer.

- The system obviously is spending most of its time paging, indicating thrashing
- If the level of multiprogramming is reduced
o Each resident process would receive more frames
o Would page fault less frequently
o CPU utilization would improve
- Another way to improve performance would be to get more physical memory (more frames)
or a faster paging drum (quicker page swaps).
a. Install a faster CPU.
i. No, CPU already under utilized
b. Install a bigger paging disk.
i. Swapping device used to hold the images of pages no longer held in main
memory
ii. No, it is busy because it keeps paging in to memory
c. Increase the degree of multiprogramming.
i. No, memory is already over allocated. Hence too few frames to go around
d. Decrease the degree of multiprogramming.
i. Yes, more frames for each process should reduce page faults
e. Install more main memory.
i. Yes, will also increase frames per process, hence lesser page faults
f. Install a faster hard disk, or multiple controllers with multiple hard disks.
i. Yes, CPU can get data quicker because disk bottleneck is reduced
g. Add prepaging to the page fetch algorithms.
i. Yes, CPU can get data quicker page is there before is made
ii. This assumes there is locality of data
h. Increase the page size.
i. Yes and NO
ii. Yes if data has good locality
iii. No if data has bad locality. Bigger size means lesser pages, so more page faults
and longer time to page

You might also like