Understanding postgreSQL shared memory

I looked through the presentation and there is still one question about the operation of shared buffers. As slide 16 shows, when the server processes an incoming request, the process postmastercalls fork()to create a child to process the incoming request. Here is a picture from there: enter image description here

So, we have the whole copy of the postmaster process, except for it pid. Now, if the child process updates some data that belongs to shared memory (putting it in shared buffers, as shown in slide 17), we need other threads to be aware of the changes. Picture:

enter image description here

- , . , , - . , proc1 fork() proc2 - .

: proc1 , , proc2?

+4
2

, , .

- , fork() ( exec()), . , -, . , , fork(), , fork(). - . , , .

Program (text), data stack .

- PostgreSQL POSIX - , , V . , . , . / .

" " .

POSIX , shared_buffers .. .. , fork() ing.

fork , . , fork . - top ..

PostgreSQL " ", () POSIX System V, . fork().

+4

, Linux , , , ( , ) . , , COW ( ) . , .

+1

Source: https://habr.com/ru/post/1610142/


All Articles