A process is a running program within the Operating System. A process will contain code that can be interpreted by the system processor. Because Linux and Windows use different executable structures, a program that runs on one OS cannot run on the another. A file that’s stored on the hard drive must be first loaded into RAM to be able to execute its instructions. The kernel is responsible for managing system resources and it gives control over CPU to different processes loaded into RAM. We’ve discussed previously about Linux boot process so please check out that article before proceeding further. In our days Operating Systems are multi-tasking which offers the possibility of running multiple programs at the same time. The kernel maintains a process table in which it stores information for each process such as:
- PID or process ID – it’s a number from 0 to 65535 that uniquely identifies a process .
- memory space – the kernel is responsible for dividing RAM memory for each process so they do not interfere with each other.
- UID, GID – group and user IDs determine the permissions with which a process is executed.
- the parent process
- the terminal on which the process is connected.
When the parent process terminates before the child process finishes its execution, the subprocess becomes an orphan process and its the registered under init which terminates its execution.
A process can have one of the following STATE:
Running – the process is running or it waits to receive access on the CPU
Waiting – the process is waiting for an event to occur or it waits for certain resources. There are two types of waiting processes:
- interruptible – may be interrupted by signals
- uninterruptible – cannot be interrupted and are dependent to hardware conditions
Stopped – the process has been stopped
Zombie – a process that’s stuck between finishing its execution and the moment it’s deleted from the process table.
Commands used to interact with System processes:
Use the ps -el command to view the current running processes:
ps command supports a lot of parameters that can help you a when trying to get processes information on a Linux Operating System. I personally prefer using the -faux parameters because it will display a tree like structure with full process information:
If you are using Linux OS on a daily basis then you are probably familiar with most of the information presented in this article. I’ve written it for those that are just beginning their Linux journey and want to learn new stuff about it. Processes play an important role within an OS so knowing how to interact with them is a must have skill. There may be other information that needs mentioned here so please post a comment if you have anything to add. Wish you all the best and stay tuned for the following articles.