O'Reilly logo

Beginning Unix by Paul Weinstein, Jeremy C. Reed, Craig Zimmerman, Joe Merlino, Paul Love

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

10

Job Control and Process Management

This chapter covers starting and stopping processes, sending signals to running programs, viewing information on running processes, shell job control, and more. These essential functions enable the Unix user to manage multiple processes from the command prompt, as well as to understand the ongoing functions of a multiuser operating system. You'll learn how to identify and control system and user processes with basic Unix tools.

What Is a Process?

A process, in simple terms, is an instance of a running program.

As covered in Chapter 2, the parent of all processes, init, is started when the operating system boots. Historically, it is process ID number 1. As other programs are started, each is assigned a unique process identifier, known as a PID.

Behind the scenes, a fork library call or an execve system call is used to start the new program. A fork is produced when the current running program is copied to make a child, an exact copy of the running program. The forked program has a new PID and a different parent process ID (of course), and the child's resource utilizations are all reset. For example, by default, the forked child and its parent share file descriptors and can share open files.

In contrast to forking a process, you can replace the current running process with a new process. The Unix shell includes a built-in command called exec that replaces the running shell with a new program. (Behind the scenes, this uses the execve system call.) ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required