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

Principle of Locality

The principle of locality suggests that memory references within a process cluster, allowing for efficient virtual memory management. Each process has a page table that tracks whether pages are in main memory and includes control bits for managing access and modifications. Shared code can be efficiently managed by keeping a single copy in memory, while each user retains private data pages.

Uploaded by

Jairos Shinzeh
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
68 views2 pages

Principle of Locality

The principle of locality suggests that memory references within a process cluster, allowing for efficient virtual memory management. Each process has a page table that tracks whether pages are in main memory and includes control bits for managing access and modifications. Shared code can be efficiently managed by keeping a single copy in memory, while each user retains private data pages.

Uploaded by

Jairos Shinzeh
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Principle of locality n n n n Principle of locality of references: memory references within a process tend to cluster Hence: only a few pieces

of a process will be needed over a short period of time Possible to make intelligent guesses about which pieces will be needed in the future This suggests that virtual memory may work efficiently (ie: trashing should not occur too often)

peging n n Typically, each process has its own page table Each page table entry contains a present bit to indicate whether the page is in main memory or not. If it is in main memory, the entry contains the frame number of the corresponding page in main memory If it is not in main memory, the entry may contain the address of that page on disk or the page number may be used to index another table (often in the PCB) to obtain the address of that page on disk A modified bit indicates if the page has been altered since it was last loaded into main memory If no change has been made, the page does not have to be written to the disk when it needs to be swapped out Other control bits may be present if protection is managed at the page level a read-only/read-write bit protection level bit: kernel page or user page (more bits are used when the processor supports more than 2 protection levels)

n n n

Page table structure

Sharing pages n If we share the same code among different users, it is sufficient to keep only one copy in main memory Shared code must be reentrant (ie: non self-modifying) so that 2 or more processes can execute the same code If we use paging, each sharing process will have a page table whos entry points to the same frames: only one copy is in main memory

But each user needs to have its own private data pages

Page tables and vitual memory n Most computer systems support a very large virtual address space u u n 32 to 64 bits are used for logical addresses If (only) 32 bits are used with 4KB pages, a page table may have 2^{20} entries

The entire page table may take up too much main memory. Hence, page tables are often also stored in virtual memory and subjected to paging u When a process is running, part of its page table must be in main memory (including the page table entry of the currently executing page)

You might also like