(This is the older material - click here - for current specification content)

8. Page Addressing

The memory manager partitions memory into pages.

Every page is numbered, and the starting address of each page is held in a 'page table'

Page Number
In main memory?
Example Address
900

Yes

1000
901

No

 

2000
902

No

 

3000

As main memory fills up, the memory manager will begin to store individual pages into virtual memory and sets the memory flag within the page table accordingly (centre column).

If an executing program wants to get hold of a specific data item within a page, the memory manager uses an 'offset method' to fetch it.

Each memory location ('address') consists of a page number start address and an offset within the page for the specific byte. For example in the above table, byte 3 in page 901 would be at address 2003.

algorithm for virtual memory management

The offset algorithm works like this:

  1. A process requests a specific piece of data. For example, Page 902 offset 4 (3004)
  2. Memory manager fetches the starting address (3000) of the relevant page (902) from the page table
  3. If the page is in virtual memory, then fetch it back into main memory
  4. Once the page is back in main memory, then update the page table with a new start address and reset the flag
  5. If another page had to swapped into virtual memory to make room, then update its starting address and set its page table memory flag to indicate it is now in virtual memory.
  6. The offset (4) is added to the new starting address
  7. This means that an 'absolute' address is calculated in RAM for the offset

 

All this happens extremely quickly as this procedure is normally stored in the fast CPU cache because it is used so often.

 

Challenge see if you can find out one extra fact on this topic that we haven't already told you

Click on this link: Page Addressing

 

 

Copyright © www.teach-ict.com