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.

Take your Linux skills to the next level!

How Linux Works

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

In this completely revised second edition of the perennial best seller How Linux Works, author Brian Ward makes the concepts behind Linux internals accessible to anyone curious about the inner workings of the operating system. Inside, you'll find the kind of knowledge that normally comes from years of experience doing things the hard way.

$ Check price
39.9539.95Amazon 5 logo(114+ reviews)

More Linux & UNIX resources

Aching back from coding all day?

Prism Glasses

Aching back from coding all day? Try Back Problems

Ever feel achy from sitting crunched up on your computer table? Try lying down with these optical glasses that allow you to work on your laptop while lying flat on your back. This is the perfect solution with those with limited mobility or those who wish to prevent neck cramps and back strains.

$ Check price
4.454.45Amazon 4 logo(128+ reviews)

More Back Problems resources