Process Management Flashcards
What is a process?
The active execution of code that would otherwise be a file on a disk.
What are the types of processes?
User - has a controlling terminal (i.e. chronyc)
Daemon - no controlling terminal (i.e. chronyd)
What are the 3 relationships between processes?
1- All processes descend from PID 1 (init or systemd)
2- All others have a PID and a PPID
3- Parent processes spawn and manage children
What is PID?
Process ID
What is PPID?
Parent process ID
What is an orphan process?
Parent ends (orphans), init/systemd adopts orphan process
What is a zombie process?
Process ends, but parent doesn’t update status (false positive)
Where is process information located on a system?
/proc
How are processes managed?
Using the kill or killall command with signals (SIGTERM, SIGKILL, SIGHUP, etc.)
How are processes viewed?
ps, pstree, top commands
How does the process priority scale work?
Lowest numerical value = highest priority (-99)
Highest numerical value = lowest priority (99)
What command runs a program and assigns a process a specific nice value that affects the calculation of the process priority (which can be either increased or decreased)?
nice
What command changes the nice value of a running process without restarting it?
renice
How can a process be moved to the background?
Ctrl+z to pause the task, then bg to continue the task in the background
What is the difference between the kill and killall commands?
kill - kills process(es) by PID
killall - kills all processes by name (string)
What do pgrep and pkill do?
pgrep - verifies process by attributes other than PID
pkill - pgrep + kill, which happens in the background
How can a job start in the background?
Suffix a command with the ampersand &
How can jobs be viewed?
jobs
How can a job be brought into the foreground?
fg
What is a job?
The passive execution of code that would otherwise be a file on a disk (aka: processes running in the background).
For whatever reason (zombies most likely) you’re restricted to a single terminal. How do you multitask?
screen
Who is your friend in screen? H’why?
Ctrl+a - has all the snacks (basic prompt to do sub commands)
Who is cron?
Daemon that allows jobs to be scheduled
What is crontab?
File containing a list of jobs and their schedules