-
Laurent Modolo authoredLaurent Modolo authored
title: Unix Processes
Unix Processes
Objective: Understand how process works in GNU/Linux
A program is a list of instructions to be executed on a computer. These instructions are written in one or many files in a format readable by the computer (binary files), or interpretable by the computer (text file). The interpretable format needs to be processed by an interpreter who is in binary format.
The execution of a program on the system is represented as one or many processes. The program is the file of instruction while the process is the instructions being read.
mkdir
is the program, when you type mkdir my_folder
, you launch an mkdir
process.
Your shell is a process to manipulate other processes.
In multitasking operating systems, processes (running programs) need a way to create new processes, e.g. to run other programs. Fork and its variants are typically the only way of doing so in Unix-like systems. For a process to start the execution of a different program, it first forks to create a copy of itself. Then, the copy, called the "child process", calls the exec system call to overlay itself with the other program: it ceases execution of its former program in favor of the other.
Some commands in your shell don’t have an associated process, for example there is no cd
program, it’s a functionality of your shell. The cd
command tell your bash
process to do something not to fork another process.