0% found this document useful (0 votes)
141 views2 pages

Model Answer For Assignment 3: Question 1 (5 Points)

This document contains the model answers to 4 questions about memory management principles and their applications. Question 1 calculates CPU utilization for a system with 5 programs that wait for I/O 50% of the time, determining at least 7 processes are needed for 99% CPU utilization. Question 2 considers first-fit, best-fit, worst-fit, and next-fit allocation strategies for segment requests of different sizes. Question 3 draws an analogy between file fragmentation and memory external fragmentation. Question 4 explains that CPU caches must be flushed during context switches to prevent a new process from accessing data or executing instructions from the old process.

Uploaded by

Malick Gai
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
141 views2 pages

Model Answer For Assignment 3: Question 1 (5 Points)

This document contains the model answers to 4 questions about memory management principles and their applications. Question 1 calculates CPU utilization for a system with 5 programs that wait for I/O 50% of the time, determining at least 7 processes are needed for 99% CPU utilization. Question 2 considers first-fit, best-fit, worst-fit, and next-fit allocation strategies for segment requests of different sizes. Question 3 draws an analogy between file fragmentation and memory external fragmentation. Question 4 explains that CPU caches must be flushed during context switches to prevent a new process from accessing data or executing instructions from the old process.

Uploaded by

Malick Gai
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

CMPT-300 02-01 E2

Model Answer for Assignment 3


We have discussed some issues about memory management. This assignment
is about principles of memory management and their applications.

Question 1 (5 points)
Consider a computer system with enough main memory to hold 5 programs. If
these programs wait for I/O 50% of the time, then, on average, what fraction of
CPU time is wasted? What degree of multiprogramming is necessary to achieve
at least 99% CPU utilization?

Answer
According to the formula on page 193, if p=0.5, then the chance that all five
processes are idle is 1/32. At least 7 processes are needed to achieve at least
99% CPU utilization.

Question 2 (5 points)
Consider a swapping system in which main memory contains the following hole-
sizes in memory order: 10K, 4K, 20K, 18K, 7K, 9K, 12K, and 15K. Which hole is
taken for successive segment requests of (a) 12K, (b) 10K and (c) 9K for First-
Fit? Repeat this exercise for Best-Fit, Worst-Fit, and Next-Fit.

Answer
• First-Fit takes 20K, 10K, and 18K.
• Best-Fit takes 12K, 10K, and 9K.
• Worst-Fit takes 20K, 18K, and 15K.
• Next-Fit takes 20K, 18K, and 9K.

Question 3 (5 points)
Contiguous allocation of files leads to disk fragmentation. What type of
fragmentation is this? Please answer this question by making an analogy with
something discussed in Memory Management.

Answer
Since the wasted storage is between the allocation units (files), and not inside
them, this is clearly external fragmentation. It is precisely analogous to the
external fragmentation of main memory that occurs with a swapping system or a
system using pure segmentation.

Question 4 (5 points)
Modern CPUs have instruction and data caches that keep the most recent
memory accesses. In virtual memory systems these caches are indexed by
virtual address. In such a machine, during a process (context) switch, the
operation system has to flush the CPU caches. Why?

Answer
If the caches are not cleared when a context switch occurs, the newly scheduled
process will be able to see data from the old process, and may even erroneously
execute instructions from that process.

You might also like