Managament Of Physical Memory Computer Science Essay

Published: Last Edited:

This essay has been submitted by a student. This is not an example of the work written by our professional essay writers.

In this report, the first part consists of Introduction to oprating system,introduction of linex operating system and memory management of linux . The memory management done two ways one is which is done by physical memory management and second is virtual memory managent which is in whole documents of the first part. Explanation of several techniques and Mechanism that Linux uses can be seen in this report. Specific techniques include paging and swapping. Some algorithms like the Least Recently Used Algorithm have been mentioned in this report.with the different types of problems and how does memory manages it are all include in the part one section.

The second part consists of Registers. What are the type of registers available ,what are the organizational registers,what are the reason and why it is used in processors.what are the registers size all this informations will be seen in the second section.

Introduction to Operating System

The operating system is the set of program which enables the computer user to interact

with computer system .when a user buy a fresh off computer without any operating system it will be able do absolutely nothing .computer cannot accept the inputs from the keyboard . cannot display data to the computer screen (monitor), and also cannot execute or start the application software such as Microsoft office internet explorer etc. All the other software such as device drivers runs under the control of operating system. Software access the hardware through the operating and following rules imposed by the operating system.

Key supports function such as communicating with the hardware, accepting and carrying out the user commands like loading a program, copy a file ,create a directory etc routinely performed by the operating system are very deceptively complicated in reality , but for a user they are very simple task Because the hardware are accessed by all the application software through the operating system ,it central position make it in ideal repository for these common share system routines

The components of modern operating system,To reflect the technological changes new features are constantly being added to the operating system to evolve overtime. On the other hand, the most modern operating system integrates the component as shown in figure

Introduction to LINUX:

Linux looks and feels much like any other Unix system, and indeed Unix compatibility has a major design goal of the Linux Project. Early in Its Development, Linux¿½s source code was made available for free on the internet, As a result, Its past has been one of the link by many users from the entire world, subsequent almost entirely over the internet.

The Linux System

In many ways, the linux kernel forms the core of the linux project,but other components make up the complete linux operating system. whereas the Linux kernel is composed entirely of code written from scratch specifically for the Linux project,much of the supporting software which makes up the Linux system is not exclusively to linux, but rather is common to a number of Unix like operating system.

Components of Linux

1. The kernel is responsible for maintaining all the important abstractions of the operating system, including such things as virtual memory and processes.

2. The System Libraries define as a regular set of functions, from which application can act together with the kernel, and which gear much of the operating system functionality that doesn¿½t need¿½s the full authority of kernel code

3. The System utilities are programs that perform individual, specialized management tasks. some system utilities may be involved just once to initialize and configured some aspect of the system; others (known as diamons in UNIX terminology)may run permanently, handling such tasks as responding to incoming network connection, accepting logon request from terminals, or upgrading log files.

Memory Management in Linux :

In Linux there are two main component of memory management first , physical memory management deal¿½s in groups of pages, small blocks of memory and freeing pages,. The second component handles virtual memory, which is memory mapping into address space of running processes.

1-Managament of Physical Memory:

The primary memory manager in linux kernel is page allocator. This allocator is responsible for allocating and freeing all physical pages. And it is also capable to allocate ranges of physical contiguous pages on request.

This allocator use buddy-heap algorithm to keep track of presented physical pages. This buddyheap allocator pairs adjacent units of allocatable together; hence its name. Each allocatable memory region has adjacent buddy, and whenever two billed associate regions are both freed up.they both gets combined to became a larger region. Then larger region also has a partner,with which it can combine to form still larger free regions.Alternatively,if a tiny memory demand cannot be satisfied by allocation of an existing small liberated area, then a larger free area will be divided into two buddies to satisfy each allowable size; under linux, the smallest size allocatable under this mechanism is a single physical page. Below diagram shows the example for Buddy-heap allocation:A 4 kilobytes regions is being allocated,but the smallest available region is 16 kilobytes. The region is broken up recursively until piece of desire size is available.

All memory distribution in the linux kernel either arise statically ,by drivers that reserve a contiguous of memory during system boot instant or energetically ,by the page allocator ,however kernel function do not necessary have to use the basic allocator to reserve memory.

Other three main subsystem that do their own management of physical pages are closely related. These are the buffer cache, the page cache, and the virtual memory system. The buffer cache is the kernel¿½s main cache for the block-oriented devices such as disk device ,and its main machanism is through which I/O to these devices performed. The page cache caches entire page of the file content, and is not limited to block devices;it can also cache networked data,and is used both by the native linux disk-based file systems and NFS networked file system. The virtual-memory system manages the contents of each process¿½s virtual address space.

Reading a page of data into the page cache require going temporarily through the buffer cache; pages in the page can also be mapped into virtual-memory system if a process has mapped a file into its address space.

2 ¿½ Virtual Memory:

In linux virtual memory is responsible for the maintaining of the concentrate on space which can be seen on each process. it make pages of virtual memories on order, and manages the loading of those pages since disk or their swapping back out to disk as necessary. under linux, virtual memory manager uphold two separate view of a process¿½s address space: as a set of disconnect regions and as a set of pages.

The first view of an address space is a logical view, describing instructions that the virtual memory system has received concerning the layout of the address space,in this view, the address space are made of set of no overlapping regions ,each region representing a continues, page-aligned subset of the address space. Each region is describe internally by a single vm_area_struct structure,which defines the properties of the regions, including the process¿½s,read,write,execute permission in the region, and the information about any files associated with the region. The regions for each address space are linked into a balanced binary tree to allow fast lookup of the region corresponding to any virtual address.

The kernel also maintain a second, physical view of each address space .this view is kept in the hardware page tables for process. This page table entries determine the exact current location of each page of virtual memory, weather it is on disk or in physical memory.

1-Virtual-Memory Regions

A virtual memory region is defined by its reactions to writes. the mapping of the region into the process address space can be either private or share. Space if a process writes to a privately mapped region, then the pager detects that copy_on_writes is necessary to keep the changes local to the process.

2-Life Time of virtual Address space

There are exactly two situations where the kernel well creates a new virtual address space: when the process executes a new program with the exec system is called and on creation of new process by the fork system call. The first case is easy: and when the new program run the process is given a totally empty and a new virtual address space. It is up to the routines for loading the program to crowd the address space with virtual memory regions.

In the second case, creating of a new process with division involve in creating a full copy of the presented process ¿½s virtual address space.

3-Swapping and Paging

An important task for the virtual-memory system is to locate pages of memory from physical memory is sanded to the disk when that memory is actually needed. Early unit Unix systems perform this relocation by swapping out the contents of entire processes at once, but modern Unixes rely more on paging: the movement of individual pages of virtual memory between physical memory and disk. Linux never does full-process swapping: it use the new paging mechanism.

The page system can be easily divided in two section. First, there is the policy algorithm, which describes that which pages to write to disk, and when it should be written. Second, there is paging mechanism, which carries out the transfer, and which page datas are back into physical memory whenever they are needed

Registers and Reasons

Registers are the temporary memory unit which stores words. The registers are actually located in the processors and not in RAM, so that the data can be easily accessed and stored faster than the normal speed.

Registers are used in computer system is place to store a wide range of data such as address ,programs counter ,or data¿½s which are necessary for the execution of program ,put simple ,registers are hardware devices that stores binary data. registers are located on the processors so informations can be accessed very fast.D flip-flops can be inused to implement registers. one D flip-flop is equivalent to a 1-bit register,so a collection of D flip-flop is necessary to store multi-bit values.

Type of registers:

CPU's may have many different types of register and from different manufacturers can make in whatever they want. Usualy there will be general purpose register in varying numbers, depending on the producers.The eight type registers are PC, AC, IR, TIR, +1, AMASK, MAR, and MBR, and are used as follows:

1. PC: Program Counter. Stores the address of the macro-instruction which are currently being executed.

2. AC Accumulator. Stores a previously calculated value or a value which are loaded from the main memory.

3. IR Instruction Register. Stores a copy of the instruction which are loaded from main memory.

4. TIR Temporary Instruction Register. As the CPU evaluates exactly what an instruction is supposed to do, this registers stores the edited instruction in the TIR.

5. 1 A constant that represents the number 1. The CPU is not able to access a number unless it is in a register or it is loaded from main memory, or somehow computed. Therefore this register is set aside to represent this usually used number,

6. AMASK Address Mask. When the CPU needs the address of a target word that an instruction is using, the AMASK is AND'ed with the instruction to eliminate the opcode, leaving only the desired address.

7. MAR Memory Address Register. This register has the address of the place the CPU wants to work in the main memory. It is connected to the RAM chips on the motherboard.

8. MBR Memory Buffer Register. This register contains the word which is either loaded from main memory or that is going to be stored in the main memory. It is also directly connected to the RAM chips on the motherboard.

Organisation types of registers:

The F-CPU design are typical Program Counters or instruction pointers 64-bit register, and are the usual Status (ST) 32-bit register.

It has a Memory Window (MW) 64bit register, which have the base address of the active memory window. This memory window is a set of 32 ,8byte blocks which can be easily used using short version of the standard commands. Data which are pointed to a memory window is usually already in the L0 data cache, providing zero-latency access. At any instant, there are 32 possible memories windows that can be accessed

F-CPU design also has several dedicated registers to control:

¿½ CPU Configuration

¿½ Memory Regions

¿½ FPU Control

¿½ Multiprocessing

¿½ Paging

¿½ Segmentation

¿½ Interrupt Processing

¿½ Coprocessor Control

¿½ Performance Monitoring

¿½ TimeStamp Counter Control

¿½ Reconfigurable Logic Control .

Register¿½s size:

Registers are local storage areas which are located in processor, that are used to keep data that is being executed by the processor. Every processors have few of these, some are completely dedicated to a certain tasks and others are available for common uses by the programmers. Register are the quietest memory available for the use , even quicker than the level ONE cache, as they are wired right onto the processor logic

Most of the operation which are done on register, the processor cannot directly perform calculation in memory for eg. If we want to add One to the memory location, the processors will usually it will be done by loading the actual value from memory into a registers, adding 1 to the register, and then will save the value back in memory. This thing happens very fast and clearly to the programmer.

Width of the processor¿½s register determines how much data can computed at one time. This sometime use to tag the processor's "size". For example, if we may hear people talk about 16 bit processor or 32 bit processor. This term refers to register¿½s size within CPU. The term is also usually misused, and many times people refers to the size of a processors based on its data bus width like which isn't really correct. Each and every processors which were introduce in the last few decade, from the earliest 386SX to the latest Pentium IV, is a 32 bit processor, on the bases of this definition.

As much as register are there in the processors, the more flexibility programmer has in writing there codes. It motivate the complexity of the processors. Compatibility is a normal issue, and later processor are stuck in limitations of the early processors design.


To conclude, I can say that Linux has been made with some very good technique for memory management,it can be any one can be an one physical memory management or in virtual memory management. Linux is known as one of the best operating system in managing its memory since it makes use of the best strategies like the swapping and paging. Owing to the restricted amount of space to write this report, I have only been able to talk about the basic concepts and not so deep about virtual memory and physical memory and the statergies they follow.

Frequently Asked Question about Linux Memory Management:

1) Why do we need memory managment?

? Inorder to perform task much faster and much secured with out any problems memory management is done.

2) Different components of memory managament?

? There are two main component of memeory management that is physical memory management and virtual memory management

3) What is the difference between swapping and paging?

? Swapping usually happpens when complete process is transfer to disk, while in paging process is put to disk while rest is still in the physical memory.

4) What is buddy-heap algorithm?

? Allocator normally uses buddyheap algorithm so that it can keep track of available physical pages.

References for memory management of Linux:


1- Operating System

Modern Perspective

Gary Nutt

Last accessed 23 march

2-operating system concepts

A-Silberschatz , J.peterson,Pgalvin

Available online:

Last accessed 2 April

3-Modern Operating System

Andrew s Tanenbaum

Available in Apiit Library


4-Pdf Books Available online at:

Last accessed: 14 March

5-Information about linux

Last accessed: 24 February

6- Files Available online at:

Last accessed: 14 March


1 -What are Register and there type

Available online at

Last accessed: 23 March

2-Register Size

Available online at:

Last accessed: 23 March

3-an Idia taken about register :

Available online at:

Last accessed: 3 April