Os 2 Flashcards
What is a process?
A process is a program in execution, consisting of the program code and its current activity (e.g., program counter, registers, variables).
How is a program different from a process?
A program is a passive collection of instructions; a process is an active execution of those instructions, including state information.
What are the main components of a process?
- Code (text section), 2. Data section, 3. Stack, 4. Heap, 5. Program Counter, 6. CPU Registers.
What information does the Process Control Block (PCB) contain?
Process state, process ID, CPU registers, CPU scheduling info, memory management info, accounting info, and I/O status info.
What are the possible states of a process?
New, Ready, Running, Waiting, Terminated.
What happens during process creation?
The OS assigns a unique ID, allocates resources, loads the program into memory, and initializes the PCB.
What is process termination?
It is when a process finishes execution and releases all allocated resources, and the PCB is deleted from the process table.
What is a parent and child process relationship?
A parent creates child processes, which can then create their own processes, forming a process tree.
What is the fork() system call used for?
In UNIX systems, fork() creates a new child process that is a duplicate of the parent process.
What is the exec() system call used for?
It loads a new program into a process’s memory space, replacing the old program while keeping the same process ID.
What is the wait() system call used for?
It makes the parent process wait until a child process terminates, allowing orderly process cleanup.
Why are process identifiers (PIDs) important?
PIDs uniquely identify active processes, allowing the OS to track and manage them.
What is process scheduling?
The decision of which process to run next when the CPU becomes idle, based on scheduling algorithms.
What is the short-term scheduler?
Also known as the CPU scheduler, it selects from ready processes and allocates the CPU to one of them.
What is the long-term scheduler?
It decides which processes should be admitted into the ready queue from the job pool, controlling the degree of multiprogramming.
What is the medium-term scheduler?
It suspends and resumes processes to manage memory load and improve performance.
What is context switching?
Saving the state of the currently running process and loading the state of the next scheduled process.
Why is context switching considered overhead?
Because no useful work is done during switching, but it is necessary to allow multitasking.
What is a process queue?
A linked list of PCBs representing processes in a specific state (e.g., ready queue, I/O queue).
What are the types of queues used in process scheduling?
- Job queue, 2. Ready queue, 3. Device queues.
What are the different types of schedulers?
Long-term, short-term, and medium-term schedulers, each managing processes at different stages.
What is the difference between I/O-bound and CPU-bound processes?
I/O-bound processes spend more time doing I/O than computations; CPU-bound processes spend more time doing computations than I/O.