40 Lecture

CS501

Midterm & Final Term Short Notes

Virtual Memory

Virtual Memory is a memory management technique used in operating systems to allow processes to use more memory than is physically available in the system. It uses a combination of hardware and software to create the illusion of a larger memory


Important Mcq's
Midterm & Finalterm Prepration
Past papers included

Download PDF
  1. What is virtual memory? a) Memory that is stored on virtual machines b) A technique used to increase the apparent size of a computer's main memory c) A type of memory that can only be accessed by virtual machines d) A type of memory that is used for temporary storage Answer: b What is the purpose of virtual memory? a) To increase the amount of physical memory available to the operating system b) To speed up the execution of programs c) To create a virtual machine environment d) To store data temporarily Answer: a Which of the following is not a benefit of virtual memory? a) Programs can execute even when there is insufficient physical memory available b) It improves overall system performance c) It allows for faster access to data d) It provides a larger memory space for programs Answer: c What is a page fault? a) A type of error that occurs when a program tries to access memory that is not available b) A technique used by virtual memory to transfer pages of data between physical memory and disk storage c) A type of virtual memory that is stored on a hard disk d) A type of memory that is only used for temporary storage Answer: a What is the role of the page table in virtual memory? a) To map virtual addresses to physical addresses b) To store data temporarily c) To manage the transfer of pages of data between physical memory and disk storage d) To create a virtual machine environment Answer: a What is thrashing? a) A situation in which the operating system spends too much time managing virtual memory b) A type of error that occurs when a program tries to access memory that is not available c) A situation in which the system spends too much time transferring pages between physical memory and disk storage d) A type of virtual memory that is stored on a hard disk Answer: c What is the size of a page in virtual memory typically? a) 2 KB b) 4 KB c) 8 KB d) 16 KB Answer: b What is the purpose of a TLB in virtual memory? a) To speed up the mapping of virtual addresses to physical addresses b) To store data temporarily c) To manage the transfer of pages of data between physical memory and disk storage d) To create a virtual machine environment Answer: a What is the difference between demand paging and pre-paging? a) Demand paging loads pages into physical memory only when they are needed, while pre-paging loads pages into physical memory before they are needed b) Pre-paging loads pages into physical memory only when they are needed, while demand paging loads pages into physical memory before they are needed c) Demand paging and pre-paging are the same thing d) Neither demand paging nor pre-paging are used in virtual memory Answer: a Which of the following is an example of a virtual memory implementation? a) RAID b) SSD c) Pagefile d) BIOS Answer: c


Subjective Short Notes
Midterm & Finalterm Prepration
Past papers included

Download PDF
  1. What is virtual memory? Virtual memory is a memory management technique that allows a computer to use more memory than it physically has by temporarily transferring data from the RAM to the hard disk. What are the benefits of using virtual memory? Virtual memory allows a computer to run more programs simultaneously, enhances the performance of the computer, and helps to prevent crashes due to a shortage of physical memory. What is the page file? The page file is a portion of the hard disk that is reserved for virtual memory use. How is virtual memory allocated? Virtual memory is allocated in fixed-size blocks called pages. What is a page fault? A page fault occurs when the data that is needed by the CPU is not present in physical memory and needs to be fetched from the hard disk. What is the role of the operating system in virtual memory management? The operating system manages the virtual memory by allocating and deallocating pages, mapping virtual addresses to physical addresses, and handling page faults. What is thrashing? Thrashing is a phenomenon in which the computer spends most of its time swapping data between the RAM and the hard disk, resulting in poor performance. How does the size of the page affect virtual memory performance? A larger page size can improve the performance of virtual memory by reducing the number of page faults, but it can also lead to more wasted space. What is the difference between demand paging and pre-paging? Demand paging loads only the pages that are required by the program, while pre-paging loads additional pages in anticipation of their need. What are some strategies to optimize virtual memory performance? Strategies to optimize virtual memory performance include increasing physical memory, adjusting the page file size, using SSDs for the page file, and optimizing the program's memory usage.
Virtual memory is a memory management technique that allows a computer to use secondary storage, such as a hard disk drive or solid-state drive, as an extension of its primary memory. It allows a computer to run more programs than it could otherwise, by temporarily transferring data from RAM to disk storage. When the data is needed again, it can be transferred back from disk to RAM. Virtual memory provides a way to compensate for the limited amount of physical memory in a computer system. It enables a computer to use more memory than is physically available, by creating the illusion to the programs that they have more memory than they actually do. This can greatly improve system performance, as the system can continue to run programs even if it runs out of physical memory. Virtual memory works by dividing memory into fixed-size pages and storing them on the hard drive. When a program requests memory, the operating system checks to see if the data is already in RAM. If it is not, it loads the necessary pages from disk into memory, freeing up space on the disk as needed. The operating system manages the movement of data between RAM and disk, ensuring that the most frequently used data is kept in RAM for fast access. While virtual memory provides significant benefits, there are also drawbacks. When a program requests data that is not in memory, it must wait for the data to be transferred from disk, which can take much longer than accessing data in RAM. This can cause performance issues, particularly if a computer does not have enough RAM to run all the programs that are in use. Additionally, virtual memory relies heavily on hard drive access, which can be a bottleneck in some systems.