Memory Management in Operating Systems

Course: Operating systemsTitle: Memory and Memory ManagementAuthor: Abigail SyanwaAdmission Number: 99270Lecturer: Mr. Philip Neri AbstractMemory management is a very important function in operating systems because any program execution requires us to put the program in the memory. (Hayes, 1998)Memory is a very important but finite resource; therefore, the aim is to optimize its use.This means that at no given time, should a program occupy the memory if it is not executing or waiting to be executed in the near future.

When memory is occupied by unused program code is wasted and with time, this memory waste is expensive to the operating system.This document highlights details about the Main memory in Operating systems.It will provide a detailed description of the various ways of defining and organizing memory hardware. It will also discuss the various memory management techniques including segmentation and paging.In addition, this document will focus on virtual memory.Giving the benefits of virtual memory in a system as well as the demand concepts, paging, page replacement algorithms and allocation of page frames.

Get quality help now
writer-Charlotte
writer-Charlotte
checked Verified writer

Proficient in: Data

star star star star 4.7 (348)

“ Amazing as always, gave her a week to finish a big assignment and came through way ahead of time. ”

avatar avatar avatar
+84 relevant experts are online
Hire writer

MemoryMemory, meaning main memory or primary memory is often related to semiconductor addressable memory.There are two main types of memory. Volatile and non-volatile Memory.Volatile memory is lost whenever the computer powers down theses are used as primary storage which is typically RAM. Non-volatile memory is that which can retain the data even when power is cycled, for example, flash memory which is used as secondary memory.Computer memory operates at higher speeds, unlike storage which takes a long time to access but has a higher capacity than computer memory.

Get to Know The Price Estimate For Your Paper
Topic
Number of pages
Email Invalid email

By clicking “Check Writers’ Offers”, you agree to our terms of service and privacy policy. We’ll occasionally send you promo and account related email

"You must agree to out terms of services and privacy policy"
Write my paper

You won’t be charged yet!

In some instances, the data in computer memory would need to be transferred to a secondary memory this is carried out through virtual memory. (Burrell, 2003)Main memoryThis includes RAM and ROMThe following are the characteristics of main memory: It is relatively expensive to run. A relatively small capacity. High performance. Frequently accessed compared to the secondary memorySecondary memoryThis includes the disk or flash memory.The following are the characteristics of secondary memory: It is cheap. It has a large capacity It is slowMemory OrganizationThis is how memory is organized in a computer.This can be done in different ways including: One process may use the entire memory space. Each process gets its own partition in the memory this can be dynamically or statically allocated.Main memory requires careful management because it is scarce in comparison to the secondary memory.Memory hardware hierarchy Figure 1 memory hierarchy (brightWays, 2014)This can also be described as 3 types of memory.Cache memory, main memory, and secondary memory respectively.The cache memory is a fast memory and it is found in the processor. Information that is gotten to every now and again can be put away in the store for quicker access. Current directions are put in the main memory. Secondary memory stores information that is not effectively required before a program runs, it must be moved from the secondary memory to the main memory. The Diagram above we consider that that as we move up the memory hierarchy the expense of the memory equipment incrementsMemory managementThe principle of memory management is ensuring optimal memory performance.This is done by the memory manager. The memory manager controls the following tasks,Decides which process stays within the memory space, how much memory will be allocated to each process, and Where in the memory will each computer process go.Memory management strategiesThe strategies can be divided into the following categories. Placement strategyIt decides where in the main memory to place the incoming data. Replacement strategyThis decides which data to remove from the main memory in order to make more space for the incoming data. This is an instance when there isn't enough memory, the data that is replaced for the incoming data is placed in the secondary memory. Fetch strategyIt demands the data then makes a decision on which data to load next to the main memory. (Remzi H. Arpaci-Dusseau, 2018)Memory management techniquesHow Far We Are with Various Techniques?Memory can be managed in Either uniprogramming or multiprogramming.In this document, I will focus on the memory management techniques that are used in multiprogramming. Contiguous AllocationThis is a method of organizing programs in computer memory. Here the program must exist in a single block of a contiguous address. At times it is impossible to find a block that is large enough to accommodate the entire program block. This has low overhead.Multiprogramming with fixed partitionsThe main memory is divided into a number of static partitions at system generation time. This can be either equal or unequal. The fixed partitioning placement algorithm can be done in the following ways.The first option is to divide the new process into multiple queues and to place those queues in different partitions in the main memory. The second option is to make the new process a single queue that occupies all the partitions in the main memory.AdvantagesSimple to implementMinimal Operating system overheadsDisadvantagesInefficientThe maximum number of active processes is fixed.Multiprogramming with variable numbers of partitionsThe main memory is divided into a number of partitions dynamically.Each process is loaded in a partition of exactly the same size of the process.There are the following placement algorithms.First fit-The first memory partition that is big enough is allocated to the programBest fit -The smallest partition that the program can fit in is allocated firstWorst fit-The largest partition that the program can fit in is allocated to the program.Non-Contiguous Allocation (Virtual memory)Programs are divided into small partitions known as segments. Each segment can be set in various parts of the PC memory this is known as dynamic allocation. This makes it simpler for the segments to discover memory that can suit the procedure. This tackles the overhead issue that is brought about by the contiguous memory allocation. Virtual memory gives the illusion of a bigger memory. The client is given the feeling that the whole program is in the RAM. AdvantagesThe utilization of virtual memory permits decoupling virtual addresses from physical locations. These don't need to be encoded utilizing a similar number of bits. Furthermore, it enables us to share the memory between processes. It additionally permits full use of the CPU power. The lastly, utilization of virtual memory makes it conceivable to consolidate together the RAM and at least one or more storage devices, for example, hard disks or SSDs to shape a virtual memory of a more noteworthy limit than the RAM accessible. Detriments May cause internal discontinuity of computer memory. Causes longer memory access times Causes inverted page tables.PagingVirtual memory is used. Computer memory is broken into several blocks of the same size. Figure 2 Paging explainedWhen paging, the physical and logical memory spaces are separated into equivalent estimated blocks. These are known as frames and the fixed-measure logical blocks are pages. At the point when processes are executing pages of logical memory space are put into the frames of the physical in the memory address space. Addresses produced to get to the frames are partitioned into two sections known as offset and the page number.Demand paging- In this version of paging, Pages are only loaded as they are requested as opposed to being generated before time.SegmentationA new process is divided into segments of a certain size and loaded into the logical memory address space. Each segment is named and allocated size during execution, the segments of the logical memory space are loaded into the physical memory space.The user specified address contains the name of the segment and the offset. These segments are indexed and referenced by the segment number instead of the name. The number that is allocated is used as an index in the segment table and the offset shows the length of a segment. The segment number and offset together make up the segment address in the physical memory space.Other memory management strategiesFragmentationAt whatever point a procedure is deleted or loaded from the physical memory block; it makes an 'opening' in the memory space called a fragment. Fragmentation makes the computer experience issues in apportioning contiguous memory space to processes. Fragmentation is characterized in two internal and external.Internal fragmentation.This happens when fixed sizes of memory blocks are distributed to processes when the memory assigned to the process is somewhat greater than the memory requested by the procedure, this makes free space in the allotted block, causing internal fragmentation. The recommendation is: the memory must be divided into blocks of differing sizes and allot the best block to the procedure.External fragmentationThis occurs when the memory space of variable size is dynamically allocated to processes.When the process is removed from memory, it creates free space in the memory causing external fragmentation. The solution:Paging and segmentationSwappingswapping is a part of ordinary computer tasks. It is imperative to give sharp thoughtfulness regarding excessive swapping this is on the grounds that it can cause inconveniences if the accompanying occasions happen more than once: Pages of a process are traded; the process can run and attempts to get to an exchanged page the page is restored (perhaps driving the emptying of pages from different processes) A little later this page is traded again If this arrangement of occasions is general Internal Fragmented (it is called collapse or thrashing) it shows that the measure of RAM is lacking to adapt to the present outstanding task at hand. The collapse has a negative effect on system performance since the CPU and I/O that can result from such a circumstance immediately surpass the heap forced by the genuine work of a framework. In extraordinary cases, the framework may not play out any helpful work and hoard every one of its assets for moving pages to and from memory. References1. brightWays. (2014). Computer organization notes. Retrieved from brightWays: Burrell, M. (2003). Fundamentals of Computer Architecture. Macmillan International Higher Education.3. Hayes, J. P. (1998). Computer architecture and organization. WCB McGraw-Hill.4. Remzi H. Arpaci-Dusseau, A. C.-D. (2018). Operating Systems: Three Easy Pieces. CreateSpace Independent Publishing Platform.

Updated: May 03, 2023
Cite this page

Memory Management in Operating Systems. (2019, Aug 20). Retrieved from https://studymoose.com/course-operating-systemstitle-memory-and-memory-managementauthor-abigail-syanwaadmission-number-99270lecturer-mr-essay

Memory Management in Operating Systems essay
Live chat  with support 24/7

👋 Hi! I’m your smart assistant Amy!

Don’t know where to start? Type your requirements and I’ll connect you to an academic expert within 3 minutes.

get help with your assignment