Are you looking to improve your understanding of memory management in OS? Let’s learn about the difference between paging and segmentation, two techniques used in non-contiguous memory allocation.
It involves dividing both programs, & primary memory (RAM) into fixed-sized units called pages & frames, respectively. When a program arrives to be executed, its pages are allocated to available frames in memory.
A way of organizing a program's memory into variable-sized pieces called segments. This helps programmers think about programs in terms of its different components, like functions & global variables.
- Paging divides the address space of a process into fixed-size blocks called pages. - Segmentation divides the address space of a process into different-sized blocks called segments.
- Paging reduces efficiency because a single function may require access to multiple pages. - Segmentation leads to higher efficiency since functions of the same type are kept in one segment.
- Paging can cause internal fragmentation if program size is less than the page size determined. - Segmentation can cause external fragmentation after removing some programs resulting in small holes.