What's purpose of having valid-invalid bits is page table?

12,447

Solution 1

In demand paging, only the pages that are required currently are brought into the main memory.

Assume that a process has 5 pages: A, B, C, D, E and A and B are in the memory. With the help of valid-invalid bit, the system can know, when required, that pages C, D and E are not in the memory.

In short:

a 1 in valid-invalid bit signifies that the page is in memory and 0 signifies that the page may be invalid or haven't brought into the memory just yet.

Solution 2

If an entry is invalid, then the MMU won't use it for address translation, causing a page fault when accessing the corresponding memory area.

Because the entry isn't used by the MMU the operating system can use it to store its own information, like for example a reference to the filesystem entity (for example inode number) where it stored the data to free the main memory for some other processes (it swapped that page out)

Upon a page fault the operating system can react then, using this information it previously stored inside that entry, to get back that data from the disk into the main memory.

Of course, the invalid bit is also used to mark just as it says pages as invalid: In most systems in usea process needs to explicitly request memory from the operating system, accessing memory that hasn't been granted to that process is an access violation.

Share:
12,447
Don Corleone
Author by

Don Corleone

Sophomore student of computer science in University.

Updated on June 04, 2022

Comments

  • Don Corleone
    Don Corleone almost 2 years

    I was reading Operating System Concepts , I'm unable to understand use of valid-invalid bits in page table. Each process has it's own process table, shouldn't all entries be valid then ?

    Valid-invalid bit attached to each entry in the page table:

    “valid” indicates that the associated page is in the process’ logical address space, and is thus a legal page

    “invalid” indicates that the page is not in the process’ logical address space