OS Flashcards
What is a process?
It is a program/application in execution
What is a thread?
It is the unit of execution within a process. A process has at least one thread.
What is a PCB?
PCB stands for a Process Control Block. It is a block of memory which represents a process/task within OS. Some items in the PCB: - PID - Process state - CPU registers - Program counter - Memory limits - List of opened files - Kernel stack - Trap frame
What is a context switch in terms of OS?
It is a process of saving a state of currently executing process and restoring state of another process which is chosen to be executed on CPU.
What are the some benefits of using threads?
- Increasing responsiveness
- Resource sharing
- No overhead of creating separate processes in memory
- Utilization of a multi-processor architecture
What data an OS kernel keeps for each process in the system?
- Process Control Block of a process
- Kernel stack for the process
- Page tables for the process
What is CPU burst and I/O burst?
CPU burst is the time of execution of the process on CPU.
I/O burst is the time when a process is waiting for I/O for further execution
What is a short-term CPU scheduler?
It is a kernel service which selects a process from the processes in the READY queue and allocates the CPU for that process.
What is a dispatcher in the context of CPU scheduling?
Dispatcher is a module that gives a control over CPU to the process selected by the short-term scheduler.
The time it takes for the dispatcher to stop one process and start another process is known as dispatch latency.
What are criteria of a CPU scheduling algorithm?
- CPU utilization, percentage of time CPU is busy working
- Throughput, number of processes that are completed per unit of time
- Turnaround time, sum of periods spent waiting to get in the memory, waiting in the ready queue, running on the CPU and doing I/O
- Waiting time, sum of periods spent waiting in the ready queue
- Response time, time from the submission of a process until end of the first execution
What are states in a process lifecycle?
- New
- Ready
- Running
- Blocked/Waiting
- Zombie/Terminated
What is an interrupt and what its purpose?
An interrupt is a type of event in a computer system produced by a hardware to notify about change in its state or about an error.
Classify general events in a computer system?
Event types:
- Interrupts (also known as hardware interrupts)
- Traps (software interrupts like printing on the screen)
- Exceptions, faults (recoverable like page fault), aborts (non-recoverable like division by zero)
What happens when there is an interrupt?
- Hardware device emits interrupt
- After each instruction of a process CPU checks whether there is an interrupt occurred
- If CPU detected interrupt then it switches to kernel stack if necessary and switches to privileged mode
- CPU saves some CPU registers in the kernel stack and suspends execution of a current process
- CPU finds and executes Interrupt Handler Routine
- IRH saves rest of the current process states and responds to the interrupt
- CPU restores user’s task
What is a state of CPU?
The state of CPU is a current content of all its registers