Paging Memory Management
Paging in Memory Management:
The logical address space of a process in UNIX is divided into fixed-size pages and the main memory is divided into fixed-size frames. The mapping between pages and frames is done by the following data structure.
- Page table
- Disk block descriptor
- Page Frame Data table
- Swap-use table
1. Page table: Each process in UNIX maintains a one-page table, and each page has one entry in the page table. The page table structure is as follows:
i. Frame number refers to the frame in the main memory.
ii. Age indicates how long the page has been in memory without being a reference.
iii. Copy on write=1, when more than one process shares a page, otherwise copy on write=0.
iv. Modify indicates the page has been modified.
v. Reference=0 when the page is first loaded.
Reference=1 when the page is referenced by the page replacement algorithm.
vi. V=Valid indicates the page is in the main memory.
I=Invalid indicates the page isn’t in the main memory.
vii. Protect Indicates whether the write operation is allowed or not.
2. Disk Block Descriptor: Each page of a process, maintains an entry in the disk block descriptor. It describes the disk copy of the virtual page. The structure of the Disk Block Descriptor is as follows:
i. The swap device number specifies the logical device number of the secondary storage device that holds the corresponding page.
ii. It specifies the block number in the device, where the page is loaded.
iii. It tells storage may be a swap unit or executable file.
3. Page Frame Data Table: It describes each frame of main memory and it is indexed by frame number. the structure of the page frames data table is as follows:
i. ‘Page state‘ indicates whether this frame is available or not.
ii. ‘Reference count‘ indicates the number of process references the page.
iii. ‘Logical Device‘ that contains a copy of the page.
iv. Block number indicates the location of the page.
v. ‘fp data transfer‘ specifies the pointer to other fp data table entries on a list of free pages.
4. Swap-use table: One swap-use table for each swap device, with one entry for each page on the device. The structure of the Swap-use table is as follows:
Reference count indicates-
i. Some page table entries that point to a page on the swap device.
ii. Page/storage unit number is a page identifier on a storage unit.