Memory Management under UNIX

Introduction

Memory management is an important function performed by an operating system. Other functions include coordinating input and output devices, integrating the user and computer communication, and controlling the utilization of the processor resources. In managing memory, an operating system allocates and de-allocates the computer memory to different processes. This follows certain scheduling criteria in which the running programs can be given a chance to use the computer memory. Memory management strategies include paging, swapping, segmentation, and virtual memory. Unix operating systems implement very complicated memory management procedures to subdivide the memory efficiently. To begin with, there are three types of memory that are reliable in the functioning of operating systems and programs. These include the main memory, file system, and swap space (Noble, 1).

The main memory consists of the Random Access Memory (RAM), which is located on the computer’s motherboard. The file system is the disc memory that can be accessed by proper pathnames. On the other hand, the swap space is the memory that enables efficient multiprogramming during the swapping process. Unix systems use the memory through cache, kernel, and virtual memory, while processes use memory as data, stack, and mapped memory (Sobell, 35). Thus, this paper discusses how FreeBSD Unix handles memory management in comparison to Open Suse Linux.

FreeBSD/UNIX Memory Management

Unix systems like the FreeBSD distribution maintain several types of information. The page representations for a certain process are also referred to as the page table, the status of the available pages in the memory, and the location of the swapped pages in the secondary storage. Thus, there are two different schemes of memory management in Unix systems. First, the paging system provides the operating system with the capability of maintaining a virtual memory. It allocates the page frame in the main storage to processes. Second, the kernel memory allocator dynamically creates and removes small memory tables (Stallings, 383).

There are three major paging system data structures used in Unix systems. They are described below:

Page Table Entry
Page Table Entry

The page table entry contains information about a single process. It is virtual to the physical location. The frame# represents the physical frame depicting the location of the virtual page. age represents the duration of the process that existed since the page was used. Copy to Write renders fork effectiveness in Unix systems. Dirty indicates whether the page had been altered since the last swap. Ref contains the clocking information for scheduling. Valid represent resident, as a Unix concept, a valid page is always in the main memory and an invalid one is swapped out. Protect holds authentication details for the page.

Disk Block Descriptor
Disk Block Descriptor

Disk block descriptor contains the description of the disc replica on every page. The FreeBSD system keeps these tables according to each process. Device# points to the swapping location. Block# is the exact location of the page. This is the reason why Unix-based systems have a separate swap partition, in order for the block size to be made the same as the page size. Type shows if the page is new or old.

Page Frame Data Table
Page Frame Data Table

This table holds data contained in each memory frame. Page State shows the availability of the frame. Ref. The count represents the available executable programs referring to the page. Logical Device maintains the number of the disk that has the page replica. Block# holds the block number. pfdata Pointer is a pointer that links frames in the frame table. The swap-use table is another table that contains information on swap devices (Tanenbaum & Woodhull).

Open Suse/Linux Memory Management

As compared to the Unix system, Linux memory management is more complex. First of all, Linux implements 3-level paging criteria. This is because operating systems such as Open Suse run on 32 and 64-bit hardware. Most of the 64-bit hardware has the support for 3-level paging. Consequently, Linux implements a buddy system allocator for page allocations and a slab allocator for sub-page distribution. The third reason for Linux’s complexity is the way it divides the main memory into zones in regard to hardware disparities. These zones are ZONE_DMA (first 16MB of Memory), ZONE_NORMAL (16MB – 896MB), and ZONE_HIGHMEM (above 896MB). The buddy system algorithm is thus used to allocate and de-allocate memory. Lastly, Linux has a complicated phased lifecycle for pages which makes the kernel postpone swapping tasks waiting a more appropriate time (Sobell).

The Paging System

FreeBSD and Suse Linux incorporate a Virtual Memory (VM) subsystem relying on swapping and demand to page. A lot of this capability is contained in the paging system which controls the content and functionality of pages that are acquired from the page layer. Both operating systems keep track of replaceable pages, which are incremented by the page replacement component and removed by demand for memory from user processes. Thus, the following paragraphs compare the techniques of the two OSs:

  • Swapping: This is a process of interchanging the contents of an area in the main memory with the contents of an area in the backing storage (Rusling, 1). Most Unix OSs use preemptive swapping, where data of altered pages are swapped when the physical memory is inactive. In FreeBSD Unix, all the idle processes are swapped in an event that the physical memory is small. However, Suse Linux just halts some processes when the physical memory becomes scarce and uses page replacement to remove dirty pages into swap files.
  • Page Replacement: Global Least Regularly Used (GLRU) is implemented in FreeBSD for memory pages. It also maintains page coloring to select the page to be replaced to avoid collision in the cache. Suse Linux implements an estimate of GLRU, which favors page substitution for pages with a minimum error rate (Sobell).

As a multiprogramming OS, Linux implements the virtual memory to relieve users from tight constraints of the main memory. Stallings outlines that virtual memory in Linux/Unix systems extends the swapping technology by loading only parts of the process’s address space at once (389). This enables the kernel functions to be executed without interruption. That is, once a process calls a function, the function normally runs to completion and returns before the CPU will be allocated to a different process. This is called a single-thread kernel since only one thread of execution is allowed to execute in the kernel at any one time; one thread of execution cannot start a function call and become interrupted by the scheduler to let another process run, hence process scheduling (Tanenbaum & Woodhull).

In conclusion, as an open-source system, Linux/Unix implements a paging technique in memory management, in which memory is broken down into chunks called paging. Consequently, virtual memory and swapping techniques are used to increase the efficiency of the processor and the system as a whole. As discussed in the paper, the Suse Linux implements 3-level paging, dividing the pages into zones. On the other hand, FreeBSD Unix relies on swapping techniques to free memory off dirty pages. In essence, both operating systems have been able to implement the same characteristics in memory management.

Works Cited

Noble, Seth. Memory Management. 2007. Web.

Rusling, David. Memory Management. 1999. Web.

Sobell, Mark. A Practical Guide to Linux. UK: Pearson Education, 2001. Print.

Stallings, William. Operating Systems: Internals and Design Principles. New Jersey: Pearson Prentice Hall, 2009. Print.

Tanenbaum, A. & Woodhull, A. Operating Systems Design and Implementation. 3rd Ed. New York: Prentice Hall, 2006. Print.

Video Voice-over

Cite this paper

Select style

Reference

Premium Papers. (2023, July 17). Memory Management under UNIX. https://premium-papers.com/memory-management-under-unix/

Work Cited

"Memory Management under UNIX." Premium Papers, 17 July 2023, premium-papers.com/memory-management-under-unix/.

References

Premium Papers. (2023) 'Memory Management under UNIX'. 17 July.

References

Premium Papers. 2023. "Memory Management under UNIX." July 17, 2023. https://premium-papers.com/memory-management-under-unix/.

1. Premium Papers. "Memory Management under UNIX." July 17, 2023. https://premium-papers.com/memory-management-under-unix/.


Bibliography


Premium Papers. "Memory Management under UNIX." July 17, 2023. https://premium-papers.com/memory-management-under-unix/.