0% found this document useful (0 votes)
47 views

Single Level Paging Implementation in Python

Uploaded by

Danish shah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views

Single Level Paging Implementation in Python

Uploaded by

Danish shah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Single Level Paging Implementation in Python

Experiment Title:

Implementation of Single-Level Paging in Memory Management

Objective:

To implement the concept of Single-Level Paging in Python, and to understand the process
of logical to physical address translation using paging. Also, calculate important parameters
such as the number of pages, page table size, and frame size.

Theory:

Paging is a memory management scheme that eliminates the need for contiguous allocation
of physical memory. It divides the program's logical address space into blocks of the same
size called pages, and the physical memory into blocks of the same size called frames. The
page table maps the logical pages to the physical frames.

In single-level paging, the logical address is divided into two parts:

1. Page number: Which indicates the page in the logical memory.


2. Offset: Which indicates the specific location within the page.

The operating system maintains a page table that stores the mapping between page numbers
and frame numbers.

Algorithm:

1. Input Total logical address space (in bytes)


o Parameters:
o Page size (in bytes)
o Total physical memory size (in bytes)
o Page table (mapping page numbers to frame numbers)
2. Steps:
1. Calculate the Number of Pages:
Number of Pages=Logical Address Space/Page Size
2. Calculate the Number of Frames:
Number of Frames=Physical Memory Size/Page size
3. Determine Page Table Size:
Page Table Size=Number of Pages×Size of Page Table Entry
4. For Each Logical Address:
▪ Divide the logical address into:
▪ Page number:
Page number=Logical AddressPage Size/Page Size
▪ Offset:
Offset=Logical Address%Page Size
▪ Use the page number to look up the corresponding frame number in
the page table.
▪ Compute the physical address:
Physical Address=Frame number×Page Size+Offset
3. Output: The physical address for the given logical address.

You might also like