







Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
Memory Management: Physical and Virtual Address Space; MemoryAllocation Strategies– Fixed and -Variable Partitions, Paging, Segmentation, Virtual Memory.
Typology: Study notes
1 / 13
This page cannot be seen from the preview
Don't miss anything!
Memory Management
1. What is Memory Management? Memory management is allocating, freeing, and re-organizing memory in a computer system to optimize the available memory or to make more memory available. It keeps track of every memory location (if its is free or occupied). Paging, and swapping, segmentation and compaction are modern computers four main memory management techniques. Swapping is the best technique for memory management because it provides the most efficient use of system resources. Memory allocation schemes 1. Contiguous memory management schemes: Contiguous memory allocation means assigning continuous blocks of memory to the process. The best example of i is Array. 2. Non-Contiguous memory management schemes: In this, the program is divided into blocks (fixed size or variable size) and loaded at different portions of memory. That means program blocks are not stored adjacent to each other. 2. Explain Physical and Virtual Address Space? An logical address is generated by the CPU is commonly referred as logical address and it is found in the memory unit is called as physical address. The collection of logical address that generates a program is called as logical address space and the collection of physical addresses corresponding to the logical address is called as physical address space.
2. Non Contiguous memory allocation i. Paging ii. Multilevel Paging iii. Inverted paging iv. Segmentation Types of Partitions Contiguous memory allocation can be achieved when we divide the memory into the following types of partitions: 1. Fixed-Sized Partitions Another name for this is static partitioning. In this case, the system gets divided into multiple fixed-sized partitions. In this type of scheme, every partition may consist of exactly one process. This very process limits the extent at which multiprogramming would occur, since the total number of partitions decides the total number of processes. 2. Variable-Sized Partitions Dynamic partitioning is another name for this. The scheme allocation in this type of partition is done dynamically. Here, the size of every partition isn’t declared initially. Only once we know the process size, will we know the size of the
partitions. But in this case, the size of the process and the partition is equal; thus, it helps in preventing internal fragmentation. On the other hand, when a process is smaller than its partition, some size of the partition gets wasted (internal fragmentation). It occurs in static partitioning, and dynamic partitioning solves this issue. Non-Contiguous Memory Allocation-
2.Multilevel Paging- Multilevel Paging is a paging scheme that consists of two or more levels of page tables in a hierarchical manner. It is also known as hierarchical paging. Advantages of multilevel Paging in Operating System:
3. Inverted paging: An alternate approach is to use the Inverted Page Table structure that consists of a one-page table entry for every frame of the main memory. So the number of page table entries in the Inverted Page Table reduces to the number of frames in physical memory and a single page table is used to represent the paging information of all the processes. SEGMENTATION: Segmentation is a memory-management scheme that supports user view of memory. A program is a collection of segments. A segment is a logical unit such as main program, procedure, function, method, object, local variables, global variables, common block, stack, symbol table and arrays. In the segmentation the logical memory can be divided into fixed sized blocks these blocks are called as segments. Segmentation is a memory management functionality that supports the user view of memory. In this, the logical memory is divided into segments and each segment consists of segments number and offset For example the segments in the user view of memory (logical address)is represented as follows.
Demand Paging (virtual memory) Demand paging is a process of swapping in the Virtual Memory system. In this process, all data is not moved from hard drive to main memory because while using this demand paging, when some programs are getting demand then data will be transferred. But, if required data is already existed into memory then not need to copy of data. The demand paging system is done with swapping from auxiliary storage to primary memory.
Some Page Replacement Algorithms are used in the demand paging concept to replace different pages – such as FIFO, LIFO, Optimal Algorithm, LRU Page, and Random Replacement Page Replacement Algorithms. Page Replacement Algorithms in Operating Systems
1. FIFO Page Replacement Algorithm FIFO algorithm is the simplest of all the page replacement algorithms. In this, we maintain a queue of all the pages that are in the memory currently. The oldest page in the memory is at the front-end of the queue and the most recent page is at the back or rear-end of the queue. Whenever a page fault occurs, the operating system looks at the front-end of the queue to know the page to be replaced by the newly requested page. Example: Consider the page reference string as 3, 1, 2, 1, 6, 5, 1, 3 with 3 - page frames. Let’s try to find the number of page faults: **Total page faults = 7 Total Hits=
4. Optimal Page Replacement Algorithm Optimal page replacement is the best page replacement algorithm as this algorithm results in the least number of page faults. In this algorithm, the pages are replaced with the ones that will not be used for the longest duration of time in the future. In simple terms, the pages that will be referred farthest in the future are replaced in this algorithm. Example: Let’s take the same page reference string 3, 1, 2, 1, 6, 5, 1, 3 with 3-page frames as we saw in FIFO. This also helps you understand how Optimal Page replacement works the best. Faults= Hits= 5. Random Page Replacement Algorithm This algorithm, as the name suggests, chooses any random page in the memory to be replaced by the requested page. This algorithm can behave like any of the algorithms based on the random page chosen to be replaced. Example: Suppose we choose to replace the middle frame every time a page fault occurs. Let’s see how our series of 3, 1, 2, 1, 6, 5, 1, 3 with 3-page frames perform with this algorithm: Faults= 6 Hits=