Memory Management in Unix Operating System Computer Science Essay
Memory Management in Unix Operating System Computer Science Essay
Disclaimer: This work has been submitted by a student. This is not an example of the work produced by our Essay Writing Service. You can v
Any opinions, findings, conclusions or recommendations expressed in this material are those of the authors and do not necessarily reflect the
Introduction to UNIX
According to Leon, 2007, UNIX is an operating system (OS) is software that manages hardware and software resources of a computer. UNIX wa
UNIX is one of the most widely used operating systems in industry, government and education. It is a stable, multi-user, multi-tasking system fo
Memory Partitioning
The simplest form of memory management is splitting up the main memory into multiple logical spaces called partition. Each partition is used f
There are two different forms of multiple partition allocation, which is fixed partitioning and variable partitioning. Fixed partitioning divides me
partitioning is more flexible because the partitions vary dynamically in the later as processes come and go. Variable partitioning (Variable mem
C:UsersEricDesktophssn picoverlay.jpg
Swapping
Swapping consists of bringing in each process in physical memory entirely and running it. When the process is no longer in use, the process wi
C:UsersEricDesktophssn picswapping.jpg
Initially only process A is in memory. Then process B is swapped into memory from disk. After that, process A terminates or swapped out to dis
https://www.ukessays.com/essays/computer-science/memory-management-in-unix-operating-system-computer-science-essay.php 1/4
12/7/2019 Memory Management In Unix Operating System Computer Science Essay
C:UsersEricDesktophssn picholes.jpg
Solution
There are two techniques to solve this problem, which are memory compaction and fit in the process using algorithms
Compaction
C:UsersEricDesktophssn piccompaction.jpg
Memory compaction moves all the processes upward as far as possible, so that all the free memory is placed in one large block. However, it is n
Most processes will grow as they run, and the processes data segments can grow, as in many programming languages, the process will grow. If
allowed to grow into the hole. Therefore it is good to allocate some extra memory whenever a process is swapped in or out.
Figure 1.7: Allocating Space for Growing Data (Extracted from http://www.cs.rpi.edu/~hollingd/opsys-fall2006/notes/Chapter4/Chapter4.pdf , 2
Algorithms
There are three different types of algorithm can be used to loads the program wherever the memory space is unused, which is first fit, best fit a
Algorithms
Descriptions
First Fit
The memory manager scans along the list and allocates the first space to fit the process. First fit is a fast algorithm because it searches as little a
Best Fit
The memory manager scans the whole list and takes the smallest hole that will fit the process. Best fit is slower than first fit because it must sea
Worst Fit
The memory manager scans the whole list and takes the largest available hole, so that the hole broken will be big enough to be useful.
Virtual Memory
UNIX operating system allows user to fully utilize the physical memory installed in the system as well as part of the hard disk called swap space
insufficient to handle the tasks.
Virtual memory managers will create a virtual address space in secondary memory (hard disk) and it will determine the part of address space to
memory relies on separation of logical and physical memory.
C:UsersEricDesktophssn picVR.jpg
Demand Paging
Paging is a memory allocation strategy by transferring a fixed-sized unit of the virtual address space called virtual page whenever the page is n
logical page can be placed in any physical frame of memory.
Every processes will be logical divided and allocate in the virtual address space. There is a page table in the virtual memory to allocate and keep
Figure 1.9: The relation between virtual addresses and physical memory addresses is given by the page table
UNIX will perform page swapping only when the program needs a certain page. This procedure is called demand paging. The page will be page
not be paged into the memory, only the pages needed are swapped in.
Demand paging decreases the paging time and physical memory needed because only the needed pages will be paged and the reading time o
https://www.ukessays.com/essays/computer-science/memory-management-in-unix-operating-system-computer-science-essay.php 2/4
12/7/2019 Memory Management In Unix Operating System Computer Science Essay
As the example in the figure, only page 6, 7, 8 and 9 is needed in Process A. Therefore, only pages 6, 7, 8 and 9 will be paged into the memory.
Figure 1.11: Page Fault Handling (Retrieved from Slides Material: Chapter 17 slides 6)
The diagram above illustrated the steps in handling page fault. When page fault occurs during program execution, the kernel will first locate th
free memory frame in the physical memory and copy into it. The page table will be reset after that and the instruction will be restart.
UNIX is using least recently used algorithm for page replacement. The least recently used algorithm replaces the page that has not been used f
The page table will record every time the page being referenced, and when page replacement is needed, every page will be checked to find the
Conclusion
Every operating system has different memory management. UNIX also has their exclusive memory management strategies to manage the mem
the memory can be stored and use more flexible.
UNIX uses overlays and swapping to replace the unused program. However, it is facing external fragmentation problem and solve by loading th
Besides, UNIX also fully utilized the virtual memory (physical memory and swap space) by using demand paging. It allows user to store physical
C:UsersEricDesktopkernel.jpg
– Only the needed pages to execute the program will be swapped in.
https://www.ukessays.com/essays/computer-science/memory-management-in-unix-operating-system-computer-science-essay.php 3/4
12/7/2019 Memory Management In Unix Operating System Computer Science Essay
Limitations
Appendices
Layered Architecture of the UNIX system(Extracted from Fundamentals of Computer Technology, 2007 by LEON.A. and LEON. M.)
Text Segment
Heap Storage
Stack Segment
Low Address
High Address
The UNIX-style Memory layout(Extracted from Operations Systems by Gary Nutt 1997, Chapter 11: Memory Management)
https://www.ukessays.com/essays/computer-science/memory-management-in-unix-operating-system-computer-science-essay.php 4/4