Professional Documents
Culture Documents
Operating System
Computer
Hardware
File management
Transfers files between main memory and secondary
storage, manages file folders, allocates the secondary
storage space, and provides file protection and
Operating recovery
System
Memory management
Allocates the use of random access memory (RAM) to
requesting processes
Interface platform
Allows the computer to run other applications
50K Function1( )
Function 1( ) Function 2( )
70K Function 2( )
overlay region.
Indira College of Engineering Management, Pune 27
Swapping
Swapping is an approach for memory management by
bringing each process in entirety, running it and then putting
itback on the disk, so that another program may be loaded
into that space.
Swapping is a technique that lets you use a disk file as an
extension of memory.
Lower priority user processes are swapped to backing
store (disk) when they are waiting for I/O or some
other event like arrival of higher priority processes. This
is Rollout Swapping.
Swapping the process back into store when
some event occurs or when needed (may be in a different
partition) is known as Roll-in swapping.
Indira College of Engineering Management, Pune 28
Swapping
• A process can be swapped temporarily out of memory to a backing store, and then
brought back into memory for continued execution
• Backing store – fast disk large enough to accommodate copies of all memory
images for all users; must provide direct access to these memory images
• Roll out, roll in – swapping variant used for priority-based scheduling algorithms;
lower-priority process is swapped out so higher-priority process can be loaded and
executed
• Major part of swap time is transfer time; total transfer time is directly proportional to
the amount of memory swapped
• Modified versions of swapping are found on many systems (i.e., UNIX, Linux, and
Windows)
• System maintains a ready queue of ready-to-run processes which have memory
images on disk
Operating System
Roll Out
Process P1
User
Process/Application Process P2
Roll In
Main Memory Disk
Memory Allocation
Equal-Sized Unequal-Size
• Relocation registers used to protect user processes from each other, and
from changing operating-system code and data
• Base register contains value of smallest physical address
• Limit register contains range of logical addresses – each logical
address must be less than the limit register
• MMU maps logical address dynamically
process 8 process 10
• 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
Data Storage Page table stores the Segmentation table stores the segmentation
8
page data. data.
4
1
3 2
4
In segmented paging,
•Process is first divided into segments and then each segment is divided
into pages.
•These pages are then stored in the frames of main memory.
•A page table exists for each segment that keeps track of the frames
storing the pages of that segment.
•Each page table occupies one frame in the main memory.
•Number of entries in the page table of a segment = Number of pages
that segment is divided.
•A segment table exists that keeps track of the frames storing the page
tables of segments.
•Number of entries in the segment table of a process = Number of
segments that process is divided.
•The base address of the segment table is stored in the segment table
base register.
Indira College of Engineering Management, Pune 76
Segmented Paging
In Segmented Paging, the main memory is divided into variable size
segments which are further divided into fixed size pages.
1.Pages are smaller than segments.
2.Each Segment has a page table which means every program has multiple
page tables.
3.The logical address is represented as Segment Number (base address),
Page number and page offset.
Segment Number → It points to the appropriate Segment Number.
Page Number → It Points to the exact page within the segment
Page Offset → Used as an offset within the page frame
Each Page table contains the various information about every page of the
segment.
The Segment Table contains the information about every segment.
Each segment table entry points to a page table entry
and every page table entry is mapped to one of the page within a segment.