What is the difference between paging and segmentation?

Paging Segmentation
Paging is used to get a large linear address space without having to buy more physical memory. Segmentation allows programs and data to be broken up into logically independent address spaces and to aid sharing and protection.
A page is of fixed block size. A segment is of variable size.
Paging may lead to internal fragmentation. Segmentation may lead to external fragmentation.
The user specified address is divided by CPU into a page number and offset. The user specifies each address by two quantities a segment number and the offset (Segment limit).
The hardware decides the page size. The segment size is specified by the user.
Paging involves a page table that contains base address of each page. Segmentation involves the segment table that contains segment number and offset (segment length).
Paging is transparent to programmers(system handles it automatically) It requires programmer to be aware of memory limits as programmer tries to allocate memory to functions and variables or tries to access read only memory violation, which results in segmentation fault

Leave a Reply

Your email address will not be published. Required fields are marked *