Week 6: Processes Flashcards
What are the 4 layers of the UNIX OS?
Harware, Kernel, Shell, Programs.
What is the Shell?
A User Interface that exposes the OS for the user to interact with.
What data structure are processes contained in?
A tree.
What is special about the SystemMD process? What is its PID?
It’s the root process.
It’s PID is 1.
When is the SystemMD process started? What is its relation to all other processes?
PID 1 is initiated on machine start up.
It’s the ancestor of all other processes.
What are the 7 common UNIX commands we were taught? Define each…
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.
What are the 3 most important processes in C? Define each…
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.
Why do pipes have a buffer?
To prevent buffer overflow on the reading end of the pipe. Thus no data is spilled.
What functions are used to get the current process ID and the parent process ID?
getpid( )
getppid( )
What process is used to wait for a process? What are the arguments? Which header is it located in?
waitpid( pid_to_wait_for, &status, 0 )
#include <sys/wait.h>
Which header file is fork( ) located in?
include <unistd.h></unistd.h>
When ctr + c is pressed, which signal is sent…
SIGINT -> Interrupts program.
Which signal is sent to request process termination? Which signal is sent to force process termination?
SIGTERM -> Request termination.
SIGKILL -> Force termination.
Which signal is sent when the program has a segmentation fault?
SIGSEGV