Understanding Processes
MacOS MacOS X Windows

Before you start working with code that manipulates processes, it is important to know just what is a process, and how can a process be identified.

What is a Process?
Technically speaking, a process is any actively operating chunk of code on your computer. In practicality, however, we are mainly concerned with application processes, that is, processes that are currently running that may or may not provide an interface to the user, but have been designed to accomplish a predefined purpose. Keep in mind the difference between an application and an application process. A copy of SimpleText or Microsoft Word that is sitting on disk but not currently running is an application; start it up, and the code that is running is the application process.

There are other application processes that run on your computer that you don’t see: things like the "Control Strip Extension" (MacOS 9), the "loginwindow" (MacOS X), or "winlogon.exe" (Windows). These are called hidden processes because, well, you can’t see them.

How Do I Identify an Application Process So I Can Work With It? ( MacOS MacOS X )

To see the list of currently running processes, you can open up Apple’s Script Editor, make sure the Result Window is showing, and enter and run this AppleScript:

tell application "Finder"
  get the processes
end tell
This will return a list; something like this (this is an example under OS X):
{application process "loginwindow" of application "Finder", 
application process "Dock" of application "Finder", 
application process "Script Editor" of application "Finder" ... }
Note: In OS 9, the processes are all preceded with the term "process"; in OS X, the processes are all preceded with the term "application process". Just FYI.)

In OS X, processes have a process ID number (or PID) that uniquely identifies one process from another, and through the Terminal (or equivalent) enables you to manipulate those processes. To see a list of running processes, you can use the process status command (ps). Open the Terminal application and type the following at the command prompt:

ps -awx -o command
This will display a list of running applications, including the paths to those applications.

But before you start working with Macintosh application processes, you need to understand the four different kinds of Mac applications:

How Do I Identify an Application Process So I Can Work With It? ( Windows )

To see the list of currently running processes, you can type Control-Shift-Escape; this should bring up the Windows Task Manager, and it should already be displaying the Processes tab, listing all the currently running processes. Application processes that are running usually end in .exe, and correspond to the name of the actual executable file on disk that was launched.

Of course in Windows, the name of the executable file and the name of the application itself are almost always different; Microsoft Word 2000 for example is identified as WINWORD.EXE.

Windows also keeps track of processes by process ID number (PID), so you can manipulate them as well using their unique ID number instead of the name of the application. PIDs are important, especially in Windows which allows you to have multiple instances of the same application running at the same time. These instances will have the same process name, but different PIDs.

This should give you a good understanding about processes in Mac and Windows; please keep the above in mind when working with application processes. Please let me know if I have misstated anything above so I can correct it.

Posted 12/26/2002 by Ken Ray