Presentation is loading. Please wait.

Presentation is loading. Please wait.

1. Memory Manager 2 Memory Management In an environment that supports dynamic memory allocation, the memory manager must keep a record of the usage of.

Similar presentations


Presentation on theme: "1. Memory Manager 2 Memory Management In an environment that supports dynamic memory allocation, the memory manager must keep a record of the usage of."— Presentation transcript:

1 1

2 Memory Manager 2

3 Memory Management In an environment that supports dynamic memory allocation, the memory manager must keep a record of the usage of each allocatable block of memory. This record could be kept by using almost any data structure that implements linked lists. An obvious implementation is to define a free list of block descriptors, with each descriptor containing a pointer to the next descriptor, a pointer to the block, and the length of the block. 3

4 Memory Management Algorithms 4

5 Best Fit:- The allocator places a process in the smallest block of unallocated memory in which it will fit. Worst Fit:- 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. 5

6 Memory Management Algorithms  First Fit:- 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.  Next Fit:- 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)  First Fit:- 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.  Next Fit:- 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) 6

7 Virtual Memory If your computer lacks the random access memory (RAM) needed to run a program or operation, Windows uses virtual memory to compensate.random access memory (RAM)virtual memory Virtual memory combines your computer’s RAM with temporary space on your hard disk. When RAM runs low, virtual memory moves data from RAM to a space called a paging file. Moving data to and from the paging file frees up RAM so your computer can complete its work.hard diskpaging file 7

8 Virtual Memory The more RAM your computer has, the faster your programs will generally run. If a lack of RAM is slowing your computer, you might be tempted to increase virtual memory to compensate. However, your computer can read data from RAM much more quickly than from a hard disk, so adding RAM is a better solution. 8

9 Paging File 9

10 Managing Virtual Memory The most common ways of determining the sizes of the blocks to be moved into and out of memory are: – Swapping – Paging – Segmentation 10

11 Swapping "Swapping" is the act of using this swap file. A swapping is a mechanism in which a process can be swapped temporarily out of memory to a backing store and then brought back into memory for continued execution. When you load a file or program, the file is stored in the random access memory (RAM). Since RAM is finite, some files cannot fit on it. These files are stored in a special section of the hard drive called the "swap file". 11

12 Swapping Swapping is a useful technique that enables a computer to execute programs and manipulate data files larger than main memory. The operating system copies as much data as possible into main memory, and leaves the rest on the disk. When the operating system needs data from the disk, it exchanges a portion of data (called a page or segment ) in main memory with a portion of data on the disk. DOS does not perform swapping, but most other operating systems, including OS/2, Windows, and UNIX, do. 12

13 Swapping Swapping is the one of the efficient regular and authentic approach of memory management. It is the process of swapping of higher priority process on the lower priority process. Advantages of swapping are as follows :- 1. higher degree of multiprogramming. 2. dynamic relocation. 3. greater memory utilization. 4. priority based scheduling. 5. less wastage of CPU time. 6. higher performance. 13

14 Paging paging in computer terms means that a file if created on your hard drive to act as extra RAM memory when your RAM memory is low. It is memory management technique. In which our Program Size is Big and our RAM size are small than OS divide the program into smaller pages and store into secondary storage. 14

15 Page Table A page table is the data structure used by a virtual memory system in a computer operating system to store the mapping between virtual addresses (VA) and physical addresses (PA). virtual memorycomputer operating systemvirtual addressesphysical addresses Virtual addresses are those unique to the accessing process.process Physical addresses are those unique to the hardware, i.e., RAM.RAM 15

16 Memory Management Unit (MMU) Sometimes called paged memory management unit (PMMU), is a computer hardware component responsible for handling accesses to memory requested by the CPU.computer hardwarememoryCPU Its functions include translation of virtual addresses to physical addresses (i.e., virtual memory management), memory protection, cache control etc.virtual addressesphysical addressesvirtual memory protection cache 16

17 Fragmentation Fragmentation means isolated or incomplete part. Fragmentation means something is broken into parts that are detached, isolated or incomplete. 17

18 Types of Fragmentation There are two types of Fragmentation :- 1) External Fragmentation 2) Internal Fragmentation 18

19 External Fragmentation It exists when there us enough total memory space available to satisfy a request, but available memory space are not contiguous. Storage space is fragmented into large number of small holes. Both first fit and best fit strategies suffer from this. First fit is better in some systems, whereas best fit is better for other. Depending on the total amount of memory storage, size, external fragmentation may be minor or major problem. 19

20 Internal Fragmentation Consider a multiple partition allocation scheme with a hole of 18,462 bytes. The next process request with 18,462 bytes. If we allocate, we are left with a hole of 2 bytes. The general approach to avoid this problem is to :- a) Break physical memory into fixed sized blocks and allocate memory in units based on block size. b) Memory allocated to a process may be slightly large than the requested memory. 20

21 Cache Memory A CPU cache is a cache used by the central processing unit of a computer to reduce the average time to access memory.cachecentral processing unitcomputermemory The cache is a smaller, faster memory which stores copies of the data from the most frequently used main memory locations.main memory As long as most memory accesses are cached memory locations, the average latency of memory accesses will be closer to the cache latency than to the latency of main memory.latency 21

22 Cache Memory When the processor needs to read from or write to a location in main memory, it first checks whether a copy of that data is in the cache. If so, the processor immediately reads from or writes to the cache, which is much faster than reading from or writing to main memory. 22


Download ppt "1. Memory Manager 2 Memory Management In an environment that supports dynamic memory allocation, the memory manager must keep a record of the usage of."

Similar presentations


Ads by Google