Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

how process differnenciate?

Posted on 2000-04-28
14
Medium Priority
?
288 Views
Last Modified: 2010-04-02
Hi all,I run many program and I find every program has the same CS content.So,My questio is simple:

Why different process has different physic address in windows since they have same CS selector ?

Thanks
0
Comment
Question by:Babyworship
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
14 Comments
 
LVL 32

Expert Comment

by:jhance
ID: 2761829
This is the "miracle" of virtual memory.  All programs "see" the same virtual memory space and the operating system along with VM hardware map the virtual address space to real physical addresses and your disk-based pagefile.
0
 
LVL 5

Expert Comment

by:Wyn
ID: 2761901
Because they have different LDTs which has different linear address which is dissected into different pages which refer to different phisical address which make each one different in between which make my comment which is bad english expression which means i'm poor in English which encourage me study everyday which will result in better expression in the future which will help me ask and answer question here more easy...

Regards
Eirnava...

0
 
LVL 3

Expert Comment

by:GlennDean
ID: 2762146
Hi:
  This is just saying what jhance and Wyn have said but in a different way.  
   Each process has it's own LDT - the OS keeps track of the active LDT by putting info in the LDTR (LDT Register).  An app's CS is simply a 13-bit index into its LDT.  The particular entry in its LDT has a 32-bit linear address which has to be deciphered.  Already you can see how addresses are already different since eventhough 2 app's have an index of say 3 they go to two different LDTs.
   The 32-bit linear address is composed of 3 pieces: 10-bits for the  Directory, 10-bits for the Page and 12 bits for the offset.
   The 10-bits for the directory is again an index into a Page Directory Directory (which is pointed to by Control Register 3) - here's another reason the addresses differ.  When the particular entry in the Page Directory Table is accesses, it has an address to a Page Table.  The 10-bit for the Page in the linear address is an index into that Page Table.  And, finally, the very-very particular page table has an address to a physical address chunk is "real-live" memory.  The 12-bit offset in the linear address says where this page starts relative to the physical address indicated by the page table.  
   So, I made a short story long, but hopefully you see there are 3 reasons why two app's have the same CS and they hash to two different spots in physical memory.
  Glenn
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:Babyworship
ID: 2762280
Thanks , Glenn ,I will give you the points for your great comment and help.But I still have one confusion in your comment:

I know CS always points to the zero address of the 4g virtual linear address in differnt programs, so , how it become different 32 linear address representing "The 32-bit linear address is composed of 3 pieces: 10-bits for the  Directory, 10-bits for the Page and 12 bits for the offset." as you state?

In short,how the 32bit comes different in different program?

Thanks!!
0
 

Author Comment

by:Babyworship
ID: 2762283
Thanks, Wyn,you are lots of fun:-)
0
 
LVL 3

Expert Comment

by:GlennDean
ID: 2762289
I also had to stop laughing after reading Wyn's comment before commenting.  It's a classic!  
  I think Babyworship what you're saying is the CS selector 13-bit index is always 0? IF so, that just means the 0th index into the app's LDT.  You have to remember each app has its own LDT so that as another app starts executing, the LDTR will point to another/different LDT.  In the two LDT's 0th entry, even if the linear addresses are identical (although I do not believe you can "see" that info unless you are at Ring0), you still have the Page Directory Table (Control Register 3 points to 2 different directory tables for 2 different apps) and Page Tables to decipher the linear address.
   Glenn
0
 
LVL 3

Expert Comment

by:GlennDean
ID: 2762321
>In short,how the 32bit comes different >in different program?
   Oops, I didn't answer your above question.  Let's say the 32-bit linear addresses are identical.  Since the Control Register 3 will point to two different Page Directory Tables, eventhough the 10-bit index into those two distinct tables are the same, the pointers to the Page Tables in the entry in the Page Directory Tables will be different.  Thus, already you're accessing different data structures to get the physical address.
  Glenn
0
 

Author Comment

by:Babyworship
ID: 2762354
Thanks,Glenn,say,differnt process has different LDT which has different starting address,is this address used into the 32bit address above?3

Thanks
0
 
LVL 3

Expert Comment

by:GlennDean
ID: 2762361
No, the final physical address is from the Page Table.
   Glenn
0
 

Author Comment

by:Babyworship
ID: 2762399
Hi ,Glenn,I mean the 32bit address before applying paging.i.e:from the descriptor in the LDT table.
Is the IDT table base address useful for calculating the fianl address?  
0
 
LVL 3

Accepted Solution

by:
GlennDean earned 160 total points
ID: 2762499
Hi:
  Different paging tables means the 32-bit physical addresses are different.  
   The IDT has, to best of my knowledge, has nothing to do with going from CS to physical address.
   Glenn
0
 

Author Comment

by:Babyworship
ID: 2762519
Thanks!

Wyn,thank you too!!

And Jhance!

0
 
LVL 3

Expert Comment

by:GlennDean
ID: 2762527
Hi Babyworship:
   Just out of curiosity, it's rare to find anyone who even cares 0.1% about all this stuff.  Are you working on a special project at work or maybe trying to write a Protected Mode program or you're just curious about all this stuff?
   Glenn
0
 

Author Comment

by:Babyworship
ID: 2762545
GlennDean ,would you please give me a email ?

babyworship@163.net

I want to let you know some.

Thank you here again!!!!!!

0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question