Operating System
106503Module 2: Processes & Scheduling
Q1a. Which of the following is an advantage of using threads? (i) Increased hardware costs (ii) Lower throughput (iii) Efficient utilization of CPU resources (iv) Increased memory consumption20242m
Module 2: Processes & Scheduling
View this question on its own page →Which of the following is an advantage of using threads?
(i) Increased hardware costs
(ii) Lower throughput
(iii) Efficient utilization of CPU resources
(iv) Increased memory consumptionWorked SolutionAnswer: (iii) Efficient utilization of CPU resources
Threads are lightweight processes sharing the same address space.
Advantages: lower context-switch overhead, shared memory communication, improved throughput & CPU utilization, responsiveness. Costs actually decreased are memory and creation time, not increased. Options (i), (ii), (iv) list disadvantages which are incorrect.Q1a. Which scheduling policy is most suitable for a time shared operating system: (i) Shortest job first (ii) Round Robin (iii) FCFS (iv) Elevator20222m
Module 2: Processes & Scheduling
View this question on its own page →Which scheduling policy is most suitable for a time shared operating system:
(i) Shortest job first
(ii) Round Robin
(iii) FCFS
(iv) ElevatorWorked SolutionAnswer: (ii) Round Robin
Time-shared (multiprogrammed, interactive) OS needs to give each ready process a short CPU burst in turn so users get prompt response.
- Round Robin (RR) — preemptive, each process gets a fixed time quantum (e.g., 10-100ms); ideal for time-sharing due to fairness and low response time.
- SJF / FCFS — non-preemptive, can cause starvation / convoy effect, not suitable for interactive response.
- Elevator (SCAN) — disk scheduling, not CPU scheduling.
Q1b. Suppose that a process is in BLOCKED state waiting for some I/O service. When the service is completed, it goes to the? (i) RUNNING state (ii) READY state (iii) SUSPENDED state (iv) TERMINATED state20232m
Module 2: Processes & Scheduling
View this question on its own page →Suppose that a process is in BLOCKED state waiting for some I/O service. When the service is completed, it goes to the?
(i) RUNNING state
(ii) READY state
(iii) SUSPENDED state
(iv) TERMINATED stateWorked SolutionAnswer: (ii) READY state
State transition: RUNNING → BLOCKED (waiting for I/O). On I/O completion, interrupt moves process to READY, not directly to RUNNING — it must be rescheduled by short-term scheduler. BLOCKED → READY → RUNNING.
Q1b. Which scheduler selects processes from the ready queue and allocates the CPU? (i) Long-term scheduler (ii) Medium-term scheduler (iii) Short-term scheduler (iv) Batch scheduler20252m
Module 2: Processes & Scheduling
View this question on its own page →Which scheduler selects processes from the ready queue and allocates the CPU?
(i) Long-term scheduler
(ii) Medium-term scheduler
(iii) Short-term scheduler
(iv) Batch schedulerWorked SolutionAnswer: (iii) Short-term scheduler (CPU scheduler)
- Long-term: selects jobs from job pool to ready queue (controls degree of multiprogramming)
- Medium-term: swapping (suspend/resume)
- Short-term / CPU scheduler: selects process from ready queue and allocates CPU via dispatcher (runs most frequently, must be fast)
- Batch scheduler is not an OS scheduler type.
Q1b. A process executes the following segment of code: ``c for (i = 1; i <= n; i++) fork(); `` The number of new processes created is: (i) n (ii) (n(n+1))/2 (iii) 2^n - 1 (iv) 2^n20222m
Module 2: Processes & Scheduling
View this question on its own page →A process executes the following segment of code:
for (i = 1; i <= n; i++) fork();The number of new processes created is:
(i) n
(ii) (n(n+1))/2
(iii) 2^n - 1
(iv) 2^nWorked SolutionAnswer: (iii) 2^n - 1 new processes (2^n total including parent)
Each
fork()doubles the number of processes. Loopfor i=1..n fork()creates:after i=1: 2 processes after i=2: 4 processes ... after i=n: 2^n processes totalNew processes = total - original parent = 2^n - 1. If question counts the parent as well, answer (iv) 2^n is sometimes marked; strictly new = 2^n -1.
Q1c. ______ is a technique of improving the priority of process waiting in queue for CPU allocation: (i) Starvation (ii) Ageing (iii) Revocation (iv) Relocation20222m
Module 2: Processes & Scheduling
View this question on its own page →______ is a technique of improving the priority of process waiting in queue for CPU allocation:
(i) Starvation
(ii) Ageing
(iii) Revocation
(iv) RelocationWorked SolutionAnswer: (ii) Ageing
Ageing gradually increases priority of waiting processes over time, preventing starvation of low-priority jobs. Starvation is the problem, ageing is the solution. Revocation/Relocation are unrelated.
Q1d. Scheduling a process from Ready Queue to CPU is done by (i) Short Term Scheduler (ii) Middle Term Scheduler (iii) Long Term Scheduler (iv) Dispatcher20232m
Module 2: Processes & Scheduling
View this question on its own page →Scheduling a process from Ready Queue to CPU is done by
(i) Short Term Scheduler
(ii) Middle Term Scheduler
(iii) Long Term Scheduler
(iv) DispatcherWorked SolutionAnswer: (iv) Dispatcher
Clarification: Short-term scheduler selects the process; Dispatcher gives control (context switch, switch to user mode, jump to instruction). Many textbooks loosely say Short-term scheduler, but most precise is Dispatcher. If Options force choice between schedulers only, answer (i) Short Term Scheduler. Here dispatcher is listed, so (iv) is most accurate.
Q1d. Which type of thread is managed directly by the operating system kernel? (i) User-level thread (ii) Kernel-level thread (iii) Single thread (iv) Background thread20252m
Module 2: Processes & Scheduling
View this question on its own page →Which type of thread is managed directly by the operating system kernel?
(i) User-level thread
(ii) Kernel-level thread
(iii) Single thread
(iv) Background threadWorked SolutionAnswer: (ii) Kernel-level thread
Kernel threads are managed directly by kernel (visible to scheduler). User-level threads are managed by user library, kernel unaware. Kernel threads allow true parallelism on multicore but have higher creation/scheduling overhead.
Q1d. Interval between the time of submission and first response to the job is called: (i) waiting time (ii) turnaround time (iii) throughput (iv) response time20222m
Module 2: Processes & Scheduling
View this question on its own page →Interval between the time of submission and first response to the job is called:
(i) waiting time
(ii) turnaround time
(iii) throughput
(iv) response timeWorked SolutionAnswer: (iv) response time
- Response time = submission to first response (interactive metric)
- Waiting time = total time in ready queue
- Turnaround = submission to completion
- Throughput = jobs per unit time
Q1e. A process is: (i) program in high level language kept on disk (ii) content of main memory (iii) program in execution (iv) job in secondary memory20222m
Module 2: Processes & Scheduling
View this question on its own page →A process is:
(i) program in high level language kept on disk
(ii) content of main memory
(iii) program in execution
(iv) job in secondary memoryWorked SolutionAnswer: (iii) program in execution
Process = program loaded into memory, with PCB, state, resources, execution context. Program on disk is just executable file (passive). Job is generic batch notion.
- Install PocketlyBudget App•POCKETLY
Pocketly on Android
Log daily food, travel, and hostel expenses instantly. Set monthly spending limits and see where your money goes without complex spreadsheets.
Q1g. The processes that are residing in main memory and are ready and waiting to execute are kept on a list called (i) job queue (ii) ready queue (iii) execution queue (iv) process queue20192m
Module 2: Processes & Scheduling
View this question on its own page →The processes that are residing in main memory and are ready and waiting to execute are kept on a list called
(i) job queue
(ii) ready queue
(iii) execution queue
(iv) process queueWorked SolutionAnswer: (ii) ready queue
Ready queue holds processes in memory ready to execute, waiting for CPU. Job queue holds jobs on disk, waiting to enter memory.
Q1i. Which module gives control of the CPU to the process selected by the short-term scheduler? (i) dispatcher (ii) scheduler (iii) Interrupt (iv) None of these20222m
Module 2: Processes & Scheduling
View this question on its own page →Which module gives control of the CPU to the process selected by the short-term scheduler?
(i) dispatcher
(ii) scheduler
(iii) Interrupt
(iv) None of theseWorked SolutionAnswer: (i) dispatcher
Dispatcher context-switches to the chosen process: saves old, loads PCB, switches mode, jumps to PC. Scheduler decides, dispatcher acts.
Q1i. The technique of gradually increasing the priority of a process that wait in a system for a long time is known as? (i) blocking (ii) ageing (iii) starvation (iv) convoy effect20232m
Module 2: Processes & Scheduling
View this question on its own page →The technique of gradually increasing the priority of a process that wait in a system for a long time is known as?
(i) blocking
(ii) ageing
(iii) starvation
(iv) convoy effectWorked SolutionAnswer: (ii) ageing
Ageing prevents starvation by incrementally boosting priority. Convoy effect is low-priority holding resource causing others to wait.
Q2. What is process control block? Explain it. Discuss the difference among short-term, medium-term and long-term scheduling.201914m
Module 2: Processes & Scheduling
View this question on its own page →What is process control block? Explain it.
Discuss the difference among short-term, medium-term and long-term scheduling.
Worked Solution(a) Process Control Block (PCB)
PCB is data structure per process maintained by kernel. Contents: Process ID, State (new/ready/running/waiting/terminated), Program Counter, CPU registers, Scheduling info (priority, queue pointers), Memory info (page tables, limits), I/O status (open files, devices), Accounting (CPU time, limits). Kernel uses PCB for context switch.
(b) Schedulers
- Long-term (Job scheduler): selects processes from job pool on disk to ready queue in memory. Controls degree of multiprogramming. Infrequent, slow. Absent in time-sharing.
- Medium-term: swapping — suspends/resumes processes to balance load, moves between memory/disk.
- Short-term (CPU scheduler): selects from ready queue to CPU frequently (ms). Must be fast; dispatcher then context-switches.
Tradeoff: LT controls admission, MT handles memory pressure, ST ensures responsiveness.
Q2a. What do you understand by the term Process in Operating System? Contrast the types of Interprocess Communication models.20247m
Module 2: Processes & Scheduling
View this question on its own page →What do you understand by the term Process in Operating System? Contrast the types of Interprocess Communication models.
Worked SolutionProcess
Program in execution — includes code, data, stack, heap, PCB, open files. States: New→Ready→Running→Waiting→Terminated (+suspended).
IPC Models
- Shared Memory: processes share region; fast, needs sync (mutex/semaphore) to avoid race. E.g., POSIX shm.
- Message Passing: kernel-mediated send/receive via direct naming or mailbox/ports. No shared state, good for distributed, overhead due to syscalls. Indirect mailbox decouples.
Contrast: Shared memory = speed but synchronization burden, tight coupling; Message passing = isolation, suitability for network, automatic sync but copy overhead. Modern hybrids use both.
Q2a. Write a program using "fork" to demonstrate the parent-child relationship of processes.20237m
Module 2: Processes & Scheduling
View this question on its own page →Write a program using "fork" to demonstrate the parent-child relationship of processes.
Worked SolutionC program demonstrating fork parent-child
#include <stdio.h> #include <unistd.h> #include <sys/wait.h> int main(){ pid_t p = fork(); if(p < 0){ perror("fork"); return 1; } else if(p == 0){ // Child printf("Child: PID=%d, PPID=%d ", getpid(), getppid()); // child work } else { // Parent printf("Parent: PID=%d, Child PID=%d ", getpid(), p); wait(NULL); // wait for child printf("Parent: child finished "); } return 0; }Explanation:
fork()duplicates process; returns 0 in child, child PID in parent, -1 on error. Parent and child execute concurrently with separate address spaces.wait()synchronizes. Demonstrates that after fork, both continue after fork statement.Q2b. What are the two differences between user-level thread and kernel level thread? Under what circumstance is one type better than the other?20247m
Module 2: Processes & Scheduling
View this question on its own page →What are the two differences between user-level thread and kernel level thread? Under what circumstance is one type better than the other?
Worked SolutionUser vs Kernel threads
- Management: ULT by user library (kernel unaware), KLT by kernel.
- Scheduling: ULT many-to-one, KLT one-to-one/many-to-many.
- Blocking: one ULT blocks entire process; KLT can schedule another thread of same process.
- Overhead: ULT lightweight, fast context switch; KLT heavier but true parallelism.
When better: ULT when threads are cooperative, low concurrency, need fast creation (e.g., user-level task pool). KLT when needing blocking I/O, multicore parallelism, priority scheduling.
Q2b. Consider the following four processes with following details (time given in ms): | Process | Arrival Time | CPU Burst Time | | :--- | :---: | :---: | | P1 | 0 | 12 | | P2 | 0 | 10 | | P3 | 1 | 4 | | P4 | 4 | 10 | | P5 | 2 | 12 | Draw the Gantt chart using RR scheduling with time slice 3ms. Calculate average waiting time and average turn-around time.20237m
Module 2: Processes & Scheduling
View this question on its own page →Consider the following four processes with following details (time given in ms):
Process Arrival Time CPU Burst Time P1 0 12 P2 0 10 P3 1 4 P4 4 10 P5 2 12 Draw the Gantt chart using RR scheduling with time slice 3ms. Calculate average waiting time and average turn-around time.
Worked SolutionAnswer
Note: Question states “four processes” but lists five (P1–P5). Solution is given for all five as per table.
Time quantum . Arrival Times (AT) and Burst Times (BT) as given.
Process AT BT P1 0 12 P2 0 10 P3 1 4 P4 4 10 P5 2 12 Assumptions
- Arrival order for same AT: P1 before P2.
- New arrivals during a quantum are enqueued before the preempted process is appended to the ready queue (standard RR).
- Context switch overhead = 0.
Step-by-Step Execution
Time Running Ready Queue after slice Remarks 0–3 P1 (12→9) [P2, P3, P5, P1] P3 (1), P5 (2) arrived 3–6 P2 (10→7) [P3, P5, P1, P4, P2] P4 (4) arrived 6–9 P3 (4→1) [P5, P1, P4, P2, P3] 9–12 P5 (12→9) [P1, P4, P2, P3, P5] 12–15 P1 (9→6) [P4, P2, P3, P5, P1] 15–18 P4 (10→7) [P2, P3, P5, P1, P4] 18–21 P2 (7→4) [P3, P5, P1, P4, P2] 21–22 P3 (1→0) completes at 22 [P5, P1, P4, P2] Quantum truncated to 1 22–25 P5 (9→6) [P1, P4, P2, P5] 25–28 P1 (6→3) [P4, P2, P5, P1] 28–31 P4 (7→4) [P2, P5, P1, P4] 31–34 P2 (4→1) [P5, P1, P4, P2] 34–37 P5 (6→3) [P1, P4, P2, P5] 37–40 P1 (3→0) completes at 40 [P4, P2, P5] 40–43 P4 (4→1) [P2, P5, P4] 43–44 P2 (1→0) completes at 44 [P5, P4] 44–47 P5 (3→0) completes at 47 [P4] 47–48 P4 (1→0) completes at 48 [] Gantt Chart
0 3 6 9 12 15 18 21 22 25 28 31 34 37 40 43 44 47 48 |P1 |P2 |P3 |P5 |P1 |P4 |P2 |P3|P5 |P1 |P4 |P2 |P5 |P1 |P4 |P2|P5 |P4|Mermaid:
MermaidDiagramRendering diagram…Calculation Table
PID AT BT CT TAT = CT−AT WT = TAT−BT P1 0 12 40 40 28 P2 0 10 44 44 34 P3 1 4 22 21 17 P4 4 10 48 44 34 P5 2 12 47 45 33 Sum 48 194 146 Final Answer
- Average Turn-Around Time
- Average Waiting Time
If strictly only four processes are considered (excluding P5), CTs are P1=28, P2=32, P3=10, P4=36 → Avg TAT = 26.5 ms, Avg WT = 18.5 ms (quantum 3).
Q3. Consider the following process : | Process | Arrival Time | Burst Time | | :--- | :--- | :--- | | P1 | 0.0 | 7 | | P2 | 2.0 | 4 | | P3 | 4.0 | 1 | | P4 | 5.0 | 4 | Considering non-preemptive and preemptive SJF algorithm, find out average waiting time and average turnaround time in both cases.201914m
Module 2: Processes & Scheduling
View this question on its own page →Consider the following process :
Process Arrival Time Burst Time P1 0.0 7 P2 2.0 4 P3 4.0 1 P4 5.0 4 Considering non-preemptive and preemptive SJF algorithm, find out average waiting time and average turnaround time in both cases.
Worked SolutionSJF calculations (Arrival+ Burst)
P1 AT0 BT7, P2 AT2 BT4, P3 AT4 BT1, P4 AT5 BT4.
Non-preemptive SJF: At 0: P1 runs 0-7. At 7, ready P2(4),P3(1),P4(4) → P3 7-8, then P2 8-12, P4 12-16. WT: P1 0, P2 6, P3 3, P4 7 → Avg WT=4. Avg TAT = (7+10+4+11)/4=8.
Preemptive SJF (SRTF): 0-2 P1 (rem5), at2 P2 (4 vs5) → P2? Actually P1 rem5 vs P2 4 → preempt to P2 2-4 (rem2), at4 P3(1) arrives shortest → P3 4-5, back to P2 5-7, P4 arrives 5 (4) vs P1(5) → P4 7-11, P1 11-16. WT: P1 9, P2 1, P3 0, P4 2 → Avg WT=3. Avg TAT=7. Details with Gantt: Non-preemptive Gantt P1|P3|P2|P4, Preemptive P1(0-2)|P2(2-4)|P3(4-5)|P2(5-7)|P4(7-11)|P1(11-16).Q3a. Explain the different states of a process during its life cycle using transition diagram.20235m
Module 2: Processes & Scheduling
View this question on its own page →Explain the different states of a process during its life cycle using transition diagram.
Worked SolutionProcess States & Transition Diagram
States: New (creating), Ready (in memory, waiting CPU), Running (executing), Waiting/Blocked (waiting event/I/O), Terminated (+Suspended ready/blocked via medium-term).
Transitions: New→Ready (admit), Ready→Running (dispatch), Running→Ready (preempt/timeout), Running→Waiting (I/O request), Waiting→Ready (I/O complete), Running→Terminated (exit).
Diagram description: Ready and Running connected bidirectionally, Running to Waiting one-way, Waiting to Ready one-way. Explains multiprogramming and context switch.- Install PocketlyBudget App•POCKETLY
Pocketly on Android
Log daily food, travel, and hostel expenses instantly. Set monthly spending limits and see where your money goes without complex spreadsheets.
Q3a. Describe the fundamental role of "Process Scheduling" in a multiprogramming operating system. Identify and explain at least three scheduling criteria.20247m
Module 2: Processes & Scheduling
View this question on its own page →Describe the fundamental role of "Process Scheduling" in a multiprogramming operating system. Identify and explain at least three scheduling criteria.
Worked SolutionProcess Scheduling Role
Maximize CPU utilization, throughput, fairness, response time for multiprogramming.
Three Criteria
- CPU Utilization (% busy)
- Throughput (jobs/sec)
- Turnaround / Waiting / Response Time (minimize)
- Fairness (no starvation)
Explain tradeoffs: batch favors throughput, interactive favors response.
Q3a. What is a Process Control Block? Explain its structure and significance in process management.20257m
Module 2: Processes & Scheduling
View this question on its own page →What is a Process Control Block? Explain its structure and significance in process management.
Worked SolutionPCB Structure & Significance
Fields: PID, state, PC, registers, scheduling info, memory management (page table base), I/O info, accounting. Significance: enables context switch, scheduling, process management; kernel's repository for resume. Stored in kernel space per process.
Q3b. Consider the following set of processes with the length of the CPU Burst given in milliseconds: | Process | Burst Time | Priority | | :--- | :--- | :--- | | A | 10 | 3 | | B | 1 | 1 | | C | 2 | 3 | | D | 1 | 4 | | E | 5 | 2 | The processes are assumed to have arrived in order A, B, C, D, E all at time 0. Draw the Gantt charts that illustrate the execution of FCFS and SJF scheduling algorithm. Show which algorithm results in the minimum average waiting time.20247m
Module 2: Processes & Scheduling
View this question on its own page →Consider the following set of processes with the length of the CPU Burst given in milliseconds:
Process Burst Time Priority A 10 3 B 1 1 C 2 3 D 1 4 E 5 2 The processes are assumed to have arrived in order A, B, C, D, E all at time 0.
Draw the Gantt charts that illustrate the execution of FCFS and SJF scheduling algorithm. Show which algorithm results in the minimum average waiting time.Worked SolutionFCFS vs SJF for A(10),B(1),C(2),D(1),E(5) arrival 0
FCFS order A,B,C,D,E: Gantt A0-10,B10-11,C11-13,D13-14,E14-19. WT: A0,B10,C11,D13,E14 => Avg WT=9.6, Avg TAT=13.4
SJF (non-preemptive, sorted by burst): order B(1),D(1),C(2),E(5),A(10): Gantt B0-1,D1-2,C2-4,E4-9,A9-19. WT: B0,D1,C2,E4,A9 => Avg WT=3.2, Avg TAT=7.0
Conclusion: SJF gives minimum avg waiting (3.2 vs 9.6). SJF is optimal for avg WT.Q3b. Define threads and explain their various states. Compare user-level threads with kernel-level threads.20257m
Module 2: Processes & Scheduling
View this question on its own page →Define threads and explain their various states. Compare user-level threads with kernel-level threads.
Worked SolutionThreads & States
Thread = lightweight process, dispatchable unit, shares address space, files of parent.
States: New, Ready, Running, Blocked, Terminated.ULT vs KLT
- ULT: managed by user library, many-to-one, fast, kernel unaware, blocking blocks process.
- KLT: managed by kernel, one-to-one, slower but true parallelism, blocking of one KLT not block process. Hybrid many-to-many combines.
Q3c. Explain user and kernel level threads in detail.20235m
Module 2: Processes & Scheduling
View this question on its own page →Explain user and kernel level threads in detail.
Worked SolutionUser & Kernel Threads
ULT: implemented via thread library (pthreads user-level), TCB in user space, scheduling by library, no kernel trap for switch, cannot exploit multiprocessors, whole process blocks on I/O.
KLT: kernel maintains TCB, scheduling by kernel, can be scheduled on different cores, system calls handle ops. Needs mode switch but supports parallel execution. Modern OS supports hybrid.Q4a. Discuss multiprocessor scheduling and real-time scheduling techniques.20257m
Module 2: Processes & Scheduling
View this question on its own page →Discuss multiprocessor scheduling and real-time scheduling techniques.
Worked SolutionMultiprocessor & Real-time Scheduling
Multiprocessor: load sharing, affinity, gang scheduling; approaches: SMP symmetric (each CPU self-schedules) vs master-slave. Need load balancing.
Real-time: hard (deadline must met) vs soft. Algorithms: Rate Monotonic (priority ∝ period), EDF (earliest deadline first), priority inheritance to avoid inversion.Q5a. Explain process state transition diagram of an operating system.20227m
Module 2: Processes & Scheduling
View this question on its own page →Explain process state transition diagram of an operating system.
Worked SolutionProcess State Diagram
Explain 5-state plus suspended: New→Ready (admit), Ready↔Running (dispatch/preempt), Running→Waiting (I/O), Waiting→Ready (completion), Running→Terminated. Medium-term adds Suspend Ready/Blocked. Diagram aids context switch understanding.
Q5b. Consider the following CPU processes with arrival times 0 and CPU bursts (in milliseconds) as given below: | Process | Burst time | |---|---| | P1 | 24 | | P2 | 3 | | P3 | 3 | If the Round Robin Scheduling is used with time quantum of 4 milliseconds to schedule the processes. Draw the Gantt chart and calculate the average waiting time across all processes (in milliseconds).20227m
Module 2: Processes & Scheduling
View this question on its own page →Consider the following CPU processes with arrival times 0 and CPU bursts (in milliseconds) as given below:
Process Burst time P1 24 P2 3 P3 3 If the Round Robin Scheduling is used with time quantum of 4 milliseconds to schedule the processes. Draw the Gantt chart and calculate the average waiting time across all processes (in milliseconds).
Worked SolutionRR quantum 4, P1=24,P2=3,P3=3 arrival 0
Gantt: P1 0-4, P2 4-7, P3 7-10, P1 10-14, P1 14-18, P1 18-22, P1 22-24, P1 24-28? Actually P1 needs 6 quanta: 0-4(20 rem),4-7 P2 done,7-10 P3 done,10-14 P1(16),14-18(12),18-22(8),22-26(4),26-30(0). WT: P1 =30-24=6? Wait TAT P1 30, WT 6, P2 WT 4, P3 WT 7 => Avg WT ~5.67. Detailed diagram shows RR fairness.
Q6. (a) What is a thread? (b) How is thread different from a process? (c) What resources are used when a thread is created?201914m
Module 2: Processes & Scheduling
View this question on its own page →(a) What is a thread?
(b) How is thread different from a process?
(c) What resources are used when a thread is created?
Worked SolutionThreads (a) Lightweight process sharing address space
(b) Process has separate memory/files, heavy; thread shares, fast context, communication via shared memory
(c) Resources: TCB, stack, registers, priority, scheduling info, shared code/data/files with parent process.Q6a. Describe the objectives of process scheduling. Explain the roles of long-term, medium-term, and short-term schedulers.20257m
Module 2: Processes & Scheduling
View this question on its own page →Describe the objectives of process scheduling. Explain the roles of long-term, medium-term, and short-term schedulers.
Worked SolutionScheduling Objectives
Max utilization, throughput, minimize turnaround/waiting/response, fairness.
Roles as earlier: LT admit, MT suspend, ST dispatch.- Install PocketlyBudget App•POCKETLY
Pocketly on Android
Log daily food, travel, and hostel expenses instantly. Set monthly spending limits and see where your money goes without complex spreadsheets.
Q7b. Consider the following set of processes with the length of the CPU burst given in milliseconds: | Process | Burst Time | Priority | | :---: | :---: | :---: | | A | 10 | 3 | | B | 1 | 1 | | C | 2 | 3 | | D | 1 | 4 | | E | 5 | 2 | The processes are assumed to have arrived in order A, B, C, D, E all at time 0. Draw the Gantt charts that illustrate the execution of SJF scheduling algorithm. Show which algorithm results in the minimum average waiting time.20257m
Module 2: Processes & Scheduling
View this question on its own page →Consider the following set of processes with the length of the CPU burst given in milliseconds:
Process Burst Time Priority A 10 3 B 1 1 C 2 3 D 1 4 E 5 2 The processes are assumed to have arrived in order A, B, C, D, E all at time 0. Draw the Gantt charts that illustrate the execution of SJF scheduling algorithm. Show which algorithm results in the minimum average waiting time.
Worked SolutionSJF as Q72: sorted B1,D1,C2,E5,A10 → Gantt B0-1,D1-2,C2-4,E4-9,A9-19, Avg WT 3.2, proving SJF optimal for avg WT vs FCFS 9.6.
Q8a. What is thread? Explain the benefits of using thread.20227m
Module 2: Processes & Scheduling
View this question on its own page →What is thread? Explain the benefits of using thread.
Worked SolutionThread Benefits
- Responsiveness, resource sharing, economy (fast creation), scalability on multicore. Improves throughput, uses blocking I/O without blocking process.
Q9a. Write a short note on: Process State transitions20257m
Module 2: Processes & Scheduling
View this question on its own page →Write a short note on:
Process State transitions
Worked SolutionProcess State Transitions
As Q13: New→Ready→Running↔Waiting→Terminated, with suspend states. Explained with diagram and events.
Q9c. Write short notes on: Process Control Block (PCB)20237m
Module 2: Processes & Scheduling
View this question on its own page →Write short notes on: Process Control Block (PCB)
Worked SolutionPCB as before: PID, state, PC, registers, scheduling, memory, I/O, accounting — kernel's process descriptor for management and context switch.
Q9c. Write short notes on: Process Control Block20227m
Module 2: Processes & Scheduling
View this question on its own page →Write short notes on: Process Control Block
Worked SolutionPCB same as Q29: structure and importance for process management.