Home > Articles > Operating Systems, Server > Linux/UNIX/Open Source

Presently Running Programs are Processes

📄 Contents

  1. Presently Running Programs are Processes
  2. About this Article
To work with Unix, you must work with processes. Jon Lasser shows you just how to determine which processes are running on your system and how to work with them.
Like this article? We recommend

Like this article? We recommend

On Unix, if you're not working on or with files, you're probably working with processes. A process, simply put, is a program running on the system. More precisely, it's an instance of a running program; that is, each time you or someone else using the system runs that program, another process is created.

In many ways, processes are similar to files: Every process is owned by a user, every process has a name, and every process has a number. Processes are owned by the user who ran the program, although suid programs are owned by the setuid file's owner. The name of a process is always the name of the command that the system is executing. Processes also have a size, although this is space in memory, whereas files occupy space on disk.

The system provides the process number. The first process, which controls the execution of all other processes, is init. The process ID (also known as the PID) for init is always 1.1

Process numbers don't just go up and up forever; they're generally of a fixed length, usually 15 bits. (A 15-bit number is a two-byte number with one of those bits reserved to indicate whether that number is positive or negative.) Some systems have PIDs of 16 bits or more, but there are always a fixed number of possible processes. The reason for this is simply that when a program is written, a fixed amount of space must be allocated for process numbers, and that number must be the same throughout any given system.

Process IDs are doled out sequentially: after process 15321 is created, the next process is always 15322, even if process 15320 is no longer running. After the top process number has been used, the system rolls back to the bottom and then starts handing out process numbers all over again. If a given process is still running, the system skips that one and moves on to the next, not returning again until it has reached the top.

Each process has a parent process, much as each file is within a directory. The consequence of this is that the list of processes on a system can be thought of much like a directory structure. init creates several other processes. Each of these can parent many more processes, each of which can in turn also create any number of processes.

A particular process starts when you log on to a system. This process is the shell, the program that lets you run other programs and that interprets your command line. It's a process like any other, and when your shell dies, you are logged out of the system. There are different shells that operate somewhat differently.

Looking at Processes

So, what processes are running on your system? Let's take a look at my system and see what's running there:

[ jon@frogbog jon ]$ top
  3:04am  up  2:14,  5 users,  load average: 0.11, 0.04, 0.06
68 processes: 66 sleeping, 1 running, 1 zombie, 0 stopped
CPU states:  1.7% user,  2.3% system,  0.0% nice,  95.8% idle
Mem:  191124K av,  86976K used, 104148K free,       0K shrd,   4284K buff
Swap: 204080K av,      0K used, 204080K free                  52648K cached

  530 root      8   0 10844  10M 2068 S        0  1.3  5.6    0:59 X
    2 root     15   0     0    0    0 SW       0  1.1  0.0    1:18 kapmd
 1251 jon      11   0  1176 1176  964 R        0  0.9  0.6    0:00 top
  900 jon       2   0  3640 3640 1500 S        0  0.3  1.9    0:01 xterm
  543 jon       1   0  2472 2472 1644 S        0  0.1  1.2    0:03 wmaker
    1 root      0   0   460  460  388 S        0  0.0  0.2    0:03 init
    3 root      0   0     0    0    0 SW       0  0.0  0.0    0:00 kswapd
    4 root      0   0     0    0    0 SW       0  0.0  0.0    0:00 kflushd
    5 root      0   0     0    0    0 SW       0  0.0  0.0    0:00 kupdate
    6 root      0   0     0    0    0 SW       0  0.0  0.0    0:00 khubd
    7 root      0   0     0    0    0 SW       0  0.0  0.0    0:00 uhci-control
    8 root      0   0     0    0    0 SW       0  0.0  0.0    0:00 acpi
  225 bin       0   0   404  404  316 S        0  0.0  0.2    0:00 portmap
  278 root      0   0   528  528  428 S        0  0.0  0.2    0:00 syslogd
  289 root      0   0   928  928  384 S        0  0.0  0.4    0:00 klogd
  305 daemon    0   0   484  484  404 S        0  0.0  0.2    0:00 atd
  321 root      0   0   600  600  504 S        0  0.0  0.3    0:00 crond
  331 root      0   0   556  556  416 S        0  0.0  0.2    0:00 cardmgr

Note that top is an interactive program: It doesn't simply produce output and exit but instead produces output at regular intervals until quit. To quit top, just type q at any time. top's output might look different by default on your system, but the program is very configurable and you can adjust it to your liking.

Our habit, as good students, should be to dissect the information presented to us so that we can properly interpret it. Let's start at the top:

3:04am  up  2:14,  5 users,  load average: 0.11, 0.04, 0.06

The top line of the screen gives output similar to the uptime command, giving the current time, the amount of time since the computer was started or rebooted, the number of users logged in at the moment, and three load averages.

A load average is a simple measure of how much work the computer is doing. Although we generally think of Unix as a multitasking operating system, in reality a given CPU can do only one thing as a time. (Unix does handle multiple CPUs very well, but most systems tend to be single CPU.) Because each CPU can do only one thing at a time, there's a list of programs waiting for CPU time. The higher the number of such processes over a given period of time, the higher the load average. A load average of one, on most systems, indicates the capacity of one processor. On a four-processor system, a load average of four would indicate capacity. In reality, CPU power isn't the limiting factor for most applications, and a load of two to four times the number of processors is reasonable.

The load averages that uptime and top display are for one, five, and fifteen minutes. From these numbers, it's clear that my system's CPU is almost completely idle. The third line of top's display confirms this:

CPU states:  1.7% user,  2.3% system,  0.0% nice,  95.8% idle

User time is that being used by normal processes on the system. System time is that used to write to disks, time spent managing low-level hardware details, and so on. These numbers, together with the idle time, should add up to 100%. The nice time can actually be subtracted from this total because it indicates processes that have been given a substantially lower priority by either the user or the system administrator. These processes run only in time not used by other programs.

The next two lines give an overview of the memory usage on the system:

Mem:  191124K av,  86976K used, 104148K free,       0K shrd,   4284K buff
Swap: 204080K av,      0K used, 204080K free                  52648K cached

Mem: represents memory installed on the system. The machine has 192MB of RAM, of which just under half is used. Most of that RAM, however, is used for buffers and cache, used to speed apparent disk performance. The system also has 200MB of swap space, disk partitions used by the system as though they were RAM. None of the swap space is currently used, which indicates that a shortage of memory isn't lowering our performance.

Finally, we approach the list of running processes. Generally, dozens, hundreds, or even thousands of processes run simultaneously on a given machine. top displays only those processes using the greatest percentage of the CPU. (We can use the ps command, which I will soon discuss, to see all processes on the system.) With the process listing header, here's the first several lines of top's output:

 530 root       8   0 10844  10M 2068 S        0  1.3  5.6    0:59 X
   2 root      15   0     0    0    0 SW       0  1.1  0.0    1:18 kapmd
1251 jon       11   0  1176 1176  964 R        0  0.9  0.6    0:00 top
 900 jon        2   0  3640 3640 1500 S        0  0.3  1.9    0:01 xterm

The first field is the process ID, the only guarantee that the process you're looking at is the one you think you're looking at. This is followed with the process owner, and then a number representing the priority of the process. A higher number means that more CPU time should be allocated to that process by the scheduler, the portion of the system that controls this. The next value, NI, represents the "niceness" of the process; A negative number means that the process is willing to give up CPU time to more important processes.

The STAT field is one of the most important because it gives us the status of the process: is it actively Running, is it Sleeping as it waits to be run, has it been sTopped by a user, or is it a Zombie?2

What's a zombie? Programmers, like mad scientists, make mistakes.3 Sometimes a process exits ("dies"), but its parent process doesn't clean up afterward. These processes remain in the land between the living and the dead until either such clean-up occurs or the parent itself dies, after which the system cleans up. Zombies are unsightly and take up resources but are rarely actually harmful, though they tend to stink up the room...metaphorically, of course.

On my system, the man page for top says that the LIB field doesn't work. If it did, it would indicate the number of library pages used by the application. If you don't know what this means, you probably don't care, even if LIB works just fine on your system.

You probably do care about the %CPU and %MEM fields: They indicate the percentage of the CPU being used by the process as well as the percentage of physical memory. If you want to know what's slowing you down process-wise, these are good indicators. On a system with acceptable performance, it's all right if a CPU takes up nearly 100% of the time because it might only be taking up time that would otherwise be idle. If, by contrast, performance is lousy, see what's hogging memory and the CPU. If you have a multiprocessor system, these values often add up to some multiple of 100% because many systems handle each CPU separately.

TIME shows the total amount of CPU "time" that the process has taken up over the course of its life. This is a rough measure of how much work the CPU has dedicated to handling that process. Long-lived processes often have large numbers in the TIME field even if they're well behaved, because even small increments add up over days, weeks, or even months.

The last field is simply the name of the command being run. This is useful if you haven't memorized what processes are running at what PID. (Yes, that's a joke. Nobody does that, though most admins know that init is always PID 1.)

So how's my system doing? Well, it's almost totally idle, it's got lots of free memory, and no process is currently hogging the CPU. The worst offenders on my system appear to be the X Window System (the Unix GUI), which is taking up a full 10MB of memory and using something less than 2% of the CPU. Something called kapmd is taking up just over 1% of the CPU. This process is handling power management on my laptop, and it's been running since my machine last booted. If you look closely, you'll note that its PID is 2. kapmd is really part of the Linux kernel, the part of the OS that controls access to all system resources. It starts up something that looks like a process to handle power management. kapmd has taken up a fair amount of CPU time total, but it would be hard to argue that it's affected my performance.

Next comes top, which is taking up almost nothing, as are xterm (a terminal window, to type commands to the system from X) and wmaker, my window manager. Everything else on the system is taking up entirely negligible resources.

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information

To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.


Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.


If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information

Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.


This site is not directed to children under the age of 13.


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information

If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information

Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents

California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure

Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact

Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice

We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020