The difference between parent and child processes and GDB multi-process debugging

The relationship between parent and child processes:

the difference:

1. The return value of the fork() function is different. In the parent process: >0. The returned child process ID. In the child process: ID=0.

2. The data in the pcb are different, the ID of the current process pid, the ID of the current parent process ppid, and the signal set

Common points:

In some states: the child process has just been created and has not yet performed any data writing operations.

        -Data in user area

        -File descriptor table

Are variables shared between parent and child processes?

        -In the beginning, it was the same, shared. If the data is modified, it will not be shared.

        -Sharing when reading (the child process is created, the two processes do not perform any writing operations), copying when writing,

GDB debugging

Guess you like

Origin blog.csdn.net/ME_Liao_2022/article/details/132915779