01. Processes

What is a Process?

Technically speaking, a process is a series of interdependent operations carries out by a computer. Every time a program is launched or booted, a corresponding process is created.

Process management is at the heart of how modern operating systems manage multitasking operations. Without them, computers would only be able to run a single application at a time, making for a very limited user experience!

Unix organizes these processes by queueing them up, and having them waiting their turn at the CPU. Each process has a ranking, and a turn called a timeslice. Unix, and other related OS's sharing these features are known as time sharing systems. This is very much like a check-out line at the grocery store except the system is very rapid, with most programs taking fewer than a second to execute.

time sharing system with multiple processes

In this section, we'll go over how to examine what processes are doing, and how to interact with processes to stop or pause them as needed.

The very first process, init

Upon boot, the very first process to be run is init (short for initialization). After init is started, a series of shell scripts in /etc called init scripts are executed.

With each consecutive process, a unique identifier is given. Since init is the first running process, it is given a PID of 1.

Types of Processes

Here are a few types of processes you should familiarize yourself with.

Daemon Processes

Most processes initialized by init are daemon programs (prounounced DEE-man). These processes just sit in the background and perform their tasks without any user interface.

Some example daemon processes are the mail and print daemons, which wait for some mail, or print job to come in.

Parent and Child Processes

Processes can launch other processes through appropriate system calls such as fork or spawn. What results is a parent-child process relationship.

If a process is run through the command line interface, or shell, the shell is the parent. Every process has a parent, except the init process.

Zombie processes

A zombie (or defunct) process arise when a child process is terminated, but its entry still lives in the process table. All memory and resources are released from the terminated child, and only its entry remains. until the parent process fetches status info for terminated child, this process is known as a zombie.

Orphan Processes

An orphan process arises when a process is still running, but its parent has died. They are adopted by init.

Now that we understand the concept of processes and learned a little bit of its jargon, let's see how we can view and control processes with shell commands.

Aching back from coding all day?

Self-Massage Tool

Aching back from coding all day? Try Back Problems

Relieve spasms, tight muscles, trigger points and pressure points with the Body Back Buddy! This trigger point massage is designed to help you self-message any area of your body - especially those that are hard to reach. Keeping your muscles relaxes and out of contraction is importan in helping to reduce pain and prevent muscle injury.

$ Check price
29.9529.95Amazon 4.5 logo(3,443+ reviews)

More Back Problems resources

Take your Linux skills to the next level!

System Admin Handbook

Take your Linux skills to the next level! Try Linux & UNIX

This book approaches system administration in a practical way and is an invaluable reference for both new administrators and experienced professionals. It details best practices for every facet of system administration, including storage management, network design and administration, email, web hosting, scripting, and much more.

$ Check price
74.9974.99Amazon 4.5 logo(142+ reviews)

More Linux & UNIX resources