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?

Inversion Therapy Table

Aching back from coding all day? Try Back Problems

Stretch out your back and relieve your back muscles with inversion therapy. This device counteracts the forces of gravity on the body by decompressing and elongating the spine. By using this product just ten minutes a day, you can be well on your way to improved circulation and posture while relieving muscle aches, back pain and stress.

$$ Check price
119.98119.98Amazon 4.5 logo(1,700+ reviews)

More Back Problems resources

Take your Linux skills to the next level!

The Linux Command Line

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

The Linux Command Line takes you from your very first terminal keystrokes to writing full programs in Bash, the most popular Linux shell. Along the way you'll learn the timeless skills handed down by generations of gray-bearded, mouse-shunning gurus: file navigation, environment configuration, command chaining, pattern matching with regular expressions, and more.

$ Check price
39.9539.95Amazon 4.5 logo(274+ reviews)

More Linux & UNIX resources