Passer au contenu

Labs · 9618 A2 16.1

Page Replacement

Virtual memory in action. Pages come in, but RAM has only a few frames. Choose which page to throw out, and count the page faults.

5 levelsFree bench

In the exam

Exam questions on what this lab teaches, with the points that gain marks.

9618/31 October/November 2022 · Question 84 marks

(a) Explain what is meant by virtual memory. (b) State one difference between paging and segmentation.

Points that gain marks

  1. Secondary storage (disk) is used to extend the memory.
  2. So the CPU seems to be able to use more memory than there is RAM.
  3. Only the data in use needs to be in RAM: pages are swapped between RAM and disk when needed.
  4. Paging uses blocks of a fixed size; segmentation uses blocks of different sizes.

In this lab: Each page fault in the lab is a swap: a page comes in from disk, and the page in that frame goes out.

9618/32 October/November 2023 · Question 55 marks

(a) Outline the reasons why an operating system may need to use virtual memory. (b) Explain the circumstances in which disk thrashing could occur.

Points that gain marks

  1. (a) Virtual memory is used when RAM is running low, for example when many processes run at once.
  2. (a) Pages that are not needed now can be moved out of RAM, so RAM is used efficiently.
  3. (b) Thrashing can happen when virtual memory is used: pages move often between main memory and secondary storage.
  4. (b) As main memory fills up, more pages are swapped in and out, with a very high rate of disk head movement.
  5. (b) In the end more time is spent swapping pages than processing data.

In this lab: Levels 'Hits and page faults' and 'More frames, more faults?'.

The question as printed in the exam paper

More real experiments

All labs →

Se connecter ou créer un compte

IGCSE, A-Level & AP