Virtual Memory in OS vs Virtual Device | 100% Easy Notes

By:   Last Updated: in: ,

Operating System: Q1.What is Virtual Memory in OS? Q2.What is Virtual Device? What are the advantages of virtual device? Q3.Explain the concept of virtual memory  in OS and how it is obtained by demand paging and segmentation? (Operating System all notes)

Virtual-Memory-vs-Virtual-Device-in-OS

Q1. What is Virtual Memory in OS?

Ans. Virtual Memory in OS: An imaginary memory area supported by some operating systems (for example, Windows but not DOS) in conjunction with the hardware. We can think of virtual memory in OS as an alternate set of memory addresses.
Programs use these virtual addresses rather than real addresses to store instructions and data. When the program is actually executed, the virtual addresses are converted into real memory addresses.

The purpose of virtual memory in OS is to enlarge the address space, the set of addresses a program can utilize. For example, virtual memory in OS might contain twice as many addresses aลก main memory.
A program using all of virtual memory in OS, therefore, would not be able to fit in the main memory all at once. Nevertheless, the computer could execute such a program by copying into main memory those portions of the program needed at any given point during execution.
Virtual-Memory-Diagram
To facilitate copying virtual memory into real memory, the operating system divides virtual memory into pages, each of which contains a fixed number of addresses. Each page is stored on a disk until it is needed. When the page is needed, the operating system copies it from disk to main memory, translating the virtual addresses into real addresses.

The process of translating virtual addresses into real addresses is called Mapping. The copying of virtual pages from disk to main memory is known as Paging or Swapping.

Q2. What is Virtual Device? What are the advantages of virtual device?

Ans. Virtual Devices: A virtual device mimics a physical hardware device, fundamentally tricking the CPU into believing that a device exists when it really doesn't.
For example, fax software can act as a virtual printer. When the print is selected, the document is sent to a fax/modem, which then sends information to another fax/modem or fax machine instead of a printer printing the file.

Advantages of Virtual Devices:

The advantages of virtual devices are:
(a) They are used to fix an error in the operating system. For example, a bug or a virus can be detected by supposing an external device is monitoring it.
(b) Virtual devices reduce the networking hardware investment and eliminate dependencies on hardware.
(c) They simplify management and access with centralized access control.
(d) Virtual devices allow us to reduce or eliminate the overhead associated with traditional networking components.

Q3. Explain the concept of virtual memory in OS and how it is obtained by demand paging and segmentation?

Ans. Virtual Memory in OS: Virtual memory is a memory hierarchy consisting of a computer system's memory and a disk, that enables a process to operate with only some portions of its address space in memory.

Virtual memory is implemented by demand paging. It is also implemented in a segmentation system. Several systems proved paged segmentation where segments are broken into pages but the operating system can implement this scheme with demand paging.

Demand segmentation can also be used to provide virtual memory. The segment replacement algorithm is very complex in use because of variable sizes of segments while the page replacement algorithm is easy to use and implement.

Virtual memory allows the execution of partially loaded processes. As a consequence, the sum of the virtual address space of active processes in a virtual-memory system can exceed. The capacity of the available physical memory provided that the physical memory is large enough to hold a minimum amount of the address space of each active process.

Thus, whereas the real memory system strive to approach 100% utilization of physical memory: The virtual memory system routinely provide apparent utilization factors in excess of 100%.






External Links:-

1. Virtual Memory in OS - (click here)
2. Virtual Device in Operating System - (click here)

2 comments:
Write comment