Week 6: Processes Flashcards

1
Q

What are the 4 layers of the UNIX OS?

A

Harware, Kernel, Shell, Programs.

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

What is the Shell?

A

A User Interface that exposes the OS for the user to interact with.

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

What data structure are processes contained in?

A

A tree.

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

What is special about the SystemMD process? What is its PID?

A

It’s the root process.
It’s PID is 1.

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

When is the SystemMD process started? What is its relation to all other processes?

A

PID 1 is initiated on machine start up.
It’s the ancestor of all other processes.

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

What are the 7 common UNIX commands we were taught? Define each…

A

ps -> Snapshot of all current processes running.
& -> Run the process in the background.
grep -> Searches for a regular expression.
kill -> Requests to kill a process (not immediately).
nice / renice -> Modify the priority of a process. Always run background processes with lower priority.
nohup -> Keep process running after logging out.

-> Pipe two processes.

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

What are the 3 most important processes in C? Define each…

A

Fork -> Creates a child copy of the current process. Assigns the child a PID of 0 for distinguishing.
Kill -> Sends signals to the Kernel, which used the Signal Handler to enforce the signal operation on the process.
Pipe -> Creates a pipe in each process, one for writing and one for reading. Pipe must be initiated after Fork to ensure both processes have the pipe.

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

Why do pipes have a buffer?

A

To prevent buffer overflow on the reading end of the pipe. Thus no data is spilled.

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

What functions are used to get the current process ID and the parent process ID?

A

getpid( )
getppid( )

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

What process is used to wait for a process? What are the arguments? Which header is it located in?

A

waitpid( pid_to_wait_for, &status, 0 )
#include <sys/wait.h>

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

Which header file is fork( ) located in?

A

include <unistd.h></unistd.h>

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

When ctr + c is pressed, which signal is sent…

A

SIGINT -> Interrupts program.

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

Which signal is sent to request process termination? Which signal is sent to force process termination?

A

SIGTERM -> Request termination.
SIGKILL -> Force termination.

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

Which signal is sent when the program has a segmentation fault?

A

SIGSEGV

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