Terminal Processes Flashcards

1
Q

Foreground

A

Processes executed on terminal run in foreground by default (recieve input from keyboard, send output to screen)

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

Background

A

For processes that don’t require keyboard input, can send to background to run in parallel with & (or ^Z, then bg)

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

&

A

symbol/character represents “execution in the background”

./program &

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

nohup

A

(no hang up): used as a prefix when starting a background process so you can log off and the process keeps executing

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

nice

A

used as a prefix for command to modify niceness(scheduling priority) , -20 (most favorable) and +19 (least favorable)

Gary’s Analogy: you don’t expect nice to be something to be a command, if you’re nice you’ll let other people go ahead of you.

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

SIGCHILD

A

death of a child signal

Parent reaps

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

What is a PPID?

A

Parent Process ID: Every process has a parent that started it, tracked using PPID

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

init or launchd

A

Processes are heirarchial. init or launchd can be thought of as the root of the process tree

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

pstree

A

pstree: this command shows the relationship of all processes in a tree-like structure

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

UID (Process ID)

A

UID: user ID that this process belongs to (the person running it)

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

C (Process ID)

A

CPU utilization of processor

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

TTY

A

Terminal type associated with the process

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

TIME

A

CPU time taken by the process

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

CMD

A

The command that started this process

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

Child Process: fork( )

A

In unix a child process is created when the parent process invoke the fork ( )

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

Piping v. Redirecting

Piping is redirecting ouput from one command to another command
Extracting and analyzing data from large files

Redirecting
Redirecting output of one command to a file
> redirects standard output overwriting over a file.
2> for just stderrr
» appends from stdout
< redirects stand input

A

ex. : $ who | wc -l -> lists users and pipes the word count

17
Q

echo cat v. cat echo

echo cat : will print cat on the screen

cat echo : will look for file named echo, and if it doesn’t find it , it throw error

A

What happens when a file exists/doesn’t exists?

18
Q

Processes : ready, blocked, running

ready :

blocked :

running : running in the background and running in foreground

A

What is a process? A program in execution

How to start a process? execute a utility, program or script

19
Q

Child Process: fork()
fork() in a unix child process created with the parent process invoke the fork() system call.
Child process are initially identical copies of their parent until they execute their command!

A

child process : fork returns 0

parent process : fork returns PID of child

20
Q

Daemon Process: a program run it he background process without being controlled by an active user.

A

Sometimes daemon processes are adopted by init

21
Q

Zombie processes: process that has completed execution, memory and resources are deallocated, but still has an entry in the process table (z)

A

A zombie is not an orphan!

Resource leak: PID is unusable until parent process reads child’s exit status (wait() system call)

22
Q

Foreground: processes executed on terminal run in the foreground by default (recieve input from keyboard, send output to screen )

A

Cannot run another command until previous command finishes