Processes in Linux
See what are the attributes of processes (programs) in Linux
It is important that you understand that each program is at least one process and that each process has some attributes, such as:
- Process ID (PID): Each process has a unique identification number. The first init process will always have PID 1 and for the rest of the processes this number increases as new processes are executed;
- User ID and Group ID (user ID and group ID): Processes must be executed with the privileges of a user account and the group associated with them. This is important because this way the system can determine and manage access to resources;
- Parent Process: In Linux, no process runs independently of the others. All processes in the system, with the exception of init, have a parent process, which is responsible for their execution. The parentID attribute records the PID of the parent process. If the parent process completes its execution before the child process, the child process is “sponsored” by init, earning a Parent ID equal to 1;
- Environment variables: Each process inherits some environment variables from the parent process that simply hold some values that may or may not be important to the process in progress. It is possible that during its execution, a process changes, increases, or deletes an environment variable. A child process can inherit variables from a parent process. But a parent process is unable to access variables created or changed by its children.
- Working directory: Processes are also associated with a working directory, where they can read and write the disk;
- Timers: The Kernel keeps records of the time when processes are created as well as the CPU time that they consume during their execution.
In a multiprogrammed environment with just one processor, each process is executed little by little at a time, interspersed.
The operating system allocates the CPU a bit for each process. A process after receiving processor control will only lose it when an interruption occurs or when it requires an operating system service.
These interruptions are transparent to the processes, since they only temporarily interrupt their execution, which will then continue to be executed as if nothing had happened.
When requesting an operating system service, the process is blocked until the service required from the operating system is satisfied.
Learn much more about Linux in our online course. You can enroll here with a free 7-day trial. If you already have an account, you can log in here.