Operating Systems test 1 Flashcards
What comprises a process?
Memory (address space): Instructions, Data section
Registers: Program counter, Stack pointer
I/O information: List of currently open files
What happens upon process creation?
A new process is created with a unique process ID.
The process gets allocated memory and system resources.
Initial values are set in the memory, registers, and I/O info.
What are the process states and their corresponding data structures?
Running: The process is currently executing.
Ready: The process is ready to execute but waiting for CPU time.
Blocked: The process is waiting for some event or resource.
PCB (Process Control Block): A data structure that stores process state information, memory allocation, and more.
What system calls are involved in process creation?
fork(): Creates a new process by duplicating the parent process.
exec(): Replaces the current process’s memory with a new program.
wait(): Makes the parent process wait for the child process to finish.
How is a child process created? What does it get from the parent process?
A child process duplicates the parent process (memory, registers, etc.) using fork().
The child gets the same address space, but it has a different process ID.
What is I/O redirection and pipe?
I/O Redirection: Redirects input/output streams from the default (keyboard, screen) to files or other processes.
Pipe: Allows the output of one process to be used as the input for another process
What is CPU virtualization and limited direct execution?
CPU virtualization involves providing an abstract view of the CPU to processes.
Limited direct execution allows processes to execute directly on the CPU but with certain restrictions to ensure security and fairness
What is the difference between user mode and kernel mode?
User mode is for executing user applications with limited privileges.
Kernel mode is for executing privileged system operations with full access to hardware.
What is a system call and trap instruction?
System call is a request from user space for services provided by the kernel.
Trap instruction is a mechanism to transition from user mode to kernel mode when invoking system calls.
What is the trap table (interrupt vector)?
The trap table is a lookup table for handling system calls or interrupts.
The interrupt vector is the specific memory address for each trap.
What is a context switch?
A context switch is the process of saving the state of a running process and loading the state of the next process to be executed.
What are the metrics used for scheduling? (turnaround time, response time)
Turnaround time is the total time from the submission of a process to its completion.
Response time is the time from submitting a request until the first response is produced.
What are the scheduling algorithms? (FIFO, SJF, STCF, RR)
FIFO (First In, First Out): Processes are scheduled in the order they arrive.
SJF (Shortest Job First): The process with the shortest execution time is scheduled first.
STCF (Shortest Time to Completion First): A preemptive version of SJF.
RR (Round Robin): Each process gets a fixed time slice, then the CPU moves to the next process.
What is MLFQ and its drawbacks?
MLFQ (Multi-Level Feedback Queue): A scheduling algorithm that adjusts the priority of a process based on its behavior.
Drawbacks: It can lead to starvation and excessive context switching if not properly tuned.
What is a proportional share scheduler?
A proportional share scheduler allocates resources to processes based on their assigned share of CPU time.