Home > Archive > Unix Programming > January 2005 > Get Physical Address
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Get Physical Address
|
|
| 50295@web.de 2005-01-12, 4:01 pm |
| This may sound strage, but I would like to know if there a system call
that permits a user to get the physcial address of a variable?
Thanks
- Olumide
| |
| Juha Laiho 2005-01-12, 4:01 pm |
| 50295@web.de said:
>This may sound strage, but I would like to know if there a system call
>that permits a user to get the physcial address of a variable?
.... and what would the address be if the page containing the variable
is paged (swapped) out?
--
Wolf a.k.a. Juha Laiho Espoo, Finland
(GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V
PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++
"...cancel my subscription to the resurrection!" (Jim Morrison)
| |
|
| Juha Laiho wrote:
> 50295@web.de said:
>
>
>
> ... and what would the address be if the page containing the variable
> is paged (swapped) out?
And: what would it be after the page would be paged in again ;-)
HTH,
AvK
| |
| Fletcher Glenn 2005-01-12, 4:01 pm |
| 50295@web.de wrote:
> This may sound strage, but I would like to know if there a system call
> that permits a user to get the physcial address of a variable?
> Thanks
>
> - Olumide
>
I don't think that there is a way to do this from user space. From the
kernel, it's possible because the kernel runs the memory management unit.
On the other hand, you can get access (as root) to /dev/mem, which
allows access to physical memory. The does not provide any mappings
between variable addresses (MMU addresses) and physical addresses.
--
Fletcher Glenn
| |
| 50295@web.de 2005-01-12, 4:01 pm |
| Thats the point. I just want to show that the physical address will
most certainly change, while the virtual address remains constant.
Thanks,
- Olumide
| |
| Rich Teer 2005-01-12, 8:58 pm |
| On Wed, 12 Jan 2005 50295@web.de wrote:
> This may sound strage, but I would like to know if there a system call
> that permits a user to get the physcial address of a variable?
Such a thing is meaningless in a VM system like UNIX. There's
no guarantees (apart from locking pages in memory perhaps) that
the physical address will be constant.
--
Rich Teer, SCNA, SCSA, author of "Solaris Systems Programming"
President,
Rite Online Inc.
Voice: +1 (250) 979-1638
URL: http://www.rite-group.com/rich
| |
| Rich Teer 2005-01-12, 8:58 pm |
| On Wed, 12 Jan 2005 50295@web.de wrote:
> Thats the point. I just want to show that the physical address will
> most certainly change, while the virtual address remains constant.
Refer the person asking you this to any decent CS text book. :-)
--
Rich Teer, SCNA, SCSA, author of "Solaris Systems Programming"
President,
Rite Online Inc.
Voice: +1 (250) 979-1638
URL: http://www.rite-group.com/rich
| |
| Kenny McCormack 2005-01-14, 3:59 pm |
| In article <Pine.SOL.4.58.0501121434570.10149@zaphod>,
Rich Teer <rich.teer@rite-group.com> wrote:
>On Wed, 12 Jan 2005 50295@web.de wrote:
>
>
>Such a thing is meaningless in a VM system like UNIX. There's
>no guarantees (apart from locking pages in memory perhaps) that
>the physical address will be constant.
How can you say that a request is meaningless?
Here's an analogy. People move. If I give you my address today, it might
not be valid tomorrow. Does that mean it is meaningless for you to ask me
my address?
A thing can be true at a given moment.
| |
| Jens.Toerring@physik.fu-berlin.de 2005-01-14, 3:59 pm |
| Kenny McCormack <gazelle@yin.interaccess.com> wrote:
> In article <Pine.SOL.4.58.0501121434570.10149@zaphod>,
> Rich Teer <rich.teer@rite-group.com> wrote:
[color=darkred]
> How can you say that a request is meaningless?
> Here's an analogy. People move. If I give you my address today, it might
> not be valid tomorrow. Does that mean it is meaningless for you to ask me
> my address?
> A thing can be true at a given moment.
Possibly, but a variable may not be in memory at a given time, thus
not having a physical address at all. Moreover, the physical address
may already have changed between the moment you received that bit of
information and the moment you use it. So everything you do with that
knowledge is rather likely to fail in unfathomable ways.
Regards, Jens
--
\ Jens Thoms Toerring ___ Jens.Toerring@physik.fu-berlin.de
\__________________________ http://www.toerring.de
| |
| Rich Teer 2005-01-14, 3:59 pm |
| On Fri, 14 Jan 2005, Kenny McCormack wrote:
> How can you say that a request is meaningless?
Because the amount of time the information would be valid, if
it ever is (consider the case of a variable that is currently
paged out), is likely to be very small.
> Here's an analogy. People move. If I give you my address today, it might
> not be valid tomorrow. Does that mean it is meaningless for you to ask me
> my address?
Good analogy, but it has one flaw: people tend to move far less
frequently than virtual pages in a computer system.
> A thing can be true at a given moment.
Agreed; but if it is only true for a few milliseconds, its
usefulness is somewhat limited.
--
Rich Teer, SCNA, SCSA, author of "Solaris Systems Programming"
President,
Rite Online Inc.
Voice: +1 (250) 979-1638
URL: http://www.rite-group.com/rich
| |
| Mark Rafn 2005-01-14, 3:59 pm |
| >>On Wed, 12 Jan 2005 50295@web.de wrote:
[color=darkred]
>Rich Teer <rich.teer@rite-group.com> wrote:
Kenny McCormack <gazelle@interaccess.com> wrote:[color=darkred]
>How can you say that a request is meaningless?
Well, meaningless or asked in such a way as to make it appear meaningless. If
the OP really needed that datum, he'd have asked a more concrete answer,
including a description of what "physical address" means to him.
>Here's an analogy. People move. If I give you my address today, it might
>not be valid tomorrow. Does that mean it is meaningless for you to ask me
>my address?
Bad analogy. Postal addresses are logical addresses, with understood lookup,
delivery, and forwarding rules. Try this:
"Please give me your distance vector from the center of the sun." It may be
a meaningful question in a rare set of circumstances, but it's far more
likely to be a misunderstood requirement. By far, most people would rather
have a logical address, either a postal address or an earth-relative
latitude/longitude.
>A thing can be true at a given moment.
Aye, but the use of such momentary truths is complex and specialized, and when
someone askes a short general question without detail about why they're
asking, it's reasonable to guess that they're about the nature of the
question, rather than just giving a simple answer.
Especially when there is no simple answer.
--
Mark Rafn dagon@dagon.net <http://www.dagon.net/>
|
|
|
|
|