Processes Items Flashcards
What is process?
A process is a program in execution. It comprises the program code, associated data, stack, heap, and a Process Control Block (PCB) that stores its execution context.
What is the difference between process and program?
A program is a passive entity, such as a binary executable file residing on disk, whereas a process is an active entity, an instance of a program in execution, with its own memory space, resources, and execution state.
List five process states (use the naming from our textbook and class please)
New
Ready
Running
Blocked
Terminated
What is ready queue? How many ready queues do you expect in the system?
The ready queue is a queue containing all the processes that are ready to execute but are waiting for the CPU. The number of ready queues in a system typically corresponds to the number of processor cores in a system.
What is I/O queue? How many I/O queues do you expect in the system?
The I/O queue is a queue containing processes that are waiting for I/O operations to complete. The number of I/O queues in a system varies depending on the number and type of I/O devices present in the system.
What happens to a process when it requests I/O operation (like file reading) in the classic “blocking” scenario?
In the classic blocking scenario, when a process requests an I/O operation, it enters the Blocked state, relinquishing the CPU until the I/O operation completes.
Where does the process go once the I/O request is complete?
Once the I/O request is complete, the process transitions back to the Ready state, awaiting its turn to be scheduled for execution on the CPU.
Understand what happens to processes in reality when process states change (don’t be fooled by process “movements” in typical visualizations).
In reality, when process states change, the operating system updates the process control block (PCB) of the process to reflect its new state. The process may be moved between different queues or data structures depending on its state, and the CPU scheduler decides which process to execute next based on its scheduling algorithm.
Process Control Block (PCB). What typical components can you see there?
Typical components of a Process Control Block include Process ID, Program Counter, CPU Registers, CPU Scheduling Information, Memory Management Information, I/O Status Information, and Accounting Information.
Context switch. Why does context switching have a small performance overhead associated with it? How does that performance overhead affect system calls?
Context switching involves saving the state of the current process and loading the state of a new process, which requires switching CPU registers, memory maps, and other resources. This overhead is small but noticeable, as it involves flushing and reloading CPU caches and TLB entries. System calls incur this overhead when transitioning between user mode and kernel mode.
What is POSIX?
POSIX (Portable Operating System Interface) is a set of standards that define the interface between a Unix-like operating system and its applications, ensuring compatibility between different Unix-like operating systems.
fork()
The fork() system call creates a new process (child process) by duplicating the calling process (parent process). After a successful fork(), two processes are executing the same program, but with separate memory spaces.
exec()
The exec() system call is used to replace the current process image with a new one. It loads a new program into the current process space, overwriting the existing program and its data.
exit()
The exit() system call terminates the calling process and releases all its resources, including memory and open file descriptors.
wait()
The wait() system call suspends the execution of the calling process until one of its child processes terminates, allowing the parent process to obtain the exit status of the terminated child process.