4.4k views

Which of the following statements is false?

1. Virtual memory implements the translation of a program's address space into physical memory address space
2. Virtual memory allows each program to exceed the size of the primary memory
3. Virtual memory increases the degree of multiprogramming
4. Virtual memory reduces the context switching overhead
edited | 4.4k views

(A) - MMU does this translation but MMU is part of VM (hardware).

(B), (C) - The main advantage of VM is the increased address space for programs, and independence of address space, which allows more degree of multiprogramming as well as option for process security.

(D) - VM requires switching of page tables (this is done very fast via switching of pointers) for the new process and thus it is theoretically slower than without VM. In anyway VM doesn't directly decrease the context switching overhead.

edited by
+2

clearly answer d is wrong . context switch is the time which cpu take while while saving the process state which is runing and then block it and then choosing the next process . how virtual memory is going to affect the cpu time of context switch.

+7
Currently process P1 is executing. After context switching process P2 comes in. Now, the same virtual address say 1000 generated by P1 and P2 must go to different (assuming no sharing) physical memory addresses. That is the page tables must change on context switch.
+1
I feel, to be precise, "Paging" performs translation from program's address space into physical memory address space. So its "paging that implements the translation of a program's address space into physical memory address space". Not virtual memory. Thus option A also sounds incorrect. Yes sometimes the address space as perceived by process/program is called logical/virtual address space. But then that is different concept from virtual address space that refers to the secondary memory space (part of HDD) that behaves like main memory (RAM). So actually, both options A and D sound incorrenct. Am I right?
0
@Arjun sir

Sir  suppose process p1  is in the running  state and processor is requested for some other  block which is not present in the main memory then  that  logical address  will be translated  into physical address by MMU and o.s will brought that  page in main memory  by DMA technique.

1.Now my doubt is ...  the running  process and then whole MMU thing (translation ) will work parallely ?   When will the context switching  occur?

2. After  address  translation  required block will be brought  into ready state.  so now the scheduler will decide  a/c to their scheduling criteria  that how it should  be processed.

So how is it effecting  to context  switching  ?

Thank you
+4

@bharti

the running  process and then whole MMU thing (translation ) will work parallely

Yes, it is done parallely ..at the same time..

When will the context switching  occur?

After translation , that reqiested page is brought from memory and brought into ready queue. Then some interrupt occur or preemption or running process is complete and waiting process is sent from ready to running queue.

After  address  translation  required block will be brought  into ready state.  so now the scheduler will decide  a/c to their scheduling criteria  that how it should  be processed.

yes correct..  a/c to their scheduling criteria it is happening .

So how is it effecting  to context  switching  ?

See more number of swaps == increase context switch means context switching is increase when number of swapping is increasing . How many times we take that process from ready to run that number determine context switching value ..

0
@ bikram sir

thank  you sir
0

@bikram sir
I think "context switching" here is referred as context switching time not the number of context switches.

more number of swaps == increase context switch

Then this line doesn't seem right.

0
Virtual memory has page tables.PAge table has their addresses and the address of page tables are stored in the PCB of the process.As the size of PCB in increased,so time for context switch will increase
0

"Virtual memory increases the degree of multiprogramming"

0
plz explain "independence of address space"
0

@Higgs

http://www.techtud.com/short-notes/virtual-memory-concept

@anshul

where is that written?

0

B, C - The main advantage of VM is the increased address space for programs, and independence of address space, which allows more degree of multiprogramming as well as option for process security.

+1
independence of address space means the program is concerned only about the virtual addresses. Where the data or code goes in physical memory is not its concern.So, the MMU can decide this as per the current memory usage and thus use the main memory to optimal capacity.
0

Thankyou @bhuv for that link but my doubt hasn't been resolved.

Since, Physical memory remains of same size, so how degree of multiprogramming increases??

(because no. of frames into which pages can be loaded remain unchanged.)

0
By making use of secondary memory to offload some pages.
0
Consider a hypothetical situation where we have 1GB RAM, 4KB pages.

Let, each process loaded into memory needs just one frame.

No. of processes = $2^{18}$.

So, how introdution of virtual memory will help in increasing the degree of multiprogramming

0

Consider another situation:

4 pages of each process are loaded and physical memory is fully utilized.
When need arises to run another process, won't some of the pages belonging to existing processes be offloaded without using virtual memory?

0

VM increases the context switching overhead . VM is based on demand paging so more number of swaps == increase context switch , during page fault .

1. Virtual memory implements the translation of a program's address space into physical memory address space

This statement is Correct.

Virtual memory require both hardwire (main memory and TLB) and OS support ( to control those hardwire) , that actual translation from program's address space to physical address space is done by main memory .  so statement A is correct . That makes option A wrong.

Only statement D is false and it is the answer .

0
@Bikram sir pls clear 2nd point wht does it mean ? primary memory refers to physical memory then how it exceeds?
0

That 2nd point , is main job of Virtual memory .

The term virtual  in ' virtual memory ' refers to memory address is Virtual.

So when memory address is virtual it can take any amount of memory space ..hence it looks like Virtual memory exceeds the size of physical memory .

It appears to me that none of the statement is wrong..probably question is wrong!..as definitely context switching time is reduced as only Page table pointer needs to be replaced in the MMU to point to new process page table which it can find in PCB. And VM surely increase the degree of multiprogramming as more processes can be squeezed in RAM...A and B are obviously correct.
0
But without virtual memory what needs to be done (with respect to memory access) on context switching?
+1
Old program needs to be copied back to the disk to load new program from disk when the new program  cannot fit in its entirety in main memory, and that is why VM is useful. Here is the link : http://www.eecs.harvard.edu/~mdw/course/cs161/notes/vm.pdf
+1

Only a pointer swap is needed to change the currently used page tables- but without VM, even that is not required.

"Old program needs to be copied back to the disk to load new program from disk when the new program  cannot fit in its entirety in main memory, and that is why VM is useful."

This is true, but they are already covered by the first three choices.