njosefbeck / devops-and-backend-dev-roadmap

To keep track of my personal progress through the backend and devops roadmaps found at roadmap.sh
0 stars 0 forks source link

Process Notes #2

Open njosefbeck opened 5 years ago

njosefbeck commented 5 years ago

What is a process?

Before talking about a process, first we must define what a program is. In short, a program is a passive collection of instructions for the server to run.

A process is the active execution of those instructions. The basic flow is:

write code (program) > computer compiles it to binary > run the binary (process)

A single program can be run multiple times at the same time, thus creating multiple processes.

Processes are represented by process identifiers (PID), a unique numeric value. (These numeric values can be recycled, so two processes could have the same PID, just not at the same time.)

Processes can be short or long-lived.

Program vs process

When a program becomes a process, it can be divided into four sections:

Process parts

Types of processes

bob_process_types

Foreground: A foreground process is initialized and controlled through a terminal session. A user starts these, not the system.

Background: Not connected to a terminal and doesn't expect any user input. A daemon is a type of background process that starts at system startup and continues to run forever as a service.

Processes can also be divided into Parent and Child processes. Child processes are created by a parent process at runtime.

Process states

bob_process_states

Processes can have a number of possible states. The names for these states vary by operating system, but the following five are pretty standard.

bob_process_states_flow

njosefbeck commented 5 years ago

Remaining process-related notes: