Two Processes Can Use the Same Virtual Address

Virtual addresses are interpreted in a process's address space. The same numeric address can identify different mapped storage in different processes.

Source
Anbloq
Language
English
Created
Updated
Chapters
4
Reading time
1 min
In this article4 chapters
  1. Trace a conceptual pair
  2. Distinguish deliberately shared storage
  3. Draw two address mappings for one displayed number
  4. State which view a diagnostic uses

Trace a conceptual pair

Both process A and process B can store a value at virtual position 4096. They need not share that storage. A virtual-to-physical mapping determines the location. See virtual address translation.

Distinguish deliberately shared storage

When two processes intentionally map the same file or shared object, related offsets can expose common bytes. The numeric virtual addresses need not agree. Memory-mapped files illustrate that arrangement.[1]

Draw two address mappings for one displayed number

Two processes can both refer to virtual address 0x4000. Their address spaces may map it to different physical pages, so writing through one normally leaves the other unchanged. Deliberately shared mappings can change that relationship. See aliases for memory addresses.

Process A: virtual 0x4000 → page X
Process B: virtual 0x4000 → page Y
Same numeric address, distinct mapped objects in this example

State which view a diagnostic uses

A pointer printed from one process cannot ordinarily be dereferenced in another process merely by copying its number. Use supported mappings or interprocess communication. Check permissions, identity and offset before interpreting a shared memory observation.

References

  1. Remzi H. Arpaci-Dusseau and Andrea C. Arpaci-Dusseau, Operating Systems: Three Easy Pieces ↩