launchd
New in Mac OS X 10.4, the launchd process
manages daemons, both for the system as a whole and for individual
users. A daemon is a continuously
running program, which exists for the sole purpose of managing
service requests that the computer system expects to receive. The
daemon forwards the requests to the appropriate processes. launchd
manages daemons, both for the system as a whole and for individual
users.
During startup, launchd scans the LaunchDaemons
and LaunchAgents folders in both /System/Library and /Library for
plist files. Each plist file represents a process that launchd
needs to manage. The contents of the plist file specify the
location of the code that should be run and when the process should
be launched.
Unlike startup items,
which are always launched during in the initial startup sequence,
launchd items are intended to launch only when needed. This reduces
the number of processes running, which, in turn, helps increase
system performance and reduce initial startup time.
Viewing the Process Hierarchy
The launchd process is an essential part of Mac
OS X 10.4, because it is initiated by the kernel task during
startup, and launches a series of background processes. It is
important to understand that there is a hierarchy of tasks in the
core operating system, because it can be important in the event of
a problem to identify parent tasks, such as launchd, that spawn
several child tasks. In this exercise, you will learn how to use
Activity Monitor to gather information about processes.
1.
|
Open Activity Monitor
(/Applications/Utilities).
|
2.
|
Choose "All Processes, Hierarchically" from
the pop-up menu at the top of the window.
|
3.
|
Click once on the Process ID column heading to
sort the processes in ascending order.
|
4.
|
Use the disclosure triangles to reduce the
view to just kernel_task and launchd.
You can see that in the Process ID column,
kernel_task is listed as process 0. It is the first operating
system process that launches after the hardware initialization. You
can also see that launchd is process 1, meaning that it is the
second task that launches. All other processes will be numbered
sequentially above these core tasks. However, to understand the
task hierarchy, you need more information than the task name and
ID.

|
5.
|
Select launchd, and click the Inspect button
in the toolbar (Command-I).
When inspecting a
process, the name of the window will be the name of the process
followed by the process ID in parentheses. The parent process is
shown in this window, which is helpful when you are trying to
evaluate processes during troubleshooting.
Note that you can click the parent process and open an inspector
for that task as well. This is very useful when you are working
with higher- numbered tasks and you are tracing the process
hierarchy backward.
|
6.
|
Close the Inspect window.
|
7.
|
Click the launchd disclosure triangle.
You will see the list of processes and daemons currently running on
your computer.
|
8.
|
Click the WindowServer disclosure
triangle.
You will see the current list of user applications and background
processes.
Check the WindowServer process for unexpected processes that might
affect the user environment. For example, this list contains
applications that were launched as login items for the current
user, but hidden at startup. It also shows a disclosure triangle
for processes that have subprocesses, allowing you to view all
running tasks.
|
9.
|
Quit Activity Monitor (Command-Q).
|
10.
|
Shut down the computer.
|
|