2
votes

I know from my reading of OS concepts book that process in memory consists from: text section, data section, stack and heap.

But I am asking about when a process asks Kernel to create a shared memory segment when this section is created? in heap?


Another question Kernel knows information about every process in the system in PCB format and save this PCB in process-table.

The question is: is the process-table doubly-linked list?

1
Yes it is doubly linked list (struct list_head tasks;) But CFS scheduler uses RB-tree to maintain runqueueSasi V

1 Answers

8
votes

I suppose that your question is about a process memory layout. If so, Linux and Solaris processes have the following sections:

Text
Data
BSS
Heap
MMS (memory mapping segment)
Stack

The memory array between the Heap and Stack, so called Memory Mapping Segment, is responsible for the shared memory mapping. And not only. Shared libraries, opened files are also mapped into that section of memory.

You may examine process memory layout on Linux by pmap command or reading the process maps file /proc//maps. Here is a fragment of a DB2 process memory layout examined on a Linux machine by the pmap utility (look at the stack and shmid, shared memory ID, entries):

0000000000400000     52K r-x--  /opt/ibm/db2/bin/db2vend
000000000060d000      4K rwx--  /opt/ibm/db2/bin/db2vend
000000000c33e000    132K rwx--    [ anon ]
0000000200000000  35520K rwxs-    [ shmid=0x57a58007 ]
000000323f200000    112K r-x--  /lib64/ld-2.5.so
and more more more shared libraries
00002b55bb45b000      4K r-x--  /lib64/libnss_files-2.5.so
00002b55bb45c000      4K rwx--  /lib64/libnss_files-2.5.so
00002b55bb45d000  39252K rwxs-    [ shmid=0x57a50006 ]
00002b55bdab2000   1152K rwx--    [ anon ]
00007ffffaf35000     84K rwx--    [ stack ]
ffffffffff600000   8192K -----    [ anon ]