Process Management Flashcards

1
Q

What is a process?

A

The active execution of code that would otherwise be a file on a disk.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are the types of processes?

A

User - has a controlling terminal (i.e. chronyc)

Daemon - no controlling terminal (i.e. chronyd)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are the 3 relationships between processes?

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is PID?

A

Process ID

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is PPID?

A

Parent process ID

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is an orphan process?

A

Parent ends (orphans), init/systemd adopts orphan process

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is a zombie process?

A

Process ends, but parent doesn’t update status (false positive)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Where is process information located on a system?

A

/proc

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How are processes managed?

A

Using the kill or killall command with signals (SIGTERM, SIGKILL, SIGHUP, etc.)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How are processes viewed?

A

ps, pstree, top commands

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

How does the process priority scale work?

A

Lowest numerical value = highest priority (-99)

Highest numerical value = lowest priority (99)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

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)?

A

nice

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What command changes the nice value of a running process without restarting it?

A

renice

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

How can a process be moved to the background?

A

Ctrl+z to pause the task, then bg to continue the task in the background

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is the difference between the kill and killall commands?

A

kill - kills process(es) by PID

killall - kills all processes by name (string)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What do pgrep and pkill do?

A

pgrep - verifies process by attributes other than PID

pkill - pgrep + kill, which happens in the background

17
Q

How can a job start in the background?

A

Suffix a command with the ampersand &

18
Q

How can jobs be viewed?

A

jobs

19
Q

How can a job be brought into the foreground?

A

fg

20
Q

What is a job?

A

The passive execution of code that would otherwise be a file on a disk (aka: processes running in the background).

21
Q

For whatever reason (zombies most likely) you’re restricted to a single terminal. How do you multitask?

A

screen

22
Q

Who is your friend in screen? H’why?

A

Ctrl+a - has all the snacks (basic prompt to do sub commands)

23
Q

Who is cron?

A

Daemon that allows jobs to be scheduled

24
Q

What is crontab?

A

File containing a list of jobs and their schedules

25
Q

Break down the crontab entry syntax

A
WHEN:
Minute of hour
Hour of day
Day of month
Month of year
Day of week

WHO:
User to run as

WHAT:
Command / path to script

26
Q

Who is at?

A

Daemon to schedule a “one-off” task

27
Q

With screen, what is one way to create a new window?

A

Type screen while inside screen, i.e. attached screen

28
Q

With screen, what is one way to create a new session?

A

Type screen while outside of screen, i.e. detached screen

29
Q

Break down the “layout” of screen

A

bash > screen > session > window > program

bash > screen > [session1 > [window1 > program1] [window2 > program2]] [session2 > [window1 > program3]]