LU3 Process Management Flashcards
What is a process in the context of operating systems?
An instance of a program running in a computer
What distinguishes a program from a process?
A program is a static sequence of instructions stored on disk, while a process is the running instance of a program using system resources.
What is the ‘init’ process in UNIX systems?
The first visible process in UNIX with process ID 1, serving as the ancestor of all subsequent processes.
How can you view currently running processes in Linux?
Using the ‘ps’ command.
Which command stops a process by its PID in Linux?
The ‘kill {PID}’ command.
What does the ‘killall’ command do in Linux?
It stops processes by their name.
What command is used for real-time updates on running processes?
The ‘top’ command.
Name the six possible states of a process.
Idle, Runnable, Running, Sleeping, Suspended, Zombified.
What is a zombie process?
A process that has terminated but has not returned its exit code to its parent.
How do you create a new process in UNIX?
By duplicating an existing process using the ‘fork()’ system call.
What does the ‘fork()’ system call do?
It duplicates a process, creating a child process that is an almost-exact duplicate of the parent.
What is returned by ‘fork()’ in the parent process?
The process ID of the child process.
What is returned by ‘fork()’ in the child process?
0 on success.
How can a process obtain its own PID?
By using the ‘getpid()’ system call.
What system call retrieves a process’s parent PID?
The ‘getppid()’ system call.
What happens to a child process if its parent dies before it terminates?
It is adopted by the ‘init’ process (PID 1).
What system call allows a parent to wait for a child process to terminate?
The ‘wait()’ system call.
What does the ‘exec()’ family of system calls do?
Replaces the current process’s code, data, and stack with those of another executable.
It replace the current process with another program.
What distinguishes ‘fork()’ from ‘exec()’?
‘fork()’ duplicates a process, while ‘exec()’ replaces a process with a new one.
What is the purpose of the ‘exit()’ system call?
- Terminates a process
- Deallocates its resources
- Sends a SIGCHLD signal to the parent.
What command can be used to change a process’s priority in UNIX?
The ‘nice()’ command.
What is the range of priority values that can be set using ‘nice()’?
Between -20 (highest priority) and +19 (lowest priority).
Which system call sends signals to processes?
The ‘kill()’ system call.
What signal is often used to terminate a process forcefully?
SIGKILL.