Paging,Segmentation & Segment with Paging

MeghajKumarMallick 344 views 13 slides Apr 13, 2020
Slide 1
Slide 1 of 13
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13

About This Presentation

This is an PPT of Operating System. It include the following topic"Paging,Segmentation & Segment with Paging".


Slide Content

BIRLA INSTITUTE OF TECHNOLOGY,MESRA, RANCHI JAIPUR CAMPUS Presentation on “ PAGING, SEGMENTATION, SEGMENTATION WITH PAGING ” Presented By : MAYANK SETH MCA/25002/18

contents Meaning of paging Meaning of segmentation Paging using segmentation

Paging Paging is a memory management technique that permits the physical address space of a process to be non-contiguous. In the logical view, the address space of a process consists of a linear arrangement of PAGES. Each page has s bytes in it, where s is a power of 2. The physical memory is divided into fixed block called FRAMES. Size of page = size of frame.

Paging hardware The hardware partitions memory into areas called page frames page frames in memory are numbered from 0. At any moment, some page frames are allocated to pages of processes, while others are free. The kernel maintains a list called the free frames list to note the frame numbers of free page frames. While loading a process for execution, the kernel consults the free frames list and allocates a free page frame to each page of the process.

The MMU decomposes a logical address into the pair ( pi , bi ), where pi is the page number and bi is the byte number within page pi . To facilitate address translation, the kernel constructs a page table (PT) for each process. The page table has an entry for each page of the process, which indicates the page frame allocated to the page. While performing address translation for a logical address (pi , bi), the MMU uses the page number pi to index the page table of the process, obtains the frame number of the page frame allocated to pi , and computes the effective memory address.

Address translation in paging Page address is called logical address and represented by page number and the offset . Logical Address = Page number + page offset. Frame address is called physical address and represented by a frame number and the offset . Physical Address = Frame number + page offset

Advantages and disadvantages of paging Paging is simple to implement and assumed as an efficient memory management technique. Due to equal size of the pages and frames, swapping becomes very easy. Page table requires extra memory space, so may not be good for a system having small RAM.

Segmentation A segment is a logical entity in a program, e.g., a function, a data structure, or an object. Hence it is meaningful to manage it as a unit—load it into memory for execution or share it with other programs. In the logical view, a process consists of a collection of segments . In the physical view, segments of a process exist in nonadjacent areas of memory.

For example: A process Q consists of five logical entities with the symbolic names main, database , search, update, and stack . While coding the program, the programmer declares these five as segments in Q. This information is used by the compiler or assembler to generate logical addresses while translating the program .

The figure shows how the kernel handles process Q. The left part of the figure shows the logical view of process Q. To facilitate address translation, the kernel constructs a segment table for Q. Each entry in the table shows the size of a segment and the address of the memory area allocated to it . The MMU uses the segment table to perform address translation. Memory allocation for each segment is performed as in the contiguous memory allocation model. The kernel keeps a free list of memory areas . While loading a process, it searches through this list to perform first-fit or best-fit allocation to each segment of the process.

Segmentation with paging In this approach, each segment in a program is paged separately. Accordingly , an integral number of pages is allocated to each segment . A page table is constructed for each segment, and the address of the page table is kept in the segment’s entry in the segment table .

Figure shows processQ in a system using segmentation with paging. Each segment is paged independently, so internal fragmentation exists in the last page of each segment. Each segment table entry now contains the address of the page table of the segment. The size field in a segment’s entry is used to facilitate a bound check for memory protection.
Tags