What is virtual memory? Disadvantages, advantages and methods of doing!!




Virtual memory is an operating system feature that enables the computer to compensate for the lack of physical memory by transferring data from random access memory to disk storage.


This process is temporary and is designed to work with a combination of RAM and hard disk space.


This means that when RAM is depleted, virtual memory can move data from RAM to a space called a paging file. This process frees up RAM space and the computer completes its task.


Sometimes a message may be displayed to the user saying that virtual memory is not enough, which means that either more RAM space needs to be added or the paging file size needs to be increased.

What is virtual memory? In other words

Virtual memory is a memory management technique based on which secondary memory can be used as part of the main memory. Virtual memory is a common method used in computer operating systems (OS).


Virtual memory uses both hardware and software to enable the computer to compensate for the lack of physical memory and to temporarily transfer data from random access memory (RAM) to disk storage. Transferring memory packets to hard disk files enables the computer to treat secondary memory like main memory.

Today, most personal computers (PCs) come with at least 8 GB (GB) of RAM. But, sometimes, this space is not enough to run several programs simultaneously. This is where virtual memory comes into play. Virtual memory transfers recently unused data to a storage device, such as a hard drive or solid-state drive (SSD), so that RAM space can be freed up.


Virtual memory to improve system performance, multitasking, and use very large applications; is important. However, users should not rely too much on cyberspace, as this memory works significantly slower than RAM. If the operating system is forced to exchange data in most cases between virtual memory and RAM, the computer will slow down - this is called a crash.


Virtual memory was introduced and used when physical memory - known as RAM - was expensive. The amount of RAM in computers is limited, so if several programs want to run simultaneously, the RAM space will be short. The system uses virtual memory to use part of the hard drive to simulate RAM. Using virtual memory, a system can run larger programs or multiple programs simultaneously; And without the need to buy more RAM, it looks like it really has more storage space.

How does virtual memory work?

Virtual memory uses both hardware and software to function. When an application is executed, the application's data is stored in a physical address using RAM. A memory management unit (MMU) transmits the address to RAM and automatically translates the addresses. The MMU can, for example, map a logical address space to a corresponding physical address. If anywhere, RAM space is urgently needed for a subject, data can be transferred from RAM to virtual memory.


The computer memory management unit actually tracks and tracks these transfers between virtual and physical memory. If the data is needed again, the computer MMU uses the context switch to resume execution.

When copying virtual memory into physical memory, the OS divides the memory by the number of addresses or page files or swap files, which is a fixed value. Each page is stored on a disk, and when needed, the operating system copies it from the disk to the main memory and translates the virtual addresses into real addresses.


However, the process of exchanging virtual memory with physical memory is relatively slow. This means that virtual memory usually reduces performance significantly. Because of the exchange of information, it is often assumed that computers with more RAM perform better.

Types of virtual memory

Computer MMU can manage virtual memory functions. On most computers, the MMU hardware is integrated with the CPU. The CPU also creates virtual address space. In general, virtual memory is either paginated or segmented.


Paging divides memory into several sections or paging files. When a computer uses the available RAM, pages that are not in use; Transferred to a hard drive using an exchange file. Is a space swap file on the hard drive that should be used as a virtual memory extension for computer RAM. When a swap file is required, it is sent back to RAM using a process called page swapping. This system ensures that the computer operating system and applications do not run outside of real memory. The maximum page file size can be up to 4 times the physical memory of a computer.

The virtual memory pagination process uses page tables, which translate the virtual addresses used by the operating system and applications into the physical addresses used by the MMU. Inputs to the page table indicate whether the page exists in Rome. If an operating system or application does not find what it needs in Rome; The MMU then responds with a page error to the lost reference memory to force the operating system to return the page to memory when needed. When a page exists in Rome, its virtual address appears on the table page.


Segmentation is also used to manage virtual memory. This approach divides virtual memory into sections of different lengths. Unused partitions in memory can be moved to virtual memory space or hard drive.

Processes or segmented information are tracked in a segment table that indicates whether a segment exists in memory, whether it has been modified, and what its physical address is. In addition, file systems in segmentation consist only of segments that are mapped to the potential address space.


Segmentation and pagination differ in how memory is segmented. However, the two methods can be combined. In this case, the memory is divided into pages or frames. Segments occupy multiple pages, and virtual addresses include segment numbers and page numbers.


Other page replacement methods include the First Input-First Output method, the Optimal Page Algorithm, and the LRU, which are less commonly used recently. The FIFO (first input-first output) algorithm has memory and replaces older pages that have been in the virtual address for a long time with new ones.


The optimal page algorithm method selects the pages to be replaced based on which page is less likely to be used after the longest possible time. Although this method is difficult to implement, it results in fewer page errors. The LRU screen replacement method replaces a page that has been unused for a long time in the main memory.

How to manage virtual memory

Managing virtual memory on an operating system is fairly straightforward, as there are default settings that determine the amount of hard disk space that is allocated to virtual memory. These settings will work for most applications and applications, but there may be situations where the amount of hard disk space allocated to virtual memory needs to be reset manually - for example, when working with applications that run on time. The quick response depends on when the computer has multiple hard drives (HDDs).


When manually resetting the virtual memory, the minimum and maximum amount of usable hard disk space that can be used must be specified. Allocating too little HDD space to virtual memory can fill up your computer's RAM. If a system constantly needs more virtual memory space, increasing RAM is a wiser solution. Conventional operating systems may generally advise users not to increase virtual memory by more than 1.5 times the amount of RAM.

Virtual memory management varies by the operating system. For this reason, IT professionals need to master the basics of topics such as physical memory management, virtual addresses, and virtual memory.


RAM cells in SSDs also have a limited lifespan. In RAM cells, the number of writes is limited, so using them for virtual memory often shortens the life of the drive.


What are the benefits of using virtual memory?

The advantages of using virtual memory are:


  • It can handle twice as many addresses as the main memory.
  • It can enable most applications to run at least once.
  • Releases applications from shared memory management, and the user no longer has to use additional memory modules when RAM runs out.
  • Increases speed when only one segment of an application is required to run.
  • Increases security due to memory allocation.
  • Allows several larger programs to run simultaneously.
  • Memory allocation is relatively inexpensive.
  • No need for external fragmentation.
  • CPU utilization is efficient for managing logical partitioning workloads.
  • Data can be transferred automatically.
  • During the fork operation, which creates a copy of itself; Allows sharing of pages in the main process.

In addition to these benefits, in a virtualized computing environment, network administrators can allocate everything from user virtual memory management methods to memory to a virtual machine (VM) that requires a lot of memory to run.

What are the limitations of using virtual memory?
Although there are benefits to using virtual memory, there are some considerations that need to be considered, such as:

  • If programs run from virtual memory, their execution speed will slow down.
  • Data must be mapped between virtual and physical memory; This requires additional hardware support for translating addresses and slows down the computer further.
  • Virtual storage size is limited due to the size of the secondary storage and the addressing scheme with the computer system.
  • If not enough RAM, trashing may occur, slowing down the computer.
  • Switching between applications using virtual memory can be time-consuming.
  • Reduces the space available on the hard drive.
Comparison of virtual memory (virtual RAM) with physical memory (RAM)
When we talk about the difference between virtual and real memory, the biggest difference usually speeds. RAM speeds are significantly faster than virtual RAM. On the other hand, RAM is much more expensive than virtual memory.

When the computer needs storage, RAM is used first. Slower virtual memory is only used when RAM is full.

Comparison of RAM with physical memory

Virtual memoryRAM
Uses a segment of physical memoryPhysical memory
SlowerFaster
Use paginationUse swapping techniques
Limited by the size of physical memoryLimited by RAM chip size
Does not have direct access to the CPUIt can access the CPU directly
Limited depending on the size of the computer hard driveRAM can be increased by installing more RAM chips

Users can increase the amount of RAM if needed by purchasing and installing more RAM chips. When memory swallowing occurs too much and the user encounters a slow computer; Increasing RAM can be helpful. The size of the RAM depends on what is installed on the computer. Virtual memory, on the other hand, is limited depending on the size of the computer's hard drive. Virtual memory settings can often be controlled through the operating system.
In addition; RAM uses swap methods, while virtual memory uses pagination. While physical memory is limited by the size of the RAM chip, virtual memory is limited by the size of the hard disk. RAM also has direct access to the CPU, while virtual RAM does not.

Virtual memory usage history

Before the development and use of virtual memory, computers had RAM and secondary memory. Newer computers used magnetic core memory for primary memory and magnetic drums for secondary memory. Computer memory was usually expensive and scarce until the 1940s and 1950s. As the size and complexity of computer programs progressed, developers became more concerned that their programs would use up all of their main memory and run out of computer memory.

In the early days, programmers used a process called overlaying to run programs that were larger than the available memory. Parts of the program that are not used consistently are set to overlay, and existing overlays will be overwritten when needed. This requires extensive programming to do the overlaying work, which is the main motivation for developing and using virtual memory.

The German physicist Fritz Rudolf Gontsch became famous in 1956 for developing and using virtual memory, although this was later discussed. Nevertheless, Gunesh eventually described and introduced a type of cache.


The first real-world example of a virtual memory system was provided by the University of Manchester in Manchester, England, in an effort to develop and expand the single-level memory system for the Atlas computer. The system uses pagination to map virtual addresses to a programmer on main memory. Atlas was developed in 1959 and later launched in 1962.

In 1961, the first commercial computer with virtual memory was introduced by Burroughs. In this version of virtual memory, segmentation methods were used instead of pagination.

In 1969, IBM researchers showed that virtual memory storage systems performed better than older handheld systems. This issue is still under discussion and there are doubts about it. Mainframes (minicomputers) and minicomputers in the 1979s generally used virtual memory. Virtual memory technology was not used in early PCs because the developers believed that running out of memory could not be a problem for these computers. This hypothesis was later proved to be incorrect. Intel introduced virtual memory in the 80286 processor protected state in 1982; It also introduced pagination support when the 80386 was introduced in 1985.



Post a Comment

0 Comments