Lecture_13-CSCIU511-Jahangir_Majumder-Spring_2025

CSCI U511 01 Operating Systems

  • Instructor: AKM Jahangir A Majumder, PhD

  • Semester: Spring 2025

  • Lecture Date: February 27, 2025

  • Note: Some slides adapted from previous instructors; some figures from the textbook.

Review and Learning Outcomes

  • Finished coverage on Synchronization: Deadlock.

  • Continued discussion on Scheduling:

    • Uniprocessor: FIFO, SJF, RR, MFQ

    • Multiprocessor: Affinity and Gang

  • Quiz 3 grades and key posted on Blackboard.

  • Homework 4 due on Tuesday, March 4, 2025.

  • Quiz 4 scheduled for Thursday, March 6, covering lectures 11-13.

  • Sign-up link for Engage Green SPACE visit on Friday, March 21, is on Blackboard.

  • Mid-project progress report due Friday, February 28, at midnight on Blackboard.

Scheduling Algorithms Review

First Come, First Served (FCFS)

  • Goal: Execute jobs in the order they arrive.

  • Fairness: Similar to a bank teller line.

  • Simplicity: Easy to implement.

  • Problem: Long jobs delay all subsequent jobs.

    • Example Queue: A (4), B (3), C (6), D (3)

    • Execution Order: A -> B -> C -> D.

Shortest Job First (SJF)

  • Goal: Execute the task with the shortest remaining work.

  • Also known as Shortest Remaining Time First (SRTF).

  • Example: If five tasks arrive with varying lengths, SJF prioritizes shorter tasks.

    • Example Completion:

      • FIFO: A (4), B (3), C (6), D (3)

      • SJF: B (3), D (3), A (4), C (6).

  • Challenge: How to accurately predict job length to prevent delays.

Shortest Process Next (SPN)

  • Policy: Non-preemptive selection of the shortest expected processing time.

  • Starvation Risk: Longer processes lag behind, potentially starving.

  • Accurate time estimation crucial; incorrect predictions may lead to job abortion.

Round Robin (RR) Scheduling

  • Policy: Assign time slices (quantum) in a circular order.

    • Preemption occurs if a task doesn't finish in its time slice.

  • Quantum Length: Balancing act—too short increases context switches; too long may delay response.

  • Typical quantum range: 10-50 ms.

Comparison of Scheduling Policies

  • Completion Times: Analyzed between FCFS, SJF, and RR in diverse scenarios.

  • Example:

    • Process Arrival & Service Time:

      • A (3), B (6), C (4), D (5), E (2)

    • Completion Time: Different algorithms yield varying results.

Max-Min Fairness

  • Balances CPU allocation among I/O-bound and compute-bound tasks.

  • Strategies:

    • Maximize the minimum allocation.

    • If any task requires less CPU, prioritize the least demanding.

    • Split remaining resources equitably among tasks.

Priority Scheduling

  • Assign a priority level to each process; highest priority runs first.

  • Dynamic priority adjustments based on CPU usage and I/O wait times.

  • Group processes into multiple queues by priority with round-robin scheduling per queue.

Multi-level Feedback Queue (MFQ)

  • Definition: Extension of RR with multiple queues of varying priority levels.

  • Goals include:

    • Responsiveness for short tasks, low overhead, starvation prevention, and fairness.

  • High-priority queues have short time slices; low-priority queues have longer intervals.

Uniprocessor Scheduling Summary

  • FIFO: Simple, low overhead but poor average response time with variable task sizes.

  • SJF: Optimal for average response time; poor for response time variance.

  • Round Robin: Poor response time with equal size tasks; benefits from max-min fairness strategies.

Multiprocessor Scheduling

  • Challenges: Effective utilization of cores and parallel application adaptation.

  • Potential issues include contention for scheduler spinlocks, cache coherence overhead, and limited cache reuse.

Per-Processor Affinity Scheduling

  • Each processor maintains separate data structures, enhancing cache reuse.

  • Tasks designated to run on specific processors to reduce latency.

Scheduling Parallel Programs

  • Oblivious Scheduling: Each processor independently time-slices threads from its own ready list.

  • Ensures fair distribution of processing across applications.

Conclusion

  • Coverage included scheduling algorithms: FIFO, SJF, RR, and MFQ.

  • Further details will be discussed in upcoming lectures.