linux - Virtual memory sections and memory mapping area -


as process has virtual memory copied ram during run time. given in previous post.

which part of process virtual memory layout mmap() uses?

enter image description here

i have following doubles :

  1. if memory mapping inside unallocated memory , inside process's virtual memory. virtual memory helps avoid 1 process touch other process's virtual memory. how can memory mapping used interprocess communication(ipc)?
  2. in os linux, whether has each individual process separate section of heap, stack , memory mapping or processes have 1 common section heap, stack , mmap?
    example :
    if there p1,p2 , p3 processes running on linux os. have common table given in picture or each individual task have separate table each section.
  3. in 32 bit system, 2^32=4 gigabytes of virtual memory possible , 1g byte reserved kernel , 3 gigabytes userspace applications. can each individual process have 3 gigabytes of virtual memory or sum of userspace applications size 3 gigabytes (i.e virtual memory size of (p1+p2+p3)<=3 gigabytes)?

--
learner

  1. using memory mapping ipc works mapping same range of physical memory 2 or more virtual address ranges in different processes. works communication because both processes using exact same memory cells (although might "see" them differently, @ different addresses). change value in 1 mapping, , instantly visible in other mapping in different process because same memory.
  2. every process has own independent stack , heap. os not care @ all, cares pages. heap , stack things implemented application (via runtime). when call function malloc, allocator in runtime either returns block had reserved earlier or 1 has recylced (you called free earlier), or asks os reserve more memory (sbrk or mmap). when first access memory, os sees page fault , verifies allowed access location (because you've reserved it) , provides valid page.
  3. every process can use (as in "reserve") whole available address space (3gib in example). not interfere other process. note due fragmentation , alignment, , because executable , stack take away little bit, in practice not able allocate full 3 gib, can close it.
    processes can use virtual memory available on system (physical ram plus swap space), can use as there physical memory available at same time (minus little bit , that, unpageable kernel memory , such).

Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -