Overview Of Memory Management

Print   

02 Nov 2017

Disclaimer:
This essay has been written and submitted by students and is not an example of our work. Please click this link to view samples of our professional work witten by our professional essay writers. Any opinions, findings, conclusions or recommendations expressed in this material are those of the authors and do not necessarily reflect the views of EssayCompany.

Abstract

This paper consists of 2 sections which explain about Operating System and Computer System Architecture (CSA). In the first section, it involves the memory management of Linux Operating System where include types of mechanism employed and strategies used to manage the memory, problems faced by these techniques and solutions to overcome them. In the second section, it involves the usage of registers in a modem computer where include types of registers, register size, organization types of registers and reasons for registers.

Section 1: Operating System

1.0 Introduction

Linux is an open source operating system, which is kind of an adapted of a UNIX operating program as noted by What Is Linux in their article What Is Linux? (1999). First released of Linux operating system is on 5 October 1991 by Linux Torvalds. Nowadays, Linux had changed and it is no longer requires users to comprehend codes or programming expertise to be about to work on Linux. However, Linux wasn’t commonly used by majority of home users. Even so, programmers, server-side buyers prefer Linux because of its solid safety measures and functions fantastically in the arena of server and hosting solutions.

2.0 Overview of Memory Management

In the article, "Memory Management" (2013) from Tech Target stated that memory management is the process of controlling and coordinating computer memory, assigning portions called blocks to various running programs to optimize overall system performance. Memory management can be resides in hardware, operating system, and programs and applications.

In hardware, memory management involves components that physically store data, such as memory caches, random access memory chips (RAM), hard disk drives (HDD) and solid-state drives (SSD). In operating system, it involves the allocation and constant reallocation of memory blocks to programs due to the change of user demands. In programs and applications, memory management combines two tasks which are allocation and recycling, to ensure the availability of adequate for the objects and data structures.

3.0 Memory Management in Linux

Memory management of Linux contains two components. The first component was to deal with allocating and freeing physical memory. The second component was to handle virtual memory.

3.1 Management of Physical Memory

As indicated by Silberschatz, B.Galvin & Gagne (2001, p.716), the primary physical memory manager in the Linux is the page allocator and it is responsible for allocating and freeing all physical pages and, is capable of allocating ranges of physically contiguous pages on request.

As noted by Memory Management’s article "The Memory Management Reference Beginner’s Guide Allocation (2012), Linux uses a buddy-heap algorithm to keep track of available physical pages. The allocator will allocate blocks of certain sizes and has many free lists, one for each permitted size. The permitted sizes are usually either powers of two or form a Fibonacci sequence, such that any blocks can be divided into two smaller blocks of permitted sizes except the smallest. When the allocator receives a request for memory, it rounds the requested size up to a permitted size, and returns the first block from that size’s free list. If the free list for that size is empty, the allocator splits a block from a larger size and returns one of the pieces, adding the other to the appropriate free list.

C:\Users\Ng\Dropbox\Figure 3.1.jpg

Figure 3.1: Splitting of memory in a buddy-heap. This was shown in Silberschatz, B.Galvin & Gagne (2001, p.718)

In Figure 3.1, an allocator starts off with single block of 16kB. An application requested a block of 4kB, the allocator would check its 4kB free list and find whether has any free blocks of that size. If it was not available, the allocator would then split the block recursively until 4kB free block is available.

3.2 Virtual Memory

As noted by Operation Systems Concepts and Design, Milan Milenkovic (1992, p.242), virtual memory is a memory-management scheme where only a portion of the virtual address space of a "resident" process may actually be loaded into physical memory. Linux virtual memory system is to maintain the address space visible to each process by create pages of virtual memory on demand and manages the loading of those pages from disk or their swapping. There are two mechanisms Linux used are as follow:

3.2.1 Swapping

Swapping will be execute on a process to a backing store when temporarily out of memory and then bring back the process into memory for execution.

C:\Users\Ng\Desktop\IMG_1264.JPG

Figure 3.2: Swapping of two processes using a disk as a backing store. (Silberschatz, B.Galvin & Gagne in 2001, p.281)

In a round-robin CPU-scheduling algorithm environment like Linux, the memory manager will start swap out the process that just finished when a quantum expired. After that, it will swap in another process to the memory space that has been freed. When it finishes its quantum, the process will be swapped with another process. Ideally, the memory manager can swap processes fast enough so that some process will be in memory and is ready to be executed when CPU scheduler wants to reschedule the CPU. The quantum must be sufficiently large so that the processes can be done between swaps.

In the article "All about Linux swap space" (2007), it stated there are two forms of swap space in Linux which are swap partition and swap file. Swap partition is a separated area of the hard disk which is solely for swapping purpose only while swap file is special file in the system that resides between your system and data files. Linux will interleave its swapping activity between them if both are appointed with same priority, and it will increase the swapping performance. Swap file can be created, prepared and mounted in fashion. It needs not required users to look for an empty repartition or partition a disk in order to add additional swap space.

3.2.2 Demand Paging

Page replacement algorithm is used by Linux in demand paging mechanism. It uses the design of Page Frame Reclaiming Algorithm (PFRA) in the last version of Linux kernel 2.6. Here is some general ideas and rules adopted by PFRA which stated by P.Bovet & Cesati (2005, p.679).

First of all, free the "harmless" pages. Before belonging to the User Mode address spaces of the process, the pages that are not referenced by any process should be first reclaimed. The page frame reclaiming can be performed without modification on any Page Table entry.

Next, make all pages of a User Mode process reclaimable. The PFRA must be able to steal pages of a User Mode process due to the exception of locked pages. Therefore, the idle process will lose all their page frames little by little after sleeping for a long period.

The last will be reclaiming "unused" pages only. The simplified version of Least Recently Used (LRU) replacement algorithm is used in order to classify in-use and unused pages. It can be classified as "unused" if there is no access performed on a page for a long time and low probability that it will be accessed in future. The PFRA will only reclaim the unused pages.

4.0 Bottleneck in Linux’s Memory Management

As indicated by Silberschatz, B.Galvin & Gagne (2001, p.293), the page table that stored in main memory is pointed by a page-table base register (PTBR). The only problem in page table is the access time used on accessing user memory location. Index is needed using the value of PTBR for the particular page number of i which requires a memory access when we wanted to access location i and it causes a delay by a factor of 2. This is because two memory accesses are needed to access a single byte, one for the page-table entry and one for the byte.

Swapping is used to increase utilization of the processor and improve the responsive of the operating system. But it does slow down the system performance by little due to accessing to disk is very slow compared to memory. Memory speeds can be measure in nanoseconds while disk can only be measured in milliseconds. Therefore, accessing the physical memory can be ten thousand times faster than accessing the disk. Other than that, excessive swapping or thrashing can happen where a page was swapped in and out repeatedly in a very short time.

In variable partition, Linux will leave a whole (unused memory) when a program terminate. For example, when program 1 with 10kb and program 2 with 20kb terminate, it will leave two holes with 10kb and 20kb separately. When a new program 3 with 30kb need to process but there is no unused memory, this phenomenon called "external fragmentation".

5.0 Solutions for Bottleneck of Linux’s Memory Management

As indicated by Silberschatz, B.Galvin & Gagne (2001, p.293), there is a standard solution to solve paging’s problem. The solution is using a special, small and fast lookup hardware cache named translation look-aside buffer (TLB). The TLB is an associative, high speed memory with each entry consists of two parts which are a key and a value. It compared with all the keys at the same time inside the TLB when an item is presented. When the item is found, the corresponding value field is returned. The search in TLB is fast; therefore it is bringing back the performance to the system.

The system is struggling to look for free memory to keep the applications running at the same time when there is an excessive swapping occurred. RAM can be added so that there is a larger swap space for swapping in order to improve the system performance. The user may allocate two or more swap space to speed up the swapping process after sufficient RAM provided.

To solve external fragmentation problem, memory compaction is the best solution. Memory compaction is combine small holes and become a large hole. Therefore the unused memory will be used when new program needed to process.

6.0 Conclusion

From the explanation about, it shows that Linux’s Memory Management is having a lot of mechanism which make it become very complex. But yet, the performance of Linux was not lower down. It provides a flexibility environment for its user. Besides, most of the problem faced by Linux’s Memory Management can be solved. It is because the evolution of the technology contemporary and allowed users to do more on Linux by the hardware specifications.

Section 2: Computer Systems Architecture

7.0 Introduction

Registers are special, high speed storage area built inside the CPU. It may hold a storage address, a computer instruction or any kind of data, such as individual characters or bit sequence. Usually register is measured by number of bits such as 16-bit or 32-bit. The amount of registers owned and their size determining the execution speed of CPU. Besides that, register can contain the address of the memory location where the data is stored rather than real data itself.

8.0 Reasons for Registers

Registers are used in CPU design for variety purposes, from storing the address of the currently-executed instruction to more general-purpose data storage and manipulation. As noted in Schoolnet in their article Data registers (2013), they hold the material that the CPU is currently working with and they can be thought of as being the CPU’s workspace. Besides, the registers are very fast, they run at the same speed with the rest of the CPU. At last, they are of low capacity. Because of the CPU capacity needed for each register are usually less than 200 bytes, that’s why register is used greatly in CPU.

9.0 Register Size

Register size was measured by the number of bits. The examples of available register sizes are 32-bit and 64-bit.

Figure 9.1: Differences between 32-bit and 64-bit computing architecture. This is shown by Arstechnica in their article An Introduction to 64-bit Computing and x86-64 (2002).

Generally, a certain number of bits of a CPU can process on the same number of bits of instructions. An example shown by IAC in their article 32bit vs 64 bit CPUs and computing environments (2008), a 32-bit CPU only accept 32-bit or below instruction whereas 64-bit CPU only accept 64-bit or below instruction. A register with 32-bit can address up to 2^32 memory addresses which is 4,294,967,296 in decimal and 100000000 in hexadecimal. A register with 64-can address up 2^64 addresses which is over 18 quintillion values.

In conclusion of register size, we defined that more bits able to process data in larger chunks which also means also can point to or address a larger number of location in physical memory. (Remah, 2012)

10.0 Types of Register

There are varieties types of registers and it is divided into two categories:

User-visible registers

Control and status registers

User-visible registers are usually referenced by machine language which allows minimizing the main memory references by optimizing use of the register. While for control and status registers, they fall under the category of organization types of register.

In user-visible registers, it can be characterize in the following categories:

10.1 General purpose

Based on the research, general purpose register can store both address and data register. There are some examples as follows:

Accumulator – stores the result of the last processing step of the ALU.

Storage Register – holds the instruction while it is being executed.

I/O Register – communicates with the input/output devices.

Stack Control Register – it is a set of memory blocks which store data and retrieved them in order.

10.2 Address

Address register used to store the address of specific memory location. Example of address registers are as follows:

Segment Pointers – It holds the address of the base of a segment. As Morgan David noted, memory is referenced by an offset when it is divided into segment. Offset is refers to a value added to a base address to produce a second address (2013)

Index Registers – They are used for indexed addressing and may be auto indexed.

Stack Pointer –They are used to store the address of latest request program or instruction in a stack. In a stack, the older program will push down when new request program exist.

10.3 Condition codes

Condition codes are a condition register and it give the result of operations in bit set. As Morgan David stated, condition code can be access by any program but the result is unchangeable. The examples of result are positive result, negative result, zero and overflow.

11.0 Control and status registers

The control and status registers are actually the organization types of register. Register Organization appointed those registers that are not visible to the user but with minority of them are visible to the machine instruction executed in a control or operating system mode. There are some examples of organization types of register:

11.1 Program Counter (PC)

These registers contain the address of an instruction being execute at the current time. The responsibility of program counter is provided or holds the next address of memory location when the current instruction had been complete execute.

11.2 Instruction Register (IR)

These registers are part of the CPU’s control unit (CU) which store the instruction most recently fetched. Each instruction ready to be executed is loaded into the Instruction Register. It will be hold by it while preparing , decoding and executing.

11.3 Memory Address Registers (MAR)

These registers store the address of a location in memory where the next instruction is to be executed. The address of the following memory location is held by Memory Address Registers when the first instruction is executing. In addition, Memory Address Registers Is also used to access data and instructions from memory during execution phase of an instruction.

11.4 Memory Data Resister (MDR)

Memory Data Resister, as known as Memory Buffer Register, is a special type of register. The responsibility is to store data into computer storage such as RAM or fetch data from computer storage. Memory Data Resister can buffer and copy requested information from memory and get ready to use by processor. For example:

When storing data, Memory Data Resister will load the data and perform a store.

When retrieving data, Memory Data Resister will copy the information from memory and get ready for used.

12.0 Conclusion

Based on the explanation above, we understand that the register is really important in computing as it has the same speed with the CPU. Besides it also explained the difference between 32-bit register and 64-bit register. Moreover, it shows that different types of registers have their own functions of register types.

Frequently Ask Question (FAQ)

What is Linux?

Linux is an open source operating system, which is kind of an adapted clone of a UNIX operating program.

What are the types of memory management mechanism use in modern computers?

There are several types of memory management mechanism use in modern computers, such as Paging, Segmentation, Fragmentation, Swapping, Virtual Memory, and Demand Paging.

What are the differences between 32-bit and 64-bit?

The number of bit refer to the capabilities of a processor on how large of memory can be address. A register with 32-bit can address up to 2^32 memory addresses which is 4,294,967,296 in decimal and 100000000 in hexadecimal whereas a register with 64-can address up 2^64 addresses which is over 18 quintillion values.

What is register?

Registers are special, high speed storage area built inside the CPU which can hold a storage address, a computer instruction or any kind of data, such as individual characters or bit sequence.

What is the function of address register?

The address register is used to store the address of specific memory location.

Limitation / Extensions

Limitations

There are a few of challenges faced when writing this paper. First of all, the information for register size is hard to be found on any websites and books. Besides that, it is really hard to understand the information we get from websites and books. Lastly, the information is hard to get and most of them are about the user commands on how to maintain memory management in Linux.

Extensions

According to the limitations faced, there are several extensions to solve it. First of all, it would be better to get register size information about 32-bit and 64-bit. Besides that, the information in this paper on Linux’s memory management is improved with sufficient information. Lastly, we form up a group to search information and sharing between my friends.

References

Websites

Bright Hub (2011) What are the Features of a 128 Bit Operating System. [online] Available at: http://www.brighthub.com/computing/windows-platform/articles/57480.aspx [Accessed: 7 Jan 2013].

IAC (2008) 32bit vs 64bit CPUs and computing environments. [online] Available at: http://www.iac.es/sieinvens/siepedia/pmwiki.php?n=tutorials.32vs64bits [Accessed: 7 Jan 2013].

Linux (2007) All about Linux swap space. [online] Available at: http://www.linux.com/news/software/applications/8208-all-about-linux-swap-space [Accessed: 12 Jan 2013].

Memory Management (2012) The Memory Management Reference: Beginner's Guide: Allocation. [online] Available at: http://www.memorymanagement.org/articles/alloc.html#buddy.system [Accessed: 12 Jan 2013].

Arstechnica (2002) An Introduction to 64-bit Computing and x86-64. [online] Available at: http://arstechnica.com/gadgets/2002/03/an-introduction-to-64-bit-computing-and-x86-64/ [Accessed: 18 Jan 2013].

Schoolnet (2013) Data registers. [online] Available at: http://schoolnet.gov.mt/keith.aquilina/resources/storage/Data_registers.htm [Accessed: 27 Jan 2013].

What Is Linux (1999) What Is Linux?. [online] Available at: http://whatislinux.org/ [Accessed: 27 Jan 2013].

Tech Target (2013) What is memory management?. [online] Available at: http://whatis.techtarget.com/definition/memory-management [Accessed: 4 Feb 2013].

Connexions (2009) CPU Structure and Functions. [online] Available at: http://cnx.org/content/m29369/latest/ [Accessed: 4 Feb 2013].

E-Books

Ciliendo, E. and Kunimasa, T. (2007) Linux Performance and Tuning Guidelines. [e-book] Available through: Redbooks IBM http://www.redbooks.ibm.com/redpapers/pdfs/redp4285.pdf [Accessed: 14, 109].



rev

Our Service Portfolio

jb

Want To Place An Order Quickly?

Then shoot us a message on Whatsapp, WeChat or Gmail. We are available 24/7 to assist you.

whatsapp

Do not panic, you are at the right place

jb

Visit Our essay writting help page to get all the details and guidence on availing our assiatance service.

Get 20% Discount, Now
£19 £14/ Per Page
14 days delivery time

Our writting assistance service is undoubtedly one of the most affordable writting assistance services and we have highly qualified professionls to help you with your work. So what are you waiting for, click below to order now.

Get An Instant Quote

ORDER TODAY!

Our experts are ready to assist you, call us to get a free quote or order now to get succeed in your academics writing.

Get a Free Quote Order Now