Skip to content
AD-506 · Linux Lab/Quick Revision Short Notes

Linux Lab (AD-506) - Unit 4 Short Notes

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.

  1. Process attributes include the PID, the parent PID (PPID), the owner UID, the controlling terminal (TTY), the priority and the current state.
  2. Process states are running, sleeping (waiting for an event), stopped (suspended) and zombie (finished but not yet reaped by its parent).
  3. ps shows the current shell's processes; ps -e lists every process; ps -f gives a full listing with the fields UID, PID, PPID, C (CPU use), STIME (start time), TTY, TIME and CMD; ps -l gives a long listing with state (S), priority (PRI) and nice value (NI).
  4. pgrep name prints the PIDs of processes whose name matches, so pgrep -u root sshd finds the sshd processes of root.
  5. 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.

  1. Scheduling priorities are set by the kernel from the scheduling class and recent CPU use; the at and cron commands schedule a job to start at a later time.
  2. The nice command starts a command with a changed niceness, as in nice -n 10 sort bigfile; a higher nice value means a lower priority, and only root may lower the value below the default.
  3. The renice command changes the priority of a running time-sharing process, for example renice -n 5 -p 1234.
  4. The kill PID command sends the terminate signal (SIGTERM, 15) to a process; kill -9 PID sends SIGKILL, which cannot be caught and forces the process to end; pkill name kills by name.

Last-minute revision

  • A process is a program in execution with a unique PID; its parent is the PPID.
  • ps -ef lists all processes in full; ps -l adds state, PRI and NI.
  • States: running, sleeping, stopped, zombie.
  • pgrep name returns PIDs by name; prstat is 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 cmd starts a job at lower priority; renice -n 5 -p PID changes a running one.
  • kill PID sends SIGTERM (15); kill -9 PID sends 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.
Go to where you left off?

Quick Add to Notes

Save questions, your own notes and screenshots into notes filed by unit. It takes a free account.

Create free account

Have an account? Log in