Solved

how process differnenciate?

Posted on 2000-04-28
14
266 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
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
 

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
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 

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 40 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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

708 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now