1/25
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
fork(), exec()
[Process creation and control in Unix]
Uses ____ and ____ system calls
wait()
[Process creation and control in Unix]
A process can wait for a process it has created using ______ system call
fork()
system call that creates a new process
address space, registers, PC
[fork()]
The newly created process has its own private copy of the _______, _______, and _______.
0
What should the value of rc be to be determined as a child (new process)
int rc = fork();
<0
What should the value of rc be to be determined as fork failed
int rc = fork();
>0
What should the value of rc be to be determined as a parent of child
int rc = fork();
0, child PID
fork() returns ______ to the child process and the ______ to the parent process
non-deterministic, scheduler
[fork()]
The order of execution of the parent and child processes is _________, dependent on the _______
wait()
This system call won’t return until the child has run and exited
deterministic
Adding the call to wait() on the code block for the parent process guarantees the ______ order of execution
exec()
Run a program that is different from the calling program
code, static data
[exec()]
The child process will have different ____, _____, address space, registers, PC
essential for building a shell
It allows the shell to alter the environment of the about to be run program by exec(), enabling more features (ex. Pipes and I/O redirection) to be implemented
Why separate fork() and exec()?
an “interface” program that accepts commands from users to access the services of the OS
BASH, ZSH
examples of shells in Linux
Command Prompt, Powershell
examples of shells in Windows
kill()
used to send signals to a process
SIGINT
pressing CTRL+c
SIGSTOP
pressing CTRL+z
SIGCONT
fg command
Signals subsystem
________ enable the delivery of events to processes
signal handlers, signal()
Processes and process groups can have ______ (via ______ system call) to perform a specific action whenever a specific signal is received
users
Processes are associated to ______ in order to provide ownership and control, as well as limited security and protection
getuid()
system call to return the user id of the user of the process calling it
main
top/htop
ps/pstree
kill/killall
fg/jobs
/proc
Useful programs and commands in Linux terminal