FFI Report, CVS Id 1.11

Manuel M. T. Chakravarty chak at cse.unsw.edu.au
Thu Aug 23 21:14:22 EDT 2001


cwitty at newtonlabs.com (Carl R. Witty) wrote,

> "Manuel M. T. Chakravarty" <chak at cse.unsw.edu.au> writes:
> 
> > Array and list indicies are quite different beats from
> > pointer differences.  To get into a problem with array
> > indicies, we would need an array (and thus, heap) that is
> > big enough to requires such an index.  In contrast, pointers
> > are not constrained be point into the heap.  For, example
> > with mmap(), I can easily get two pointers that are much
> > further apart than what would fit into the real (even the
> > virtual) memory of the concrete hardware.  In other words,
> > in x86 Linux, your address space is already 3GB.  We don't
> > need any new fancy hardware for 30 bit pointer differences
> > to have the potential to get us into trouble.
> 
> Why would you want to take the difference of two pointers that point
> into different objects?

For example, if you construct a representation of the mapped
areas in the address space of a process (ie, by reading
/proc/<pid>/maps on a Linux system).  You may do that, among
othe things, to find a suitable memory area for mapping
anonymous memory pages.

Manuel

PS: If you think that this is a useless thing to do, check
    out

      http://www.cse.unsw.edu.au/~cs9243/assigns/ass2/

    You need this if you want to implement a Distributed
    Shared Memory system as a pure user-space library.




More information about the FFI mailing list