pop up description layer
Last modified: 20070823:105806/initial version

FIT2022 AJH-2007-17

Tutorial 4

Objectives and Outcomes | Lab 4: Memory Management | The Exam Questions Basics | Any Other Issues

Memory Management

1. Objectives and Outcomes

1.1 Objectives

  1. To prepare for Lab 4 (Unit Objectives 2b, 6b, 7, 9a)
  2. To explore some problems in memory management and virtual memory

1.2 Outcomes

  1. A clear understanding of what lab 4 is about
  2. Techniques for solving typical problems in memory management

2. Lab 4: Memory Management

(From the Lab4 lab sheet: read this and discuss any aspects that you find unclear.)

Memory management is about making sure that there is enough memory available within the system to run the various processes on offer. Each process needs memory to run, and some processes require more than others to run. It is the role of the memory management algorithm to allocate memory to processes in such a way as to satisfy one or more policies. Those policies may give priority to such things as simplicity, fairness, performance, efficiency, etc., and often these goals may be in conflict. Operating systems design is a compromise!

We will demonstrate memory management by building a simple high level operating system. This system is high level, because it executes Python programs directly, rather than compiling them into machine code. It is simple, because we do not deal with data management issues, but focus only upon the memory management of the code space. Nevertheless, it does demonstrate some vital principles, not the least being the use of processes (threads in our implementation) at the operating system level as well as the user level.

Our simple model is this:

  1. One (operating system) process (the reading process) has the responsibility of reading programs into a job queue (a long term job scheduling queue, to use the terminology described in chapter 3).
  2. Another process (the loading process) selects programs from the job queue, and attempts to allocate memory to them. If it succeeds, it loads the program into memory, and instantiates it as a process. If it fails, it waits until there is sufficient memory to succeed with the allocation.
  3. The two processes communicate through a job queue. This is a list of jobs for processing. It is handled in a strictly first-in, first-out (FIFO) fashion.
  4. There is a memory allocation algorithm, which keeps track of what areas of memory are in use, and which are free.

Each of the above components is modelled as a Python class, called respectively: read_progs, load_progs, JobQ, and memory_alloc. A further class, Process, models each user-level process in execution.

3. The Exam Questions Basics

  1. Why is compaction only possible if relocation is dynamic?

  2. Why is is relocation a problem for I/O operations?

  3. Why must a program be loaded into memory before it can be executed?

  4. Explain the difference between dynamic linking and dynamic loading.

  5. Explain the difference between internal fragmentation and external fragmentation.

  6. Explain how a two-level paging scheme improves the basic paging memory management strategy by reducing the memory demands of the logical to physical address mapping process. If two-level paging schemes are useful in this respect, would a two level segmentation scheme give any advantage over a one-level paging scheme? Why (not)?

  7. Consider a demand-paged computer system where the degree of multiprogramming is currently fixed at 4. The system was measured to determine utilization of the CPU and the paging disk. The results on three different occasions were

    1. CPU utilization 13%, disk utilization 97%
    2. CPU utilization 87%, disk utilization 3%
    3. CPU utilization 13%, disk utilization 3%
    On each occasion, what was happening and why? Can the degree of multiprogramming be increased to improve the CPU utilization? Is the paging helping?

  8. Explain the working set model of virtual memory. On a given system, the following measurements were made:

    Number of instructions Working Set size (pages)
    10006
    200010
    400012
    600013
    800018
    1000026
    1200027

    Sketch the shape of this curve and explain what is happening as the number of instructions in the working set window increases

    1. from 2000 through to 6000
    2. from 6000 to 10000
    3. from 10000 to 12000

  9. (Exercise 9.11, Silberschatz and Galvin) Consider the following page reference string:

              1, 2, 3, 4, 2, 1, 5, 6, 2, 1, 2, 3, 7, 6, 3, 2, 1, 2, 3, 6.        

    How many page faults would occur for the following replacement algorithms, assuming one, two, three, four, five, six, or seven frames? Remember that all frames are initially empty, so your first unique pages will all cost one fault each.

    1. LRU replacement
    2. FIFO replacement
    3. Optimal replacement

4. Any Other Issues

Are there any other issues you would like to discuss?


Document History

20070823:105806 1.0.0 ajh initial version

This page maintained by John Hurst.
Copyright Monash University Copyright Policy
1458 accesses since
05 Sep 2007
My PhotoTrain Photo

Generated at 20090708:0710 from an XML file modified on 20070904:1512
Maintainer use only; not generally accessible: Local ServerWork ServerCSSE Server

1868 accesses since 05 Sep 2007, HTML cache rendered at 20120522:1413