How unit 4 is examined
This unit covers viewing processes (ps, pgrep, prstat, CDE Process Manager) and controlling them (scheduling, priority, nice, kill); no question was asked in the supplied papers, so both topics are short.
Viewing a Process, Command to display Process, Process Attributes, Process States, Process Fields, PS Commands options, PGREP, PRSTAT, CDE Process Manager
<span style="display:inline-block;padding:.16em .6em;border:1.5px solid currentColor;border-radius:999px;font-size:.68em;font-weight:700;letter-spacing:.06em;text-transform:uppercase;opacity:.75">Not asked since 2022</span>
Definition. <mark>A process is a program in execution, identified by a unique process ID (PID), and the ps command displays a snapshot of the processes running on the system.</mark>
Key points.
- Process attributes include the PID, the parent PID (PPID), the owner UID, the controlling terminal (TTY), the priority and the current state.
- Process states are running, sleeping (waiting for an event), stopped (suspended) and zombie (finished but not yet reaped by its parent).
psshows the current shell's processes;ps -elists every process;ps -fgives a full listing with the fields UID, PID, PPID, C (CPU use), STIME (start time), TTY, TIME and CMD;ps -lgives a long listing with state (S), priority (PRI) and nice value (NI).pgrep nameprints the PIDs of processes whose name matches, sopgrep -u root sshdfinds the sshd processes of root.prstat(Solaris) shows a continuously refreshed list of active processes ranked by CPU use, with size, RSS and state; the CDE Process Manager is the graphical window that lists processes and lets the user sort, search and kill them.
Scheduling Process, Scheduling Priorities, Changing the Priority of a time-sharing process, Killing Process
<span style="display:inline-block;padding:.16em .6em;border:1.5px solid currentColor;border-radius:999px;font-size:.68em;font-weight:700;letter-spacing:.06em;text-transform:uppercase;opacity:.75">Not asked since 2022</span>
Definition. <mark>Process scheduling is the kernel's choice of which process gets the CPU next, based on priority; in the time-sharing class each process runs for a time slice, and a lower priority number means a higher priority.</mark>
Key points.
- Scheduling priorities are set by the kernel from the scheduling class and recent CPU use; the
atandcroncommands schedule a job to start at a later time. - The
nicecommand starts a command with a changed niceness, as innice -n 10 sort bigfile; a higher nice value means a lower priority, and only root may lower the value below the default. - The
renicecommand changes the priority of a running time-sharing process, for examplerenice -n 5 -p 1234. - The
kill PIDcommand sends the terminate signal (SIGTERM, 15) to a process;kill -9 PIDsends SIGKILL, which cannot be caught and forces the process to end;pkill namekills by name.
Last-minute revision
- A process is a program in execution with a unique PID; its parent is the PPID.
ps -eflists all processes in full;ps -ladds state, PRI and NI.- States: running, sleeping, stopped, zombie.
pgrep namereturns PIDs by name;prstatis the live, CPU-ranked view on Solaris.- CDE Process Manager is the graphical process viewer.
- Lower priority number means higher priority; higher nice value means lower priority.
nice -n 10 cmdstarts a job at lower priority;renice -n 5 -p PIDchanges a running one.kill PIDsends SIGTERM (15);kill -9 PIDsends SIGKILL, which cannot be caught.
Memory hooks
- ps = "process snapshot"; prstat = "process statistics, live".
- Nice means polite: a bigger nice value gives way to others.
- Kill 15 asks politely, kill 9 forces.
Coverage checklist
- Viewing a Process, Command to display Process, Process Attributes, Process States, Process Fields, PS Commands options, PGREP, PRSTAT, CDE Process Manager: no past questions.
- Scheduling Process, Scheduling Priorities, Changing the Priority of a time-sharing process, Killing Process: no past questions.