1
$\begingroup$

while reading I found this:

Present/Absent bit – Present or absent bit says whether a particular page you are looking for is present or absent. In case if it is not present, that is called Page Fault. It is set to 0 if the corresponding page is not in memory.

and

Valid and Invalid bit are present in the page table of concern process and it indicate whether address generated by cpu is valid or invalid and tells whether the address generated belongs to process address space or not.

Also since the page table contains only the page entries for a process so how come V/I bit present in page table tell that the generated address is not valid for the addresses not present in process.

I am a beginner, so please help me build my concepts.

$\endgroup$
1
  • $\begingroup$ Can you edit your question to credit the original source of all copied/quoted material? See our guidelines here: cs.stackexchange.com/help/referencing. This provides proper credit; and also provides the opportunity for people to check those sources for additional context. Thank you! $\endgroup$ – D.W. Feb 18 '19 at 20:22
3
$\begingroup$

Many people confuse these two bits. I'll try to explain the concept to best of my knowledge.

Let's say we have 32 bit architecture. so process virtual address space(VAS) will have size of 2^32. VAS space of a process has kernel code and data part and user code and data part.Page table of process contains entries for both user/kernel part. kernel page table entries are same for all processes that is these virtual addresses are mapped to same physical memory frame for all processes.because memory has just one copy of OS code.

process when initialized doesn't use the full VAS.virtual addresses which are not in use as of now have valid bit zero(Invalid). It can make use of more addresses by calling sbrk(), brk() system call.These system calls are used internally by malloc in C(if no holes are present already). which will add more virtual address to process page table that means it will make those pages valid.

Now there is a catch, page table entries which had valid bit set recently are not yet mapped to physical frames, that is where present/absent bit comes into picture. or if they are swapped out due to lack of physical memory.

Now when process will try to access these newly validated virtual address/swapped out address, as present bit is not set it will generate a page fault. Now we'll switch to kernel mode to service the page fault.OS has the disk address of the page to be loaded, once page fault service routine is finished it will make present bit set in the process page table. Meanwhile this page fault routine is being serviced,current process is contexted out and new process is given the cpu as per scheduling algorithm so that CPU cycles are not wasted.

I hope this answer helps.

$\endgroup$
0
$\begingroup$

Let us suppose you have 32 bytes of VAS and the page size is 4 bytes, so the total number of pages is 8. Now suppose that you have allocated 8 frames in PAS, but as of now you don't require all pages simultaneously. Now consider the following case: in the PAS you have only two pages of processes present. You can load all pages in a single frame, but you didn't. So whenever any request comes from the CPU (other than that already present in frame), for that request the valid/invalid bit will show zero.

The conclusion is that if the frame is allocated for a page, but that page is not present in PAS, then for that page, the page table entry will show 0 in the valid/invalid bit.

$\endgroup$
1
  • $\begingroup$ I tried to make your post more readable. Please check that I haven't introduced any mistakes. $\endgroup$ – Yuval Filmus May 4 at 17:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.