Subscribe by Email


Friday, June 21, 2013

Explain about the Paged Memory and Segmentation techniques?

Paging and segmentation, both are memory management techniques. 

What is Paging?

- This technique has been designed so that the system can store or retrieve data from the virtual memory or secondary memory of the system to be loaded in the main memory and used. 
- In this scheme, the data from the secondary memory is retrieved by the operating system in blocks of same size commonly known as the paging. 
- This is why the technique has been called the paging memory – management scheme. 
- This memory management scheme has a major advantage over the segmentation scheme. 
- The advantage is that non-contiguous address spaces are allowed. 
- In segmentation, non-contiguous physical address spaces are not allowed. 
Before the paging actually came in to use, the whole program had to be fitted in to the contiguous memory space by the systems. 
- This in turn led to a number of issues related to fragmentation and storage. 
Paging is very important for the implementation of the virtual memory in many of the operating systems that are general purpose. 
- With the help of paging memory management technique, the data that cannot be fitted in to the physical memory i.e., RAM can be easily used. 
- Paging actually comes in to play whenever a program makes an attempt for accessing the pages that have not been presently mapped to the main memory (RAM). 
- Such situation is termed as the page fault. 
- At this point the control is handed over to the operating system for handling the page fault.
- This is done in a way that it is not visible to the interrupt raising program. 

The operating system has to carry out the following instructions:
  1. Determining the location of the requested data from the auxiliary storage.
  2. Obtaining a page frame in the main memory that is empty to be used for storing the requested data.
  3. Loading the data requested in to the empty page obtained above.
  4. Making updates to the page table so that new data is only available.
  5. Returning the control interrupting program and retrying to execute the same instruction that caused the fault.

What is Segmentation?

- This memory management technique involves dividing the main memory in to various sections or segments.
- In the system that makes use of this management technique, a value identifying the segment and its offset is contained in the reference to that memory location. 
- Object files that are produced during the compilation of the programs make use of the segments when they have to be linked together to form an image of the program and this image has to be loaded in to the memory.  
- For different program modules, different segments might be created. 
- Some programs may even share some of the segments.
- In one way, memory protection is implemented by means of memory segmentation only.
- Paging and segmentation can be combined together for memory protection. 
- The size of memory segment is not always fixed and can be as small as a byte. 
- Natural divisions such as the data tables or the individual routines are represented by the segments.
This is to make the segmentation visible to the programmer. 
- With every segment, a set of permissions and length is associated. 
- A segment can be referred to by the process only in a way that is permitted by this set of permissions. 
- If this is not done, a segmentation fault is raised by the operating system. 
Segments also consist of a flag that indicates the presence of the segment in the main memory of the system. 


No comments:

Facebook activity