Paging - Segmentation
Paging - Segmentation
UNIVERSITY INSTITUTE OF
ENGINEERING
Bachelor of Engineering
(Computer Science &
Engineering)
Operating System
DISCOVER . LEARN .
EMPOWER
University Institute of Engineering (UIE)
Paging
&
Paging Techniques
PAGING
Permits a program's memory to be physically noncontiguous so it can be allocated
from wherever available. This avoids fragmentation and compaction.
PAGING
• An address is determined by:
page number ( index into table ) + offset
---> mapping into --->
base address ( from table ) + offset.
PAGING
• Address generated by the CPU is divided into:
• Page number (p) – used as an index into a page table which contains base
address of each page in physical memory.
• Page offset (d) – combined with base address to define the physical
memory address that is sent to the memory unit.
PAGING
PAGING Example
32-byte memory with 4-byte pages
SHARED PAGES
SHARED PAGES
• Data occupying one physical page,
but pointed to by multiple logical
pages.
• Useful for common code -must be
write protected. (NO write-able data
mixed with code.)
• Extremely useful for read/write
communication between processes.
PAGING
• Calculating internal fragmentation
– Page size = 2,048 bytes
– Process size = 72,766 bytes
– 35 pages + 1,086 bytes
– Internal fragmentation of 2,048 - 1,086 = 962 bytes
– Worst case fragmentation = 1 frame – 1 byte
– On average fragmentation = 1 / 2 frame size
– So small frame sizes desirable?
– But each page table entry takes memory to track
– Page sizes growing over time
• Solaris supports two page sizes – 8 KB and 4 MB
• Process view and physical memory now very different
• By implementation process can only access its own memory
13
University Institute of Engineering (UIE)
Department of Computer Science and Engineering (CSE)
Address-Translation Scheme
15
University Institute of Engineering (UIE)
Department of Computer Science and Engineering (CSE)
16
University Institute of Engineering (UIE)
Department of Computer Science and Engineering (CSE)
17
University Institute of Engineering (UIE)
Department of Computer Science and Engineering (CSE)
Types of Hashing
• There are two types of hashing :
1. Static hashing: In static hashing, the hash function maps search-key values to
a fixed set of locations.
– In case of collision -> add overflow entries
2. Dynamic hashing: In dynamic hashing a hash table can grow to handle more
items. The associated hash function must change as the table grows.
– In case of collision -> grow the hash table
20
University Institute of Engineering (UIE)
Conclusion
https://www.youtube.com/watch?v=pJ6qrCB8pDw
https://www.youtube.com/watch?v=2pgI46Q72fA
https://www.youtube.com/watch?v=SqYigYLFvcI