Chapter 3: Linux Basic Commands
3.8 Processes
Friends, every program running on a server is a process, and each one has a PID. When the website hangs or the CPU hits 100%, ps and top are your eyes.
मित्रांनो, सर्व्हरवर चालणारा प्रत्येक प्रोग्राम एक प्रोसेस आहे, आणि प्रत्येकाला एक PID असतो. जेव्हा वेबसाइट अडकते किंवा CPU 100% होतो, तेव्हा ps आणि top तुमचे डोळे आहेत.
दोस्तों, सर्वर पर चलने वाला हर प्रोग्राम एक प्रोसेस है, और हर एक का एक PID होता है. जब वेबसाइट अटक जाए या CPU 100% हो जाए, तब ps और top आपकी आँखें हैं.
A process is a running program. Each has a PID (process ID).
| Command | Purpose |
|---|---|
ps aux |
All processes with user, CPU, memory |
ps -p PID -o pid,ppid,user,stat,etime,comm |
Inspect a known process ID. Replace PID with the verified number from your own job. |
pgrep -x sleep |
List candidates matching that exact process name. More than one matching process can exist. |
top |
Live view (press q to quit, M sort by memory, P by CPU) |
kill PID |
Politely ask process to stop (SIGTERM, 15) |
kill -9 PID |
Force kill (SIGKILL) — last resort |
wait "$lesson_pid" |
Collect the result of the practice child from the shell that launched it. |
command & |
Run in background |
jobs, fg, bg |
Manage background jobs of the current shell |
nohup command & |
Run with hangup ignored. A session manager or service policy can still end the process. |
uptime |
Load average and how long the system has run |
free -h |
RAM and swap usage |
Ravindra Bagale's Tip
Confirm the exact process and the approved control action before sending a signal. An ordinary TERM request lets a program with a handler do its shutdown work. Check the result. For a managed service, start by looking at its unit state and relevant logs. Follow the service owner’s maintenance procedure if a restart is needed.
Ravindra Bagale's Tip – मराठी
Signal देण्याआधी नेमकी process आणि मंजूर action तपासा. TERM handle करणाऱ्या program ला shutdown चे काम करता येतं. Result तपासा. Managed service असल्यास आधी unit status आणि संबंधित logs बघा. Restart लागला तर service owner ची procedure वापरा.
Ravindra Bagale's Tip – हिंदी
Signal भेजने से पहले सही process और मंज़ूर action की जाँच करो. TERM handle करने वाला program अपना shutdown पूरा कर सकता है. Result देखो. Managed service के लिए पहले unit status और संबंधित logs देखो. Restart की ज़रूरत हो तो service owner की procedure इस्तेमाल करो.
Lab
Chala, start one short sleep in a fresh Bash shell and save its PID immediately. Compare the live process listing and the shell’s job listing.
sleep 10 &
lesson_pid=$!
ps -p "$lesson_pid" -o pid,ppid,user,stat,etime,comm
jobs -l
wait "$lesson_pid"
printf 'Child status: %s\n' "$?"
A normal completion produces status zero. If it finishes before your process observation, start a fresh practice job. Use the longer exercise below to compare its normal exit with a controlled TERM request to the current practice job.
Find the work that is actually running
Every morning Mauli Dairy generates a dispatch report from the previous day's entries. Today the report link loads slowly. Asha remembers that the report utility exists and sees its file in the deployment directory. That tells her which program was deployed. It leaves two important questions open. Is an instance of the utility running now, and what is it doing? The same file can be started twice by accident. There could also be a web worker waiting for output that was never produced. Before changing anything, Asha needs a view of the live work.
A program is code that can be run. A process is a running instance with its own identity and state. When you launch a command from a shell, a system can start a separate process for it. Some shell commands are built directly into the shell and can run without launching another program. When two users start the same external program, there can be two processes with different IDs, working directories, credentials and open files. A running program can also start child processes to share or divide its work. Seeing a program's file on disk does not identify any of those running instances.
Our goal is to answer four practical questions. Which instance of the program is this? Who started it and how long has it been active? Is it using the CPU, waiting for something or already finished? If an action is needed, which command belongs to the owner of that work? We will observe one harmless sleep command started from our terminal. It gives us a process with a predictable lifetime and almost no CPU activity. You can see how a PID, job, parent and exit status fit together before looking at a busy machine with valuable work in progress.
Use an ordinary Bash session on your assigned learning machine. The basic experiments work with standard commands and do not require a second user or administrative privileges. The observations about top and some process state details use the Linux procps tools. Some labels and keyboard controls vary on macOS or other operating systems. Use the examples to interpret those displays if your environment is different. Keep any later manual control action attached to the process your own training shell started.
Follow the parent, PID and elapsed time together
A PID, or process ID, is a number used to identify a running process within the relevant system context. Output from a virtual machine or container can show IDs from its own process namespace. Record which host or environment you are observing before comparing IDs. A process usually also has a PPID, or parent process ID. If your shell starts the sleep command, the shell is the parent and the sleep command has its own ID. When a parent exits, its children can be reparented under the operating system's rules. A parent-child check explains the current relationship rather than the complete history of the machine.
The number is assigned while a process lives and can be reused after it is gone. A PID written in yesterday's report may correspond to unrelated work today. Even a recent observation can become stale during a restart. When investigating a process, record its command name, user, start or elapsed time and parent where available. A short check just before a control operation is stronger evidence than copying a number from a message. An administrator following a service workflow can also use the service identity instead of relying on an old process number.
printf 'Shell PID %s\n' "$$"
sleep 120 &
lesson_pid=$!
printf 'Practice child PID %s\n' "$lesson_pid"
ps -p "$lesson_pid" -o pid,ppid,user,stat,etime,comm
jobs -l
Shell PID 8502
Practice child PID 8537
PID PPID USER STAT ELAPSED COMMAND
8537 8502 asha S 00:00 sleep
Start the block in a fresh interactive Bash session. The actual numbers, status letters and headers can differ. The $$ expansion shows the shell's process ID here. The trailing ampersand asks the shell to start the sleep asynchronously. The shell can accept further commands while the child waits. Immediately after starting it, $! records the process ID of that most recent asynchronous job in this simple example. Saving it before opening another background job keeps the number associated with the right launch. The program ends on its own after two minutes. If you reach the next step after it ends, read the already finished path of the exercise or start a new practice job.
The options to ps in this example ask for one specific PID and named output fields. The first two columns should show the practice PID and its parent. The user should match the account running the lesson. The last field identifies the command and may vary in format. Elapsed time is the time since the process started, including time spent waiting. The state shows a momentary observation. The job list adds shell context. These two views let you connect a process visible to the system with a job your current shell tracks.
Read a process snapshot without jumping to a conclusion
A ps listing is a snapshot. It can tell you what was selected when the tool inspected processes. It cannot guarantee the process remains afterward. The short form ps commonly selects processes associated with your terminal and user. On Linux with procps, ps aux gives a broader overview, including user and resource columns. If a colleague asks about one named job, prefer a specific selection and choose the fields you need. Process arguments can contain sensitive values. The short command name column in our example keeps unnecessary arguments out of the evidence. Avoid copying full command lines to a support message unless their contents are appropriate to share.
A tool such as pgrep can help discover process IDs by name. A name search can return several legitimate matches, including a separate worker started by another person. For an observation on Linux, a command such as pgrep -x sleep uses an exact process-name match. The result is still a list of candidates. A broad text search through command arguments can match helper commands or another service with similar arguments. In the practice lab, the captured child ID from your own shell gives much better evidence than searching every process by name. Use search results to ask more precise questions about each candidate.
A Linux process status field can contain a main letter and additional modifiers. A process marked R is running or ready for a turn on a CPU. A process marked S is in interruptible sleep while waiting. This is expected for our sleep command and for many healthy servers waiting for requests. A process marked D is in an uninterruptible sleep, often associated with an operation waiting on I/O. T often indicates a stopped process. Z describes a zombie, an exited child whose parent has yet to collect its termination status. You may see other states depending on the instrument and system version.
Consider the report worker in state S with a slowly increasing elapsed time. It could be waiting for a timer, a file or a response from somewhere else. Changing its priority or sending a signal cannot identify the dependency. Check later samples, the worker's recent logs and the timing of its expected work. If the scheduler's PID is always present and child jobs appear and disappear as expected, that is a different picture from a long-running worker stuck on one report. A status code gets its meaning from the process's job and from repeated observations.
When an exited child is shown as a zombie, the process has already stopped executing. Its parent needs to collect the exit status, or the system needs to handle the parent relationship. Repeatedly signalling the exited child does not make it perform another graceful shutdown. For an isolated training child, the shell's wait command collects the status. For an application showing many persistent zombies, identify the parent program and bring evidence to its maintainer. The parent's child management is the possible issue, and preserving the relationship will help them diagnose it.
Watch how CPU and memory readings change over time
top refreshes a view of running tasks. On Linux with procps, start it on a learning system and watch at least two refreshes. Press P to sort by CPU, M for memory and q to exit. Uppercase keys matter in that implementation. Read the column header rather than assuming a view is still sorted the way it was last time. Other versions can have different commands. While learning, observe and exit. You do not need top's process control commands to read its output.
CPU is the resource that executes the instructions a program needs. A CPU percentage describes a share of execution time or capacity under the tool's definition. On some multi-core Linux displays a multithreaded process can exceed 100 percent because each whole CPU can contribute up to 100 percent. Other views normalize across all processors. A virtual CPU is the execution capacity the guest system is configured to see. A task close to 100 percent of one CPU does not automatically consume every virtual CPU of a larger machine. Check what the displayed percentage is measuring before you compare it with a different graph.
A ps CPU percentage in procps usually relates CPU time used to the process's elapsed lifetime. The value you see in a recurring top view can describe usage over a recent interval. Consider a program that did useful processing for a few seconds and then waited. Its lifetime CPU ratio can remain nonzero after the recent reading drops. That is ordinary behavior. For a live performance report, include the observation window and some repeated evidence. For a slow page at 08:00, an instance metric averaged over several minutes may not show a short burst on one worker the way a terminal sample does.
Memory has separate views. Virtual memory describes addresses and mappings available to the process. Resident memory estimates which parts are present in physical memory. Some memory is shared, so summing resident sizes from many processes can double count shared pages. On Linux, free -h summarizes physical memory and swap, using human-readable units. The available column estimates memory that can be made available for new work without swapping. Some memory used for caches may be reclaimable. A small number in the free column alone does not explain a slow report. Compare available memory and any evidence of pressure over time.
Start with a hypothesis from the work. A large report can briefly use CPU while it sorts or compresses entries. A network wait can leave the user waiting while CPU stays low. A process can also be consuming memory normally because of the data it needs. Repeat the observation and compare it with the known workload, timestamps and errors. A control action belongs after you understand who owns the process and what will happen to data that is still being processed.
Measure one wait from start to finish
Suppose a student says the report spent ten seconds on the CPU because the request took ten seconds to finish. Compare that claim with a controlled experiment where we already know the work mostly waits. Bash has a timing keyword that can observe how much wall clock time passes and how much CPU time a command uses. Run the example in the practice shell. The parentheses put this timing display setting in a temporary subshell. The old setting will still apply in the surrounding shell afterwards.
(
TIMEFORMAT='Elapsed %R s, user CPU %U s, system CPU %S s'
time sleep 2
)
Elapsed 2.004 s, user CPU 0.001 s, system CPU 0.002 s
On a lightly loaded machine the reported elapsed time will normally be about two seconds. It can be longer because the process needs a turn to start and resume. The user CPU time measures time spent executing user-space instructions. System CPU time reports time spent executing kernel work on behalf of the command or its measured scope. Both are small in this example. While the sleeper is simply waiting for its timer, the CPU can serve other work. The exact printed numbers are an observation on your host and can differ from this example.
Use the same distinction to reason about a report that takes eight seconds while using about one second of CPU. The remaining time may include waiting for a database, filesystem, network or scheduled work. A wall clock delay is real to the user even when the host is mostly idle. A high CPU ratio can support a computing bottleneck hypothesis, and a low ratio can direct you toward waiting, but neither measures the cause without another observation. Compare the program's own timing information and its work stages around the delay. Separate the symptom, “the browser waited,” from the resource diagnosis.
If your earlier practice job is still running and you have the Linux procps version of top, ask for two bounded samples of that specific PID. The following command is an observation only. Run it while you still have a matching practice child. If the process has exited, its row may be absent and the snapshots can still describe the machine. The option for batch output lets the display complete itself instead of waiting for a key.
top -b -d 1 -n 2 -p "$lesson_pid"
Read the header and see how the process row is identified. After roughly one update interval, elapsed time advances even though the CPU reading remains close to zero. The display can show the task as waiting. The machine-wide CPU, task and memory summaries above it can still include other activity. This point is worth verifying directly. Selecting one task list row does not make the system summary describe only that task. Use one line for the practice process's usage and another line for a host measurement in your notes.
Imagine two colleagues collect observations in different windows. The first sees the report generator busy and consuming CPU during compression. The second opens the dashboard just after the worker starts waiting for the output storage to acknowledge a write. Both readings can be accurate. Add timestamps and the relevant request or job identifier to compare stages. When you share “CPU was high” in a discussion, explain whether that means a current process interval, a lifetime process ratio or a system percentage during a monitoring window. Another person can then find comparable evidence.
The measurement also gives you a controlled alternative to creating load during a beginner exercise. You have already demonstrated the difference between wall time and CPU time without saturating a machine. When investigating production, rely on approved observations of the real workload. A harmless wait in your own practice shell proves the mechanism and has a clear end. For real jobs distinguish repeating a check from rerunning the work itself. Restarting an expensive or state-changing job can duplicate output or conceal the first failure. A read-only second sample can answer the timing question with fewer assumptions.
Compare load average, CPU activity and the user's request
On Linux the numbers often shown by uptime summarize system load over roughly one, five and fifteen minutes. The load metric reflects work runnable on CPUs and work in certain uninterruptible waits. It is usually shown as a number such as 2.40, rather than a percentage. A value of 2.40 on a machine with one available CPU needs different interpretation from the same value on a machine with eight. Waiting work can contribute, so high load with significant idle CPU can point to something other than ordinary CPU saturation. Include the observation interval and host context before deciding.
uptime
getconf _NPROCESSORS_ONLN
These read-only commands provide two useful starting observations on a compatible system. The second asks for the number of processors the platform reports as online. Resource restrictions, processor affinity and container quotas can make a particular process's available capacity smaller than that number. The load averages are about the visible operating system context. They do not measure the duration of one report request. Use them alongside the process-specific and application-specific evidence.
Work through a sample. On a learning host with two CPUs, a normally quiet report worker shows brief CPU activity every morning at 08:00. Today the one-minute load is 3.6 and the fifteen-minute load is 0.8. A snapshot of the report worker shows it waiting. This may mean a recent spike in runnable work or in uninterruptible waiting. Get a second view. If there are several runnable report children and both CPUs stay busy when the requests arrive, the timing supports a CPU backlog hypothesis. If there are repeated D states and plenty of idle CPU, investigate the storage or other kernel operation involved under the team's approved procedure.
The most useful evidence has a time and a target. Collect the process identity, state, CPU sample and the reporting window. Link those to the incident symptom, such as two slow report requests started at the same time. On EC2, CloudWatch instance-level CPU measurements offer another time series. They represent an instance metric over its monitoring period. Use guest process observations or the application's own measurements to determine which work occupied the relevant time. The instance graph and process list answer related but different questions.
Manage one shell job and collect its result
The term job here means work tracked by one shell's job control. A job can contain a single process, such as our sleep, or several processes from a pipeline. A shell can assign a short job number. That number is local to this shell. It may be shown with a percent sign when you pass it back to a job control command. A PID identifies a process in the system view. You cannot pass a job number from another terminal and expect it to select the same work. Printing both views makes it easier to see which identifier is appropriate.
A job started in the foreground normally belongs to the terminal's active group. For example, pressing Ctrl+C generally sends an interrupt to the foreground group in a terminal with normal settings. Ctrl+Z can stop it temporarily. Bash's fg can bring a selected job into the foreground. bg can resume a stopped job in the background when the shell supports job control. An ampersand starts work asynchronously. It does not by itself establish that the job has finished, survived logout or kept its output separate from the prompt. Decide where to write output for any real background task, and check that the route used to control it matches the environment.
Finish the sleep exercise from the earlier section in the same fresh Bash session. The shell notation %+ selects its current job. The conditional below compares the current running job's process group leader, as reported by Bash's job listing, with the captured ID of our single-process sleep. If you started any other jobs, or if the sleep finished, skip sending a signal. Generic termination examples in a guide can be dangerous when the target has already changed. Here the shell tracks the process you launched.
if [ -n "$lesson_pid" ] && [ "$(jobs -pr %+)" = "$lesson_pid" ]; then
if kill -TERM %+; then
if wait "$lesson_pid"; then
lesson_status=0
else
lesson_status=$?
fi
printf 'Child exit status: %s\n' "$lesson_status"
fi
else
printf '%s\n' 'The practice sleep is no longer the current running job.'
fi
jobs -l
A signal is a notification to a process or job. The ordinary termination signal, SIGTERM, requests termination and can be handled, ignored or acted on according to the program's behavior. A process with a handler may use it to close files or finish a small part of its work. The normal sleep command usually exits on this signal without extra work. On Bash under conventional numbering the reported status should be 143, the shell convention of 128 plus signal number 15. The call to send the signal and the eventual termination status are two separate observations. wait produces the latter for your own child.
If the conditional prints that the job is no longer current, inspect the job listing. When you know the captured ID belongs to your child, you can query its exit result with wait "$lesson_pid". A normally completed sleep usually exits with status zero. If the shell cannot identify that child, wait may report a different status, so also read the accompanying diagnostic. The exercise requires no persistent changes. If it is still a valid practice sleep and you choose to let it finish on its own, wait for it in the same shell before closing the window. Unset the practice variables after you have captured the result.
Ask for an orderly stop and verify what happened
We sent TERM to a deliberately started training job. To understand the control action, imagine a report generator with an output file still open. A termination handler could stop accepting new work, finish or close the partial output and write a clear exit message, depending on that program's design. A successful send tells you the system accepted the signal operation for the target. It does not tell you that the report was complete or that the process has already stopped. Inspect completion or the application's status and read the relevant messages. That distinction is why the practice block has both a send and a wait.
SIGKILL is a forceful signal that cannot be caught, blocked or ignored by the target process. The program cannot act on it by handling the signal to wrap up its data. A process waiting in a kernel operation can still need that operation to progress before an exit is observed. Preserve the evidence and follow the approved escalation for a real service. In particular, if you see a process in persistent D state, understanding the operation it is blocked on is more useful than repeating a forceful request. If it has Z state it is already an exited child and requires parent-side handling.
The name of the action matters. A program called kill can send several different signals. The default is usually TERM. Supplying a broad pattern to a command such as pkill can select several processes. Review any matching set before considering an action, and prefer an exact authorized target in a controlled workflow. A number of zero or a negative argument can address a process group under particular forms of the system interface. The lab uses a known, tracked single-process job. Avoid copying a stale PID or a generic pattern into a live command. An application owner benefits from seeing which unit, worker or request is affected before its state changes.
Some scripts use nohup to run a command with hangup ignored. That can help it survive a session hangup in particular situations. Session managers, containers and service lifecycles can still stop the process, and it gets no automatic restart or health checks from this tool. Backgrounding an important service with an ampersand and closing the terminal leaves many lifecycle questions unanswered. A supervised service manager or a managed job system can describe its identity, restart policy, dependencies and logs. Learn that workflow for anything expected to remain available to visitors.
Inspect a service before choosing an operation
The report service at Mauli Dairy has a manager that can start a scheduled worker. The shell job from our practice disappears when it completes and the shell records its status. A managed service can start a new worker after a restart or after a scheduled time. Looking for one remembered ID can miss a replacement. On a system with systemd, the systemctl status command can report a known unit's state and, for a running service, information such as its main PID. Use a unit name confirmed by the service owner. On another process manager, use the corresponding documented read-only inspection.
A process being present establishes it exists in the snapshot. A service active status establishes what the service manager knows about that unit. Neither by itself confirms the user can retrieve the report. Include an authorized application check in the diagnosis. For example, a training operator might request the approved health endpoint and compare its response with what the last deployment documented. The simple presence of a server worker can coexist with configuration errors, unavailable data or a full filesystem. The most useful next observation depends on what the user actually reported.
If you have read access, inspect a bounded set of the service's recent application messages at the time of the symptom. The report might have failed before any worker started, or it may have begun and found a dependency unavailable. Compare the time window with your process samples. If an approved restart is the appropriate operation, follow the service manager's maintenance procedure under the owner of the system. Its restart can clear valuable transient evidence or disrupt other work. Record the observations first if they matter to the incident. Then verify the expected new state and retry the actual report path.
Try writing the diagnosis from this imaginary data. “The web worker and report scheduler are active. The scheduled child has a different PID from yesterday's child. The current child has spent most recent samples waiting and the log says the report input is missing at the expected path. The scheduler did start it.” The next check is the input path and how it was produced. A diagnosis that says only “PID changed” would miss the useful work the process view already told you. Another investigation could find that all slow requests happened while two unexpected report children were busy. In that case, compare their parents and start times to find who launched each copy.
Practise reading the same evidence from two views
Start a new training sleep as in the lab. Write its PID, its parent's PID, the user and one observed state. Record the line showing your shell's job number. Describe which pieces came from the OS process view and which came from Bash.
Wait several seconds and repeat the targeted process listing. Compare the elapsed time and state. Explain why a sleeper can have increasing elapsed time without needing much CPU. If the process has already finished, record the transition and collect its exit status in the originating shell.
Compare a normal completion with the approved early termination in this lab. Use only the job started by your fresh shell. In the first run, give the child a shorter sleep duration and wait for it. In the second run, follow the targeted termination exercise. One result should be zero and the other will usually indicate a signal. Describe the observed result in words rather than saying “the command worked.”
Read the load exercises and construct a one-minute observation note. Include the host, current time, a process identity and a detail about the source of its reported CPU value. Add an application symptom and say which piece of evidence you would collect next. Keep the note focused on your learning environment.
You have enough evidence when you can explain the chain from launch to completion. The process was created by your shell, assigned a PID and tracked locally as a job. One or more observations described its state while it was alive. The later wait reported what happened to the child after it finished. In a long-running service, replace the shell's local job record with the service manager's record and its associated application check. That lets you use the same habit even when the control tools change.
Interview questions with worked answers
What is the difference between a program, a process and a shell job?
A program can be started to create a running instance. The process has an identifier, credentials and state. The shell tracks jobs for work launched from that shell, and a job can include several processes. In the sleep lab a single command created one child tracked as one job. The PID identifies the child in the process listing. The job number is useful within the shell that started it.
Why should you check more than a saved PID when investigating a service?
The process can finish and its PID can later be reused. A service might also be recreated in another process with a new ID. Compare current command name, user, parent and start time or other appropriate live evidence. I would use the service manager's unit information for managed work and check the actual application result after any approved action.
Can a process display S and still be healthy?
Yes. It is an interruptible sleep state on Linux and may be waiting for useful work, as the lab's sleep does. I would look at what work is expected and compare several observations. A report worker waiting for promised input while users report failures is a different situation from an idle worker with no queued requests.
What does sending TERM tell you, and what does waiting tell you?
A successful send confirms the signal request was accepted for its target. The program may act on it according to its signal behavior. Waiting for a child can collect the result after it ends. In Bash our stopped practice sleep usually gave 143, indicating termination by signal 15 under that shell convention. For a service, use its manager and application results for further verification.
How can load be high while visible CPU utilization is modest?
Linux load includes runnable work and certain uninterruptible waiting work. A period with many tasks waiting on an I/O operation can increase load without each waiting task using CPU. I would check repeated state readings, the number of available CPUs, the time scale of the measurements and the actual website symptom. That leaves a testable next step instead of a conclusion from one metric.
Check your understanding
1. You started one sleep in Bash. Which value identifies that specific launch immediately after the ampersand?
A. The parent's numeric ID in a log from yesterday
B. The value of $! immediately after the asynchronous launch
C. The count of all running processes named sleep
Answer and reasoning
B. In the single-command example the shell exposes the latest asynchronous launch through that expansion. Save it immediately in your shell and verify the relationship in the job and process listings.
2. What makes one long snapshot less informative than repeated samples?
A. It can show a temporary state that changes between observations.
B. It updates the package database as it runs.
C. It can only observe programs that have already exited.
Answer and reasoning
A. A process may be active, waiting or gone shortly after the snapshot. Repeated evidence connects what is happening to the time and workload.
3. A process is in state Z for several minutes. Which relationship deserves attention?
A. The file's numeric permissions alone
B. The configured AWS Region of an unrelated instance
C. The exited child's parent, which may need to collect the exit status
Answer and reasoning
C. A zombie has already exited. The record remains so its parent can collect information about the termination.
4. Why does an approved TERM request often come before a forceful kill?
A. It can give the program a chance to run its defined termination handling.
B. It guarantees every pending file is already written.
C. It starts the process in a different user's session.
Answer and reasoning
A. A handler can choose how to respond. Verify the result after the request. SIGKILL cannot give the target a signal handler in which to finish work.
5. A service status shows active while the report route returns an error. What does this prove?
A. Every report is healthy.
B. The service manager sees the unit as active. Investigate the specific failed request.
C. The client always made a typo.
Answer and reasoning
B. The manager's state and a working application request are separate observations. Use the request and its relevant messages to identify the next check.
Revision cards
Identify the actual instance
Compare PID, parent, user, command and elapsed or start time. A saved PID can be reused. Choose the real system and process context before acting.
Job view and process view
A shell job can include multiple processes and is local to that shell. A process listing describes current operating system state. Capture the ID of your own demonstration job immediately.
State needs context
A waiting process may be healthy. An exited zombie needs parent-side handling. Check timestamps, the intended work and repeated observations.
Different measures of load
CPU readings depend on their interval and normalization. Linux load includes certain waiting work. Memory available can differ from the immediately free count.
Send, observe, collect
TERM can allow a defined shutdown response. A signal request is one observation. For your own child, use its final status to see the outcome.
Service health includes the result
A configured manager can maintain the service's lifecycle. Check the active unit and relevant logs, and verify the approved application operation that the visitor needs.
Official references
- Linux procps process snapshots and state fields
- Linux procps top display and interactive keys
- Linux procps pgrep selection options
- Linux load average values
- Linux memory and swap reporting
- Linux signal behavior
- Linux signal targeting and access rules
- Bash job control and wait reference
- GNU nohup and its hangup behavior
- Systemd service unit inspection
- Amazon EC2 metrics and monitoring periods