logical address to physical address conversion - Linux

This is a discussion on logical address to physical address conversion - Linux ; Hi, I have few doubts on the conversion of logical address into physical address. 1) Why we need to convert logical address into linear and from linear to physical address instead of doing it directly. 2) Can someone please describe ...

+ Reply to Thread
Results 1 to 11 of 11

Thread: logical address to physical address conversion

  1. logical address to physical address conversion


    Hi,

    I have few doubts on the conversion of logical address into physical
    address.

    1) Why we need to convert logical address into linear and from linear
    to physical address
    instead of doing it directly.

    2) Can someone please describe the way it converts when a user process
    runs.

    Thanks In Advance,
    Deepak

  2. Re: logical address to physical address conversion

    Dear deepak,

    deepak wrote:

    >
    > Hi,
    >
    > I have few doubts on the conversion of logical address into physical
    > address.
    >
    > 1) Why we need to convert logical address into linear and from linear
    > to physical address
    > instead of doing it directly.
    >
    > 2) Can someone please describe the way it converts when a user process
    > runs.
    >
    > Thanks In Advance,
    > Deepak


    I'm not a specialist, but as far I know, each program which you start gets
    the maximum available amount of lineair memory. So on a 1 Gigabyte
    system,it's no problem to declare a continuous data array of 1.5 Gbyte,
    provided you have another Gbyte of swapspace, without any programming pain.

    Of course, you do not want to physically reserve such a block of memory,
    otherwise your system is full at once,on a normal Linux or Windows system
    there are dozens of programs active which all have this huge amount of
    memory in principle available.

    The only way to offer each program a huge amount of memory is to
    let the OS in combination with memory management unit divide the memory into
    chunks with REALLY used memory, on arbitrary places in physical memory AND
    the swapspace, translated in such a way that the program sees
    easy-to-access lineair memory. So the OS and hardware do the job to manage
    the physical memory for all processes, and the user programs see a nice,
    continuous array of direct addressable memory. Of course, the sum of used
    memory in all processes cannot exceed the available RAM+swapspace.



    Hope that this clarifies a bit and kind Regards,

    H.Janssen


  3. Re: logical address to physical address conversion

    On Jul 20, 6:27 am, "H.Janssen"
    wrote:
    > Dear deepak,
    >
    >
    >
    > deepak wrote:
    >
    > > Hi,

    >
    > > I have few doubts on the conversion of logical address into physical
    > > address.

    >
    > > 1) Why we need to convert logical address into linear and from linear
    > > to physical address
    > > instead of doing it directly.

    >
    > > 2) Can someone please describe the way it converts when a user process
    > > runs.

    >
    > > Thanks In Advance,
    > > Deepak

    >
    > I'm not a specialist, but as far I know, each program which you start gets
    > the maximum available amount of lineair memory. So on a 1 Gigabyte
    > system,it's no problem to declare a continuous data array of 1.5 Gbyte,
    > provided you have another Gbyte of swapspace, without any programming pain.
    >
    > Of course, you do not want to physically reserve such a block of memory,
    > otherwise your system is full at once,on a normal Linux or Windows system
    > there are dozens of programs active which all have this huge amount of
    > memory in principle available.
    >
    > The only way to offer each program a huge amount of memory is to
    > let the OS in combination with memory management unit divide the memory into
    > chunks with REALLY used memory, on arbitrary places in physical memory AND
    > the swapspace, translated in such a way that the program sees
    > easy-to-access lineair memory. So the OS and hardware do the job to manage
    > the physical memory for all processes, and the user programs see a nice,
    > continuous array of direct addressable memory. Of course, the sum of used
    > memory in all processes cannot exceed the available RAM+swapspace.
    >
    > Hope that this clarifies a bit and kind Regards,
    >


    Hi Janssen,

    It clarifies a alot. Do you know any debugging tool through which I
    can see
    the step by step processing of paging? (something similar to gdb)

    Thanks,
    Deepak


  4. Re: logical address to physical address conversion

    deepak writes:
    >
    > It clarifies a alot. Do you know any debugging tool through which I
    > can see
    > the step by step processing of paging? (something similar to gdb)


    No -- this is all stuff that happens "under the covers"; it's not
    available (in any real sense) to software.

  5. Re: logical address to physical address conversion

    On Jul 21, 9:04 am, Joe Pfeiffer wrote:
    > deepak writes:
    >
    > > It clarifies a alot. Do you know any debugging tool through which I
    > > can see
    > > the step by step processing of paging? (something similar to gdb)

    >
    > No -- this is all stuff that happens "under the covers"; it's not
    > available (in any real sense) to software.


    Hi Joe,

    Page tables are stored in software. Right?
    So I'm looking for any tools to see their executions.

    Thanks,
    Deepak

  6. Re: logical address to physical address conversion

    Dear Deepak,

    deepak wrote:

    > On Jul 21, 9:04 am, Joe Pfeiffer wrote:
    >> deepak writes:
    >>
    >> > It clarifies a alot. Do you know any debugging tool through which I
    >> > can see
    >> > the step by step processing of paging? (something similar to gdb)

    >>
    >> No -- this is all stuff that happens "under the covers"; it's not
    >> available (in any real sense) to software.

    >
    > Hi Joe,
    >
    > Page tables are stored in software. Right?
    > So I'm looking for any tools to see their executions.
    >
    > Thanks,
    > Deepak



    As soon as you start any program, it will see the 3 Gbyte of lineair
    address space, the pagemapping is the kernel's business.

    There are a few points where kernel internal information is transferred to
    userspace,e.g. /proc//pagemap and /proc/kpagecount see e.g.

    http://www.linuxhq.com/kernel/v2.6/2...vm/pagemap.txt


    This are binary pseudo-files, so you need some effort to interpret them and
    you're digging deep into the kernel internals.

    An interesting site might be http://linux-mm.org

    Kind Regards,
    H.Janssen










  7. Re: logical address to physical address conversion

    deepak wrote:
    > Hi,
    >
    > I have few doubts on the conversion of logical address into physical
    > address.
    >
    > 1) Why we need to convert logical address into linear and from linear
    > to physical address
    > instead of doing it directly.


    ??? Where do you see a difference between "logical address" and "linear
    address"?
    A virtual user address is a linear address, i.e. it ranges linearly from
    0 to 4GB (not all is accessable, though and on 64 bit systems, this is
    from 0 to an incredibly huge number ;-)

    Linux does not use segmentation, so there is only one single linear
    address space.

    > 2) Can someone please describe the way it converts when a user process
    > runs.


    Simply put:

    The user process references a linear address in the range of 0..4GB.

    This virtual address is passed to the MMU (memory management unit).

    There the address is split into a page table index and a page offset
    (actually, depending upon the machine architecture, this may involve
    several indices and several levels of tables). The page table index is
    used to look up the physical base address of a page.

    If the page is present in memory, the physical base address and the page
    offset are combined into a physical address and the memory access can
    proceed (there are additional checks e.g. if the access is write and the
    page is writable).

    If the page does not exist, a "page fault" is generated which is handled
    by the kernel. The kernel determines whether this is actually a valid
    virtual address and how it can satisfy the access request. If the
    address is invalid (e.g. because it is not within the valid ranges of
    program code and program data), the process is sent a SIGSEGV. If it is
    valid, the necessary steps are taken to satisfy the request (e.g. data
    is loaded from disk to memory or a clean page is allocated) and the page
    table is modified accordingly.

    HTH,

    Josef
    --
    These are my personal views and not those of Fujitsu Siemens Computers!
    Josef Möllers (Pinguinpfleger bei FSC)
    If failure had no penalty success would not be a prize (T. Pratchett)
    Company Details: http://www.fujitsu-siemens.com/imprint.html

  8. Re: logical address to physical address conversion

    "H.Janssen" writes:
    >
    > deepak wrote:
    >
    >> On Jul 21, 9:04 am, Joe Pfeiffer wrote:
    >>> deepak writes:
    >>>
    >>> > It clarifies a alot. Do you know any debugging tool through which I
    >>> > can see
    >>> > the step by step processing of paging? (something similar to gdb)
    >>>
    >>> No -- this is all stuff that happens "under the covers"; it's not
    >>> available (in any real sense) to software.

    >>
    >> Hi Joe,
    >>
    >> Page tables are stored in software. Right?
    >> So I'm looking for any tools to see their executions.

    >
    > As soon as you start any program, it will see the 3 Gbyte of lineair
    > address space, the pagemapping is the kernel's business.
    >
    > There are a few points where kernel internal information is transferred to
    > userspace,e.g. /proc//pagemap and /proc/kpagecount see e.g.
    >
    > http://www.linuxhq.com/kernel/v2.6/2...vm/pagemap.txt
    >
    >
    > This are binary pseudo-files, so you need some effort to interpret them and
    > you're digging deep into the kernel internals.
    >
    > An interesting site might be http://linux-mm.org


    Everything Henny (I think that's your first name, guessing based on
    your email address) says is correct -- but not that this will just
    give you the table contents, it won't take you through the execution.

    Actually... you can find something about the linear-physical
    translation that I wrote for my students at
    http://www.cs.nmsu.edu/~pfeiffer/cla...es/intelvm.php
    This description doesn't get into the cache or TLB, of course.


  9. Re: logical address to physical address conversion

    Josef Moellers writes:

    > deepak wrote:
    >> Hi,
    >>
    >> I have few doubts on the conversion of logical address into physical
    >> address.
    >>
    >> 1) Why we need to convert logical address into linear and from linear
    >> to physical address
    >> instead of doing it directly.

    >
    > ??? Where do you see a difference between "logical address" and
    > "linear address"?
    > A virtual user address is a linear address, i.e. it ranges linearly
    > from 0 to 4GB (not all is accessable, though and on 64 bit systems,
    > this is from 0 to an incredibly huge number ;-)
    >
    > Linux does not use segmentation, so there is only one single linear
    > address space.


    My guess is that he is talking about segmentation (and of course Linux
    does use it, it just points all the segments to the same place).
    Umm... you must be using 'single' in a different way than I'm
    expecting: the linear address space is per-process.

    (good description of linear-physical translation snipped)

  10. Re: logical address to physical address conversion

    deepak wrote:
    >
    >Page tables are stored in software. Right?


    No. Page tables are stored in memory. They are just data. There's
    nothing to execute.

    >So I'm looking for any tools to see their executions.


    You can't see their execution. You can look at the tables, but you can't
    see them execute.
    --
    Tim Roberts, timr@probo.com
    Providenza & Boekelheide, Inc.

  11. Re: logical address to physical address conversion

    Keep Linux free
    Spam and smoke free as well



    Tim Roberts wrote:
    > deepak wrote:
    > >
    > >Page tables are stored in software. Right?

    >
    > No. Page tables are stored in memory. They are just data. There's
    > nothing to execute.
    >
    > >So I'm looking for any tools to see their executions.

    >
    > You can't see their execution. You can look at the tables, but you can't
    > see them execute.
    > --
    > Tim Roberts, timr@probo.com
    > Providenza & Boekelheide, Inc.


+ Reply to Thread