Re: Virtual Address Space

new topic     » goto parent     » topic index » view thread      » older message » newer message

Al Getz writes:
> The strange thing is, peek(addr) doesnt generate an error
> even though another program had allocated that 'space',

No. Another program did not allocate that space.
The other program allocated space in *its own*
virtual address space. peek(addr) refers to a different
*physical* memory location in every program that's running,
so it's not surprising that a different value will be returned
in each case. system() starts up a new program.

Two active programs can both be using
virtual memory location 1000 (say) at the same time,
but it's a *different* physical location. This is the magic
of virtual memory.

In modern operating systems (WIN32, Linux etc.)
programs deal with virtual addresses. The O/S with help
from the hardware maps these virtual addresses into
the physical addresses that access the memory chips.

> Rob:
> I still have to wonder why peek(addr) attemps to return a value
though smile

I guess addr was a legitimate (virtual) address for that program.
Some other address might give you a segmentation violation.

Regards,
   Rob Craig
   Rapid Deployment Software
   http://www.RapidEuphoria.com

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu