Selasa, 19 Maret 2013



VIRTUAL MEMORY1. The basic concept of virtual memory:
Memory management is essentially putting all the parts of a process that will run into memory before the process is run. To that end, it's all part of the process should have its own place in the physical memory.
But not all parts of the process will be run, for example:
• Statement or the only option will be exercised in certain circumstances. Examples are: error messages only appear if an error occurs when the program is run.
• These functions are rarely used.
• Allocating more memory than necessary. Example: arrays, lists, and tables.
In a large-capacity memory, these things would not be a problem. However, the memory is very limited, this will decrease the utility of optimizing the physical memory space. As a solution to these problems is used the concept of virtual memory.
Virtual memory is a technique that separates between logical memory and physical memory. This technique hides the physical aspects of user memory by making the location of the virtual address memory in the form of bytes is unlimited and put some parts of the virtual memory in logical memory. In contrast to the limitations of the physical memory, virtual memory can hold program on a large scale, exceeding the capacity of the available physical memory.
Principle of virtual memory to remember is that: "The maximum speed of the execution process in virtual memory can be equal, but never exceed the speed of execution of the same process in the system without the use of virtual memory."
The concept of virtual memory was first suggested in 1961 Fotheringham on the Atlas computer system at the University of Manchester, UK (Hariyanto, Bambang: 2001)
As said above that only a portion of the program is placed in physical memory. This provides advantages:
• Reduced process I / O is needed (traffic I / O to be low). For example, for the program needs to read from the disk and insert the memory every time it is accessed.
• Space becomes more flexible due to the reduction of physical memory used. For example, to program the entire 10 MB is not included in the physical memory. Error messages included only if an error occurs.
• Increased response to declining load I / O and memory.
• Increasing the number of users that can be served. The memory space is still widely available allows the computer to receive more requests from users.
The main idea of ​​the virtual memory is a composite measure of the program, data and stack exceeds the number of available physical memory. The operating system stores the parts of the process that is being used in physical memory (main memory) and the rest are placed on disk. Once the parts are in the disk, then the part of memory that is not needed will be removed from physical memory (swap-out) and replaced (swap-in) by the disc's necessary.
The virtual memory is implemented in a multiprogramming system. For example: 10 programs with a size of 2 Mb of memory to run at a capacity of 4 Mb. Each program allocated 256 KByte and parts swap in process) into physical memory as needed and will be out (swap out) when not needed. Thus, multiprogramming system becomes more efficient.
Virtual memory can be done in two ways:
• Demand administration pages (demand paging)
• Demand segmentation (demand segmentation). Example: IBM OS / 2. Of demand segmentation algorithm is more complex, because it is rarely implemented.Demand Paging
Demand paging or granting requests page is one implementation of the virtual memory is the most commonly used. Demand paging) in principle similar to the request page (paging) it's just that page (page) will not be brought into physical memory until it is really needed. They need help from the hardware to determine the location of the page when it is needed.
Since the implementation of demand paging virtual memory, then the profits equally with the advantage of virtual memory, namely:
• Bit I / O is needed.
• Less memory required
• a faster response
• Able to serve more usersProblems on Demand Paging
There are three possible cases that may occur at the time of the required checks on the page, namely: existing and already in memory. Valid status ("1"). Page was still on the disk but not diberada in memory (had to wait until incorporated). Invalid status ("0"). Page does not exist, either in memory or on disk (invalid reference -> abort).

2. Memory management on Linux and Widows:

* In Linux:
As in solaris 2, Linux also uses a variation of the clock algorithm. Thread of the linux kernel (kswapd) will be run periodically (or be called when memory usage is excessive). If the number of free pages less than the upper limit of free pages, then the thread will attempt to free three pages. If less than the lower limit of free pages, the thread will attempt to free the six yard and sleep for a while before walking again. When he runs, it will check mem_map, a list of all pages contained in the memory. Each page has a byte that is initialized to the age of three. Each time the page is accessed, then the age is to be added (up to a maximum of 20), each time kswapd check this page, then the life will be reduced. If the age of a page has reached 0 then she can be exchanged. When kswapd trying to free pages, he first frees the page from the cache, if it fails he will reduce the file system cache, and if all else failed, he would stop the process. Memory allocation in linux using two primary allocation, the algorithm buddy and slab. For the buddy algorithm, each allocation exercise routine is invoked, he checked out the next memory block, if it is found he is allocated, otherwise the list will d iperiksa the next level. If there is a free block, it will be divided into two, one is allocated and the other moved to the list below.
* In Windows:Windows NT
Windows NT implements virtual memory using page requests through clustering. Clustering menanganani error page by adding not only affected by the error pages, but also pages that are around. At first the process was made, he was given the minimum working set minimum number of pages are guaranteed to be owned by the process in memory. If enough memory is available, the process can be given to as many pages maximum working set. Virtual memory manager maintains a list of free page frames. There is also a limit value associated with this list to indicate whether the available memory is sufficient. If the process had reached its maximum working set and an error page, then he should choose a replacement page with a local page replacement rules.
When the amount of free memory falls below the limit value, the virtual memory manager to use a tactic known as automatic working set trimming to restore the value of the above restrictions. It works by evaluating the number of pages allocated to the process. If the page allocation process has gotten more than its minimum working set, virtual memory manager will reduce the number of pages to the working-set minimum. If the free memory is available, the process of working on the minimum working set to get extra pages.

Categories:

1 komentar:

  1. I really appreciate you for this great information keep it up

    BalasHapus