You are on page 1of 2

School of Computer Science Engineering and Technology

Course- BTech Type- Core


Course Code- CSET209 Course Name- Operating Systems
(OS)
Year- 2023 Semester- Even
Date- 10/04/2023 Batch- 2021-2025
Lab Assignment 12

Exp. No. Name CO1 CO2 CO3


11 Paging and segmentation

Objective: - This session is to implement paging and segmentation technique in memory


management
Introduction: In computer operating systems, paging is one of the memory management schemes
by which a computer stores and retrieves data from the secondary storage for use in main memory. In
the paging memory-management scheme, the operating system retrieves data from secondary storage
in same-size blocks called pages. Paging is a memory-management scheme that permits the physical
address space a process to be non-contiguous. The basic method for implementing paging involves
breaking physical memory into fixed-sized blocks called frames and breaking logical memory into
blocks of the same size called pages. When a process is to be executed, its pages

Task 1: Write a C program to simulate paging technique of memory management with the following
test cases.
INPUT
Enter the memory size – 1000
Enter the page size -- 100
The no. of pages available in memory are -- 10
Enter number of processes -- 3
Enter no. of pages required for p[1]-- 4
Enter pagetable for p[1] --- 8 6 9 5
Enter no. of pages required for p[2]-- 5
Enter pagetable for p[2] --- 1 4 5 7 3
Enter no. of pages required for p[3]—5
OUTPUT
Memory is Full
Enter Logical Address to find Physical Address
Enter process no. and pagenumber and offset -- 2 3 60
The Physical Address is – 760

Task 2: A process is divided into Segments. The chunks that a program is divided into which are not
necessarily all the same sizes are called segments. Segmentation gives the user’s view of the process
which paging does not give.

Create a program to implement segmentation technique with the following test case.
School of Computer Science Engineering and Technology

Test Case:

Enter segment table


Enter -1 as segmentation value for termination
Enter segment number:1
Enter base value:2000
Enter value for limit:100
Enter segment number:2
Enter base value:2500
Enter value for limit:100
Enter segmentation number:-1
Enter offset:90
Enter segment number:2
Address in physical memory 2590.

You might also like