You are on page 1of 3

Department of Computing

CS 330: Operating System


BSCS-5C
Lab 9: Memory Management
CLO1(Explain & summarize OS Services and Abstractions)

Date: 11-12-2017
Time: 02:00 PM – 05:00 PM
Instructor: Dr.Muhammad Ali Tahir

CS330: Operating Systems Page 1


Lab 9: Memory Management
Introduction

This lab introduces the concept of physical addressing and virtual addressing in paging. Paging is
a memory management technique in which the memory is divided into fixed size pages. Paging is
used for faster access to data. When a program needs a page, it is available in the main memory as
the OS copies a certain number of pages from your storage device to main memory. Paging allows
the physical address space of a process to be noncontiguous.

Objectives

This lab will enable students to understand and implement physical addressing in the memory.

Tools/Software Requirement

➢ Linux OS installed on laptops or systems.


➢ GCC

Description

Assume that a system has 32-bit addresses with a 4-KB page size. Given a 32-bit physical address,
corresponding physical page number contains some really useful information like the starting
address of the physical page (in hex) and offset. For example, given the physical address 19986

Page number = 4

Starting address=0x4000

Offset = 3602

Tasks

Given a 32-bit physical address, write a program to find its corresponding physical page number,
the starting address of the physical page (in hex) and offset. Your program should print the above
mentioned information from the physical address. Writing this program will require using the
appropriate data type to store 32 bit numbers. Make sure to verify your program with multiple test
cases that span the entire range of possible 32-bit addresses. In your README, briefly describe
how your algorithm works. Also mention if you notice some characteristic common between all
of the starting addresses.

CS330: Operating Systems Page 2


Deliverables

Submit

➢ Source code
➢ readme file

CS330: Operating Systems Page 3

You might also like