2

I was going through few of the lectures conducted at UC Berkeley on Virtual Memory

@ https://www.youtube.com/results?search_query=computer+science+194+-+lecture+14

"Computer Science 194 - Lecture 13_ Memory Management_ Mechanisms on various architectures, NUMA" and "Computer Science 194 - Lecture 14_ Virtual Memory Management, Swapping, Page Cache"

Its an excellent lecture. However , I am slightly confused on one point.

The lecture explains how segmentation and paging have been combined for addressing VM. It goes on to explain that the current systems use as the structure of VM address.

It also mentioned that the virtual space visible to a process is private and the address ranges for each process remains same. Each process views its address space to start at 0 and extend till 4G. with different segment areas within this 4G space.

Questions :

  1. Now if the address ranges for each VM space is same , How is it that two processes referring to the highest level lookup table - the PageTblPtr using "segment Number" as the index , are uniquely able to identify a row in this table ... as the segment address/number for each of the process may be same... lets say Process A's and B's have both data segment starting at address 'x' within there VM space .

  2. Does that also mean that there could be as many as 6 entries in the PagetblPtr for a process for each - 6 possible segments - CS, DS, ...etc?

  3. Where is the PageTblPtr maintained ?

Best Regards, Varun

1 Answer 1

3

I'm not going to watch an 83-minute video lecture just to get the exact definitions of terms like PageTblPtr, but I'll try to provide some general answers:

  • Modern operating systems don't use segmentation. It's just a big flat address space, and all the segment selectors are set to encompass the whole thing. I don't think x86 processors even support segmentation when running in 64-bit mode.
  • Each process has its own page table, which defines the mappings for that process's virtual address space. Two processes can have different data at the same virtual address because their respective page tables point to different physical pages for the same virtual page.
  • Page tables are owned and managed by the OS kernel. When the kernel performs a task switch (changing which process it's running), one of the things it must do is activate the new process's page table instead of the old.
Sign up to request clarification or add additional context in comments.

1 Comment

That is correct. x86 does not use segments in 64-bit mode. They should have died out in 32-bit mode.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.