Process
Процесс
A running instance of a program is called a process. The operating system gives each process its own memory space and tracks the resources it uses, such as open files.
A program is not a process
An executable file contains instructions. A process is what the operating system manages when those instructions run. Start the same command in two terminals and you'll usually have two processes running the same code, each with its own state. The OS identifies them by process ID (PID). A PID identifies a live process in its system context; it isn't a permanent identifier and can be reused after the process is gone.
What the operating system keeps track of
A process has a virtual address space for its code, data, heap, and thread stacks. If two processes use the same numeric memory address, that doesn't mean they're accessing the same bytes. The OS also tracks resources such as open files and sockets, along with the process's permissions.
Threads are what execute instructions. Threads in one process share its address space, but each thread has its own stack and saved register state. On modern operating systems, the scheduler typically gives CPU time to runnable threads. A thread blocked on input, on the other hand, usually won't run again until the input arrives or another event wakes it up.
Example: two instances of the same command
In a Linux shell, run the same command twice in the background and inspect the two PIDs:
sleep 60 &
first=$!
sleep 60 &
second=$!
ps -o pid,ppid,stat,comm -p "$first,$second"
$! records the PID of the most recent background job in this example. Both rows show the same command name, but the PIDs differ. The parent PID (PPID) points to the shell that started them. The commands are still running in the sense that they haven't exited, but they spend almost all their time waiting for their timers rather than using the CPU.
When process boundaries matter
A worker process that crashes generally doesn't wipe out another worker's in-memory state. That makes separate processes useful when you want to restart workers independently. The trade-off is that one worker can't just read a variable from another. They need interprocess communication (IPC), such as a pipe or socket, or an explicitly shared memory region. Separate address spaces also don't prevent two processes from overwriting the same file or updating the same database record; those resources still need their own coordination.
In technical interviews
If asked whether to use threads or processes, explain what needs to be shared and what needs to survive a crash. Threads make in-memory sharing straightforward, but concurrent access can require synchronization. Processes provide a stronger isolation boundary, but exchanging data takes extra work. Neither choice guarantees parallel execution: a single CPU core can alternate between two runnable tasks without executing them at the same instant.