How virtual memory is created

Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.

How virtual memory is created

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. How is virtual memory created?
A The OS sets aside part of secondary storage
B The OS adds extra RAM chips to the computer
2. Where does virtual memory physically exist?
A Inside the ROM chip
B On the secondary storage drive
3. Which part of the computer sets up and manages virtual memory?
A The monitor
B The operating system
4. What does virtual memory hold?
A Pages of data moved out of RAM
B The BIOS start-up program
5. What can the OS do if the virtual memory space becomes too small?
A Make it bigger by reserving more drive space
B Nothing, the size is fixed forever

Match the Pairs

Draw a line connecting each item on the left to its match on the right.

Left columnRight column
1Virtual memory AVirtual memory is not extra RAM hardware. It is space on secondary storage (such as an HDD or SSD) that the OS sets aside.
2Page file (swap space) BThe reserved area on the drive where the operating system keeps pages of data that do not fit in RAM
3The operating system manages virtual memory, deciding which pages go to the drive and which come back to RAM Cpage file size: 2 GB -> 4 GB
4Virtual memory can grow when more is needed, because the OS can make the reserved space on the drive bigger DOS controls the page file
5Virtual memory is a second RAM chip added to the motherboard EThe operating system creates and manages virtual memory automatically. The user does not move pages by hand.
6The user must manually move each page of data to virtual memory FPart of secondary storage that the operating system sets aside to hold pages of data when RAM is full

Definitions

Virtual memory

Fill in the Blanks

Complete each line of code by filling in the missing parts.

1.
IF RAM is full THEN OS moves pages to ______________ ENDIF
2.
Virtual memory uses _________________
3.
IF virtual memory is full THEN OS _________ the reserved space ENDIF
4.
Managed by the ________________
5.
Data in virtual memory is stored in _____

Spot the Error

Shade in the letter of the line that contains an error.

Question 1
A RAM_full ← TRUE
B IF RAM_full = TRUE THEN
C OS.reserve(drive, 4)
D vmem ← RAM.reserved
E ENDIF
Question 2
A vmem_location ← ROM
B vmem_manager ← OS
C OUTPUT vmem_location
Question 3
A vmem_size ← 4
B vmem_manager ← RAM
C OUTPUT vmem_manager
Question 4
A IF pages > vmem_size THEN
B vmem_size ← vmem_size - 2
C ENDIF
Question 5
A WHILE vmem_size > pages_needed
B OS.enlarge(vmem_size)
C ENDWHILE

Answer Key

How virtual memory is created
Section A: Quick Questions
Q1
A — The OS sets aside part of secondary storage
Q2
B — On the secondary storage drive
Q3
B — The operating system
Q4
A — Pages of data moved out of RAM
Q5
A — Make it bigger by reserving more drive space
Section B: Match the Pairs
Q1
Virtual memory → Part of secondary storage that the operating system sets aside to hold pages of data when RAM is full
Q2
Page file (swap space) → The reserved area on the drive where the operating system keeps pages of data that do not fit in RAM
Q3
The operating system manages virtual memory, deciding which pages go to the drive and which come back to RAM → OS controls the page file
Q4
Virtual memory can grow when more is needed, because the OS can make the reserved space on the drive bigger → page file size: 2 GB -> 4 GB
Q5
Virtual memory is a second RAM chip added to the motherboard → Virtual memory is not extra RAM hardware. It is space on secondary storage (such as an HDD or SSD) that the OS sets aside.
Q6
The user must manually move each page of data to virtual memory → The operating system creates and manages virtual memory automatically. The user does not move pages by hand.
Section C: Definitions
Q1
Virtual memory — Part of secondary storage that the operating system sets aside to hold pages of data when RAM is full. The OS manages this space and can make it bigger when more is needed.
Section D: Fill in the Blanks
Q1
IF RAM is full THEN OS moves pages to virtual memory ENDIF
Q2
Virtual memory uses secondary storage
Q3
IF virtual memory is full THEN OS increases the reserved space ENDIF
Q4
Managed by the operating system
Q5
Data in virtual memory is stored in pages
Section E: Spot the Error
Q1
D — Virtual memory is space reserved on the drive (secondary storage), not in RAM. It should be vmem ← drive.reserved.
Q2
A — Virtual memory is created on secondary storage such as the HDD. ROM is primary storage and cannot be used for it. It should be vmem_location ← HDD.
Q3
B — The operating system sets up and manages virtual memory. RAM is just memory and does not manage anything. It should be vmem_manager ← OS.
Q4
B — When more virtual memory is needed, the OS makes the reserved space bigger. It should add to the size (+ 2), not subtract.
Q5
A — The OS should keep enlarging virtual memory while it is smaller than the space needed. The condition should use < not >.