Introduction

Introduction

A process is a program that is currently running. It consists of the executable instructions for the program, the program data, and stack data. Processes are uniquely identified by their process id number, or PID.

Processes are created by other processes via the fork() system call. For example, when you type ls and hit <enter>, the process that is your shell forks, creating a nearly exact (with everything the same except the pid) duplicate of itself. The copy then immediately cedes control of its system resources to the ls program by running an exec() system call. In this way, all processes are descended from init.

The process created via a fork() is referred to as the child; the process that forked is called the parent. In some process information listings you will see a PPID field; this contains the Process ID of the process' Parent.

Processes may communicate with each other via signals, standardized numeric messages corresponding to a variety of system events. (See /usr/include/linux/signal.h for details.)

Processes have a priority, a numeric value between -19 (highest priority) and 20 (lowest priority) used by the kernel to calculate who gets next crack at the CPU. By default, processes are created with a priority of 0.

Processes may be run in the foreground (visibly executing on your display) or in the background (running, but not in control of your terminal). It is possible to explicitly move running processes between the foreground and background; see the entries for &, ^Z, bg, fg, and jobs.

A zombie process is a process that has been killed and had its system resources freed, but has not yet been removed from the list of running processes.

The following are some of the commands that deal directly with processes:

&

Run the specified process in the background.

^Z

Suspend the current foreground process.

bg

Put the specified process in the background.

fg

Bring a specified process to the foreground.

fuser

Display the pid of any process using a specified file.

jobs

Display a list of background processes.

kill

Stop the execution of a process.

killall

Kill all processes executing a specified command.

nice

Change priority of a process.

nohup

Run a process that will ignore signaling.

pidof

Locate and print the process id of the specified program.

ps

Get process status information.

pstree

Display family tree of running processes.

renice

Change the id of a running process.

top

Display CPU usage information.

 



Linux Desk Reference
Linux Desk Reference (2nd Edition)
ISBN: 0130619892
EAN: 2147483647
Year: 2000
Pages: 174
Authors: Scott Hawkins

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net