DEV Community

Cover image for Question on Logical Address & Physical Address | Operating System - M05 P10
Rahul Mishra
Rahul Mishra

Posted on • Originally published at programmingport.hashnode.dev

Question on Logical Address & Physical Address | Operating System - M05 P10

This is a multipart blog article series, and in this series I am going to explain you the concepts of operating system. This article series is divided into multiple modules and this is the fifth module which consists of 26 articles.

In this article we will see a question on logical address and physical address space and try to gain better understanding on this topic.

Question: We have given LAS = 4 GB, PAS = 64 MB, Page size = 4 KB, and we have to find number of process, number of frames, number of entries in page table, size if page table. (LAS = logical address space) the memory is byte addressable.

Answer: Logical address = 22 x 230 = 232
The logical address is of 32 bits.

4 KB = 22 x 210 = 212

The page size is of 12 bits and total size of page table is 32 bits

Therefore, No of pages = 232 – 212 = 220

PA = 26 x 220 = 226 bits

Size of physical address = 26 bits

We know that frame offset = page offset

Therefore, frame offset = 4 KB = 22 x 210 = 212

Number of frames = 214

Number of entries in page table = Number of pages in a process

Therefore number of entries in page table = 220

Size of page table = 220 x 14 bits (To represent
one frame 16 bits are required and there are 220 entries in page table therefore the size of page table will be 220 x 14)

So this was a question based on logical address and physical address space. Hope you liked it and learned something new from it.

If you have any doubt, question, quires related to this topic or just want to share something with me, than please feel free to contact me.

📱 Contact Me

Twitter
LinkedIn
Telegram
Instagram

📧 Write a mail

rahulmishra102000@gmail.com

🚀 Other links

GitHub
HackerRank

Top comments (4)

Collapse
 
josephwasily profile image
Joseph Botros

Isn't it :
No of pages = 2^32 / 2^12 = 2^20 ?

Collapse
 
rahulmishra05 profile image
Rahul Mishra • Edited

No, please refer to this image.
Page offset = 12 bits
Page size = 32 bits
So, Page No = 32 - 12 = 20 bits

Thus No of pages = 2^20

I hope your doubt get clear :D

dev-to-uploads.s3.amazonaws.com/i/...

Collapse
 
vikash1234 profile image
Vikash Rajput

No. of pages are 2^20 and no. of frames are 2^14. So if the process with 2^20 pages how will it going to be fit in a memory with only 2^14 frames.

Collapse
 
anshkaran7 profile image
HeyAnsh18

Number of frames = 2^14 how??? can u explain it?
isn't it : no of frames = 2^12