Linux Process Control

What is program, what is process, what is PID, what is PPID, what is fork, what is exec ?

process

Processes carry out tasks within the operating system. A process can be thought of as a computer program in action.

program

A program is a set of machine code(binary code) instructions and data stored in an executable image on disk and is, as such, a passive entity.

PID

process ID

PPID

process’s parent’s PID
tmux: parent process
bash: child process

1
2
3
4
5
$ ps -l

F S UID PID PPID C PRI NI ADDR SZ WCHAN TTY TIME CMD
0 R 1000 14945 27037 0 80 0 - 8989 - pts/0 00:00:00 ps
0 S 1000 27037 2840 0 80 0 - 7441 wait pts/0 00:00:00 bash

  • parent process -> child process
    1). fork a parent process
    2). exec child process