Introduction
Both segmentation and paging are memory management techniques used to facilitate the efficient allocation and management of memory in computer systems. Segmentation divides memory into variable-sized segments based on logical units such as functions or data structures, while paging divides memory into fixed-sized blocks or pages. Segmentation allows flexibility in memory allocation, while paging simplifies memory management and provides better utilization of memory.

In this article, we will be learning about Paging and Segmentation and the difference between them in detail.
To understand the differences, we must know what Paging and Segmentation are. Let us have a brief look at what Paging entails in the non-contiguous allocation first:
Also see, Segmented Paging
What is Paging?
Paging is a storage method that allows the operating system to fetch processes from secondary storage and store them in the main memory in the form of pages.
Furthermore, Paging is a non-contiguous memory allocation technique that divides secondary and main memory into equal-sized divisions. Secondary memory partitions are referred to as pages, whereas primary(main) memory partitions are referred to as frames.

They are separated into equal-sized segments to maximize main memory use and minimize external fragmentation. It is worth noting that the page size and the frame size must be the same.
Some important points are:
- Pages of a process are brought into main memory only when necessary; otherwise, they are stored in secondary storage.
- One page of a process is primarily kept in one of the memory frames. Furthermore, the pages might be placed in various locations across the memory, but the major aim is always to discover contiguous frames.

- The CPU generates the logical address to fetch the process from the secondary memory, unaware of the fact that the main memory is in between them( CPU -> Main Memory -> Secondary Memory).
So, in order to access the main memory, there always needs a Physical address. To translate the logical address into the physical address, a translator is required.
Mapping(Translation) is done with the help of MMU(Memory management unit) which further utilizes the page table to fetch the exact location of the input stored in secondary memory.
A page table includes the frame number associated with a given process's page number. As a result, each process will have its own page table. The Page Table Base Register (PTBR) is a register that stores the page table's base value.
- It's simple to swap out equal-sized pages and frames, although there can be a chance that paging leads to internal fragmentation. It is possible that the process is too tiny and does not acquire the complete frame size.
-
For every process, there is a page table. Maintaining an equal number of page tables could lead to an overhead.
Let us know have a look at what exactly Segmentation entails:
“ Recommended Topic, Internal and External Fragmentation“