Paging, Virtual Address Space and Physical Memory and Page Frames

Click For Summary

Discussion Overview

The discussion revolves around the concepts of paging, virtual address space, and physical memory in computer systems. Participants explore calculations related to page table entries and the number of page frames based on given parameters, including 32-bit virtual addresses and 128-KB pages. The conversation includes technical reasoning and clarifications about memory addressing.

Discussion Character

  • Technical explanation
  • Mathematical reasoning
  • Debate/contested

Main Points Raised

  • One participant calculates the total number of pages required and suggests that the page table has 2^25 entries based on their interpretation of the virtual address space and page size.
  • Another participant challenges the initial calculations, stating that the physical memory size was miscalculated and that the addressing space is 4GB, leading to a different physical memory size.
  • Several participants discuss the implications of addressing bytes versus words in memory, questioning how many bits are needed to address one byte on a 128-KB page.
  • A participant introduces the concept of "page stealing" and references a source, indicating a broader context of memory management.
  • Historical context is provided by a participant recalling Apollo Computers Inc. and their innovative approach to virtual address space in the 1980s.
  • Further calculations are presented by Zulfi, who revises their earlier numbers and seeks confirmation on the correctness of their new calculations regarding page frames and virtual pages.
  • Another participant discusses the space requirements for the page table and the implications of multi-level paging schemes for memory management.
  • Clarifications are sought regarding the term "page map," with participants discussing its equivalence to a page table.
  • Confusion persists regarding the relationship between physical memory and virtual memory sizes, with Zulfi questioning if physical memory can be defined as PM = 2^31.

Areas of Agreement / Disagreement

Participants express differing views on the calculations related to page tables and page frames, with no consensus reached on the correct values. There is ongoing clarification and correction of earlier claims, indicating a lack of agreement on certain points.

Contextual Notes

Participants highlight the complexity and ambiguity in the exercise, suggesting that assumptions about memory addressing and the definitions of terms like "page map" may vary. The discussion reflects a range of interpretations and calculations that are not universally accepted.

zak100
Messages
462
Reaction score
11
TL;DR
I am trying to understand the concept of paging. How Virtual address Space is divided into pages and how Physical memory is divided into page frames. I found an example. I have solved but I am not sure what is the correct answer for it.
Hi,
The following is not a homework question.

My question is:
A computer has 32-bit virtual addresses and 128-KB pages.
• How many entries are needed in the page table if traditional (one-level)
paging is used?
• If the physical memory is half size of virtual memory, many page frames are
there in the physical memory?

My answer is:

Total pages required = 2^32/2^7 = 2^25 pages
Thus page table has 2^25 entries

PM = 2^16
Total page frames in PM = 2^16/2^ 7= 9 page frames

Somebody please guide me what is the correct solution for the above.

Zulfi.
 
Technology news on Phys.org
The pages are 128K, not 128. So recalculate your traditional page table size.

Physical memory is half the size of your addressing space.
Your addressing space is 32-bits, hence 4G (presumably 4GBytes).
So how much physical memory do you have? It is not the 2^16 (65536 bytes) that you suggest.
 
A computer is supposed to be able to address words in memory, not necessarily bytes.
Let's nevertheless assume bytes are to be addressed idividually. How many bits are needed to address one byte on a 128 kB page ?
 
BvU said:
A computer is supposed to be able to address words in memory, not necessarily bytes.
Let's nevertheless assume bytes are to be addressed individually. How many bits are needed to address one byte on a 128 kB page ?
Although modern computers commonly retrieve memory into the CPU in 32-bit, 64-bit, or much larger chunks, addressing space is still normally in bytes. Most modern computers address at the byte level - even though the physical buses are commonly 256-bits wide or greater.
 
  • Like
Likes   Reactions: sysprog
Here's a video that describes the concepts of physical memory, virtual memory, paging and caching:



The keypoint is virtual memory is organized into blocks called pages that can be mapped into physical memory. The virtual memory can then be stored on disk and retrieved when the program is about to be run. The virtual memory is mapped to someplace on the disk when stored or mapped to someplace in physical memory when ready to be used by the CPU.
 
  • Like
Likes   Reactions: zak100, sysprog and Klystron
Does anyone remember the company Apollo Computers Inc. from the 1980s? They did something very innovative.

They created a large virtual address space. Every computer in the network, and every disk drive on every computer and every screen were memory mapped into the single flat virtual address space. Every file on every disk mapped into a block of virtual address space. This greatly simplified the OS. The file system, privileges, security, transfers, and page fault handling could all share a common mechanism ... memory mapping and virtual memory access.

Of course in those days, the size of affordable RAM and disk storage were very small by today's standard, so that "huge" virtual address space covering the whole network was only 256 MB. It was also a time where one could have a proprietary LAN and no thoughts of an Internet WAN.
 
  • Like
Likes   Reactions: sysprog
I remember that -- it was a good set of approaches -- rivalled Novell's netware . . .
 
Hi,
Thanks for your help @.Scott. 128K= 2^7 * 2^10 = 2^17
Total pages in virtual address space = 2^32/2^17 = 2^15

Physical memory is half the size of the virtual address space= 2^32/2 = 2^31 = 2GB

Page frames = 2^31/ 2^15 = 2^16.

Somebody please guide me if the above is correct or not.

Zulfi.
 
  • #10
zak100 said:
Page frames = 2^31/ 2^15 = 2^16.
How much space does the page map itself need ? Can it reside on disk or does it have to be in memory ?
 
  • #11
BvU said:
How much space does the page map itself need ? Can it reside on disk or does it have to be in memory ?
The page table needs as much entries as there are pages in virtual memory, which is 2^17. ( not 2^15, there are 2x as much virtual pages as physical pages).
Each entry would need 16 bits for a physical address of a page frame, and a few more bits for the status of the virtual page (modified, present, cacheble, security info). You'd expect they would use 4 bytes, to make address calculations easy. You would need 2^19 bytes = 1/2 Mb.

All recent operating systems that use paging, will use different page tables for different processes.. If the system switches to another process, a processor register will be made to point to another page table.
This means you might need more space for all the page tables.
The old page table entries. are mostly not swapped out. If you do this you might have to change the page tables on disk when a page of an inactive process is swapped out.

A multi-level paging scheme is used for large memories. There are often many small processes that use only a small part of the virtual address space. If you use a higher level page directory that points to lower level page tables, these page tables don't have to be created before the corresponding block of virtual memory is needed.
 
  • #12
Dear @willem2, the question was directed at @zak100 . It's his (her) exercise!
Although I wonder if the exercise composer realized the complexity (and ambiguity) of the whole thing !
 
  • #13
Hi,
Thanks all for your interest in my problem.
@willem2
How much space does the page map itself need ?

There is no such term of page map in our book in this context.

@BvU

there are pages in virtual memory, which is 2^17

Can you please show me how you got 2^17.

Zulfi.
 
  • #14
zak100 said:
There is no such term of page map in our book in this context.
I think BvU meant the same as a page table.

zak100 said:
Can you please show me how you got 2^17.
I saw you had 2^16 page frames in your post #9, so Imultiplied by 2 as there are twice as much virtual pages as page frames. Unfortunately you had the right number of virtual pages, but not page frames, which should have been 2^14. This gives 2^15 virtual pages as you had.
which also means the space for a page table will be 4 times as small
 
  • Like
Likes   Reactions: zak100
  • #15
Hi,
Thanks for removing my confusion, so my answer 2^15 is correct. 2^14, you got this because physical memory is half the size of virtual memory. If this is wrong please let me know.

Thanks everybody for the video and for this useful discussion.

God bless you all.

Zulfi.
 
  • #16
Hi,
I still have confusion with this line:

A computer has 32-bit virtual addresses

and

If the physical memory (PM) is half size of virtual memory,

Can we say that PM = 2^31?

Zulfi.
 

Similar threads

  • · Replies 3 ·
Replies
3
Views
2K
Replies
3
Views
2K
  • · Replies 2 ·
Replies
2
Views
4K
Replies
2
Views
1K
  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
Replies
6
Views
4K
  • · Replies 19 ·
Replies
19
Views
36K
  • · Replies 19 ·
Replies
19
Views
2K