1. What is a Process?
A process is a program in execution, including the program code, data, and resources like CPU, memory, and files.
2. Process States
-
New – Process is being created.
-
Ready – Waiting to be assigned CPU.
-
Running – Currently executing.
-
Waiting/Blocked – Waiting for an event (I/O completion).
-
Terminated – Execution finished.
3. Process Control Block (PCB)
A PCB is a data structure maintained by the OS for each process, containing:
-
Process ID (PID)
-
Process state
-
CPU registers
-
Program counter
-
Memory management info
-
I/O status
4. Context Switching
Process of saving the state of the current process and loading the state of another process.
🔹 Occurs during multitasking and CPU scheduling.
5. Threads
-
Thread = lightweight process.
-
Share same code, data, and OS resources, but have independent registers & stack.
-
Multithreading improves CPU utilization.
6. Types of Scheduling
-
Preemptive – CPU can be taken from a process before completion (e.g., Round Robin).
-
Non-Preemptive – CPU given until process finishes or blocks (e.g., FCFS, SJF).
7. GATE Important Points
-
Process is dynamic; program is static.
-
PCB is essential for context switching.
-
Thread creation is faster than process creation.
Day 2 – Practice Questions (with Answers)
Q1. Define process in one line.
Answer: A process is a program in execution along with its resources and current state.
Q2. Name the 5 classic process states.
Answer: New, Ready, Running, Waiting/Blocked, Terminated.
Q3. What does a PCB store?
Answer: PID, process state, CPU registers, program counter, memory info, I/O status.
Q4. What is context switching?
Answer: Switching CPU from one process to another by saving and restoring process states.
Q5. Which is faster: process creation or thread creation?
Answer: Thread creation.
Q6. Which scheduling type allows interruption?
Answer: Preemptive Scheduling.
Q7. FCFS scheduling is preemptive or non-preemptive?
Answer: Non-preemptive.
Q8. In which state is a process when waiting for I/O completion?
Answer: Waiting/Blocked state.
Q9. What is a lightweight process?
Answer: Thread.
Q10. Which data structure is most important for process management?
Answer: Process Control Block (PCB).
No comments:
Post a Comment