Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Process's virtual address

Process's virtual address

Scheduled Pinned Locked Moved C / C++ / MFC
questionperformance
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Anonymous
    wrote on last edited by
    #1

    I'm reading <>, and get confused by some point. The following is quoted from : "every process has its own private address space. Process A can have a data structure stored in its address space at address 0x12345678, while Process B can have a totally different data structure stored in its address space—at address 0x12345678. When threads running in Process A access memory at address 0x12345678, these threads are accessing Process A's data structure. When threads running in Process B access memory at address 0x12345678, these threads are accessing Process B's data structure. Threads running in Process A cannot access the data structure in Process B's address space, and vice versa." my questions are: 1> 0x12345678 appears in both process A and B. is 0x12345678 the actual virtual address or just the offset to the base virtual address of a process? 2> if the answers to the first question is "actual virtual address", does that mean two processes could have the same virtual address(or overlapped virtual address, in other words)? 2> how does the system raise a Access Violation exception? in particular, is the exception raised by checking the virtual address against the process's address space or by checking it against the phisical address after address translation? Thank you very much! Wenrich

    A 1 Reply Last reply
    0
    • A Anonymous

      I'm reading <>, and get confused by some point. The following is quoted from : "every process has its own private address space. Process A can have a data structure stored in its address space at address 0x12345678, while Process B can have a totally different data structure stored in its address space—at address 0x12345678. When threads running in Process A access memory at address 0x12345678, these threads are accessing Process A's data structure. When threads running in Process B access memory at address 0x12345678, these threads are accessing Process B's data structure. Threads running in Process A cannot access the data structure in Process B's address space, and vice versa." my questions are: 1> 0x12345678 appears in both process A and B. is 0x12345678 the actual virtual address or just the offset to the base virtual address of a process? 2> if the answers to the first question is "actual virtual address", does that mean two processes could have the same virtual address(or overlapped virtual address, in other words)? 2> how does the system raise a Access Violation exception? in particular, is the exception raised by checking the virtual address against the process's address space or by checking it against the phisical address after address translation? Thank you very much! Wenrich

      A Offline
      A Offline
      AlexO
      wrote on last edited by
      #2

      You kind of complicate the issue (not without the help of the good book :)). Virtual address could be understood as mapped address. This mapping service provided by the system so it is transparent to the program. Each process has right to use up to 2GB in Win9X and 4GB in WinNT (I could be wrong on the actual numbers but that is irrelevant). Obviously very few computers have that much memory, so system uses swapping to load requested memory block into the physical memory. If application ask for memory at 1GB offset it does not mean that it actually offset to the physical memory. The physical address of the memory block could be changed during lifetime of the program. The virtual address stays the same, because, once again it is just mapping for the system to know what a program is asking.

      W 1 Reply Last reply
      0
      • A AlexO

        You kind of complicate the issue (not without the help of the good book :)). Virtual address could be understood as mapped address. This mapping service provided by the system so it is transparent to the program. Each process has right to use up to 2GB in Win9X and 4GB in WinNT (I could be wrong on the actual numbers but that is irrelevant). Obviously very few computers have that much memory, so system uses swapping to load requested memory block into the physical memory. If application ask for memory at 1GB offset it does not mean that it actually offset to the physical memory. The physical address of the memory block could be changed during lifetime of the program. The virtual address stays the same, because, once again it is just mapping for the system to know what a program is asking.

        W Offline
        W Offline
        Wenrich
        wrote on last edited by
        #3

        Thanks a lot! I'm aware of the virtual memory and physical memory concepts. I just got confused by the statement that process A and process B both have acess to virtual memory at 0x12345678, because my understanding is that the system uses the virtual memory space allocated to the process to verify whether a memory access is valid and an Access Violation would be raised if it's not. Is my understanding wrong? Thank you very much for your help! Wenrich

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups