MEMORY MANAGEMENT
Memory management is vital in a multiprogramming system. If only a few processes are in memory, then for much of the time of the processes will be waiting for input output and the processors will be idle. Thus, memory needs to be allocated efficiently to pack as many processors into memory possible.
OBJECTIVES
a) Relocation
b) Protection
c) Sharing
d) Logical organization
e) Physical organization
VIRTUAL MEMORY
Virtual Memory systems separate the memory addresses used by a process from actual physical addresses, allowing separation of processes and increasing the effectively available amount of RAM using disk swapping. The quality of the virtual memory manager can have a big impact on overall system performance.
PAGING
paging is one of the memory management schemes by which a computer can store and retrieve data from secondary storage for use in main memory. In the paging memory-management scheme, the operating system retrieves data from secondary storage in same-size blocks called pages. The main advantage of paging is that it allows the physical address space of a process to be noncontiguous. Before the time paging was used, systems had to fit whole programs into storage contiguously, which caused various storage and fragmentation problems.
SEGMENTATION
segmentation is similar to dynamic partitioning. In the absence of an overlay scheme or the use of virtual memory, it would require that all of a program’s segments be loaded into memory for execution. The different, compared with dynamic partitions, is that with segmentation a program may occupy more than one partition, and this partitions need not be contiguous. Segmentation eliminates internal segmentation, but like dynamic partitioning it suffers from external fragmentation. However, because a process is broken up into a number of smaller pieces the external fragmentation
should be less.
MEMORY RELOCATION POLICY
In systems with virtual memory, programs in memory must be able to reside in different parts of the memory at different times. This is because when the program is swapped back into memory after being swapped out for a while it can not always be placed in the same location. The virtual memory management unit must also deal with concurrency. Memory management in the operating system should therefore be able to relocate programs in memory and handle memory references and addresses in the code of the program so that they always point to the right location in memory.
LOCATION OF OUTDOOR SYSTEM
- The allocator places a process in the smallest block of unallocated memory in which it will fit.
Problems:
- It requires an expensive search of the entire free list to find the best hole.
- More importantly, it leads to the creation of lots of little holes that are not big enough to satisfy any requests. This situation is called fragmentation, and is a problem for all memory-management strategies, although it is particularly bad for best-fit.
- Solution:One way to avoid making little holes is to give the client a bigger block than it asked for. For example, we might round all requests up to the next larger multiple of 64 bytes. That doesn't make the fragmentation go away, it just hides it.
- Unusable space in the form of holes is called external fragmentation
- Unusable space in the form of holes is called external fragmentation
- The memory manager places process in the largest block of unallocated memory available. The ides is that this placement will create the largest hole after the allocations, thus increasing the possibility that, compared to best fit, another process can use the hole created as a result of external fragmentation.
- Another strategy is first fit, which simply scans the free list until a large enough hole is found. Despite the name, first-fit is generally better than best-fit because it leads to less fragmentation.
Problems:
- Small holes tend to accumulate near the beginning of the free list, making the memory allocator search farther and farther each time.
- The first fit approach tends to fragment the blocks near the beginning of the list without considering blocks further down the list. Next fit is a variant of the first-fit strategy.The problem of small holes accumulating is solved with next fit algorithm, which starts each search where the last one left off, wrapping around to the beginning when the end of the list is reached (a form of one-way elevator).
RELOCATION OF PAGING SYSTEM
Least Recently Used (LRU):
- - Removes page least recently accessed
- - Efficiency
- - Causes either decrease in or same number of interrupts
- - Slightly better (compared to FIFO): 8/11 or 73%
- - LRU is a stack algorithm removal policy
- - Increasing main memory will cause either a decrease in or the same number of page interrupts
- - Does not experience FIFO anomaly
Two variations:
- - Clock replacement technique
- - Paced according to the computer’s clock cycle
- - Bit-shifting technique
- - Uses 8-bit reference byte and bit-shifting technique
- - Tracks usage of each page currently in memory
First In First Out (FIFO):
- - Removes page in memory the longest
- - Efficiency
- - Ratio of page interrupts to page requests
- - FIFO example: not so good
- - Efficiency is 9/11 or 82%
FIFO anomaly:
- - More memory does not lead to better performance
Tiada ulasan:
Catat Ulasan