1. Home
  2. Explore
  3. Computer Science
  4. CPU Scheduling Concepts

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

CPU Scheduling Concepts

  • 37Unfamiliar
  • 0Learning
  • 0Familiar
  • 0Mastered
Topic: Scheduling Basics

What is the scheduler's central responsibility?

37 questions

  1. 1

    What is the scheduler's central responsibility?

    Model answer

    It selects which process receives a CPU and, in a multiprocessor system, which CPU it receives and for how long.

    Explanation

    Scheduling determines how CPU time is allocated among processes.

  2. 2

    Why might an operating-systems course first study scheduling with a single CPU?

    Model answer

    A single-CPU assumption makes it possible to understand important scheduling concepts before considering multiprocessor scheduling.

    Explanation

    Multiprocessor scheduling introduces additional issues that can be studied after the basic concepts.

  3. 3

    What does multiprocessor scheduling need to determine?

    Model answer

    It must decide which process gets which CPU and for how long, while accounting for issues involved in scheduling across multiple CPUs.

    Explanation

    With multiple CPUs, the scheduler must allocate processes among the available processors.

  4. 4

    What is a CPU burst?

    Model answer

    A CPU burst is a period of process activity that does not involve I/O or a system call requesting a service from the operating system.

    Explanation

    It covers the process's CPU-side work between requests for I/O or other system services.

  5. 5

    Give examples of operations that count as CPU-burst activity.

    Model answer

    Arithmetic operations such as addition and multiplication, and memory operations such as loads and stores, count as CPU-burst activity.

    Explanation

    These operations do not themselves request I/O service from the operating system.

  6. 6

    Why do loads and stores count as CPU time even if the CPU stalls while memory is accessed?

    Model answer

    From the operating system's perspective, the process still has the CPU during the memory operation, so the time counts as CPU time for that process.

    Explanation

    A memory-system delay may leave the CPU idle, but it does not make the process an I/O-waiting process.

  7. 7

    What happens to a CPU burst when a process requests an I/O operation, such as reading a file?

    Model answer

    The request ends the CPU burst and begins an I/O burst, during which the process waits for the I/O service to complete.

    Explanation

    I/O requests require operating-system intervention, unlike ordinary arithmetic or memory operations.

  8. 8

    What state does a process enter while it waits for requested I/O?

    Model answer

    It enters the waiting state.

    Explanation

    The process cannot continue its CPU-side work until the requested I/O service is complete.

  9. 9

    When I/O finishes, why does a process move from waiting to ready rather than directly to running?

    Model answer

    The process must enter the ready state so the scheduler can choose whether it gets the CPU next.

    Explanation

    Completion of I/O makes a process eligible to run but does not itself allocate the CPU to it.

  10. 10

    While a process is performing CPU-burst operations, what state is it in?

    Model answer

    It is in the running state.

    Explanation

    The operating system treats the process as running while it performs CPU-side activity, including memory operations.

  11. 11

    What does a CPU-burst histogram show on its horizontal and vertical axes?

    Model answer

    The horizontal axis shows CPU-burst duration, and the vertical axis shows how frequently each duration occurs.

    Explanation

    The histogram describes the distribution of CPU-burst lengths.

  12. 12

    Which CPU-burst duration is described as most common, and which durations are rare?

    Model answer

    Bursts of about two milliseconds are most common, while bursts longer than eight milliseconds are rare.

    Explanation

    The described distribution has its highest frequency around two milliseconds and few very long bursts.

  13. 13

    Why are CPU bursts longer than eight milliseconds unusual?

    Model answer

    Processes commonly request I/O, so it is unusual for one to continue for that long without an I/O operation.

    Explanation

    An I/O request ends the current CPU burst, limiting how long a burst typically lasts.

  14. 14

    Why can a two-millisecond CPU burst contain a very large number of operations?

    Model answer

    A processor running at one gigahertz performs about a billion cycles per second, allowing many operations to occur in a few milliseconds.

    Explanation

    Even when operations take multiple cycles, a short interval can contain hundreds of thousands or more operations.

  15. 15

    Why does the number of cycles per operation vary?

    Model answer

    It depends on the operation: an addition may take one cycle, a multiplication a few cycles, and a load or store that misses cache and accesses main memory can take hundreds.

    Explanation

    Different operations, especially memory accesses with cache misses, have different execution costs.

  16. 16

    What does the short-term CPU scheduler do?

    Model answer

    It examines the ready queue, selects one process, and gives that process the CPU.

    Explanation

    The short-term scheduler makes the immediate decision about which ready process runs next.

  17. 17

    Why is the ready queue not necessarily implemented as a literal queue?

    Model answer

    It is the data structure used to maintain ready processes and could be implemented as a FIFO queue, priority queue, or tree.

    Explanation

    The term “queue” describes the collection of ready processes, not a required implementation.

  18. 18

    Why do modern operating systems often use a priority-based structure for ready processes?

    Model answer

    They assign processes priorities, so a priority queue or tree can be used to maintain and select among ready processes.

    Explanation

    Priority-based scheduling requires a structure that can organize processes according to priority.

  19. 19

    What event can move a process from running to waiting, and what does this indicate for scheduling?

    Model answer

    A process can move from running to waiting by requesting I/O; the scheduler must then decide which ready process gets the CPU.

    Explanation

    The running process cannot continue while it waits for the requested service.

  20. 20

    How can a running process be moved to the ready state in a preemptive system?

    Model answer

    A timer interrupt can cause the system to interrupt the running process, take away its CPU, and return it to the ready state.

    Explanation

    The process is preempted so another process can be selected to run.

  21. 21

    What hardware support is required to implement preemptive scheduling?

    Model answer

    A timer is required so the operating system can interrupt a running process.

    Explanation

    Without a timer, the system cannot enforce timer-based preemption.

  22. 22

    How does non-preemptive scheduling differ from preemptive scheduling?

    Model answer

    In non-preemptive scheduling, the system does not interrupt a process; the process keeps the CPU until it releases it.

    Explanation

    Preemptive scheduling can take the CPU away from a running process, whereas non-preemptive scheduling waits for the process to release it.

  23. 23

    What is the difference between the scheduler and the dispatcher?

    Model answer

    The scheduler chooses which process should receive the CPU, while the dispatcher carries out the work needed to give it the CPU.

    Explanation

    The dispatcher implements the scheduling decision rather than choosing the process.

  24. 24

    What role does context switching play in dispatching?

    Model answer

    The dispatcher saves the state of the process losing the CPU and restores the state of the process about to run.

    Explanation

    Saving and restoring process state allows execution to switch between processes.

  25. 25

    Why must the dispatcher switch to user mode before giving the CPU to a user process?

    Model answer

    Without the switch, the user process could execute with kernel privileges, which would be a serious security and system-protection failure.

    Explanation

    User programs must not receive the privileges of the operating-system kernel.

  26. 26

    Besides switching modes and process states, what must the dispatcher do to resume a process?

    Model answer

    It must jump to the proper location in the process or program that is being resumed.

    Explanation

    Execution must continue from the appropriate point in the selected process.

  27. 27

    What is dispatch latency?

    Model answer

    Dispatch latency is the time taken to perform the work required to dispatch a process.

    Explanation

    This includes the steps needed to implement the scheduling decision, such as switching context and resuming execution.

  28. 28

    What does CPU utilization measure, and how should a scheduler generally affect it?

    Model answer

    CPU utilization measures how much the CPU is being used, and it is generally a criterion to maximize.

    Explanation

    Higher utilization means the CPU spends less time idle.

  29. 29

    What is throughput in the evaluation of a scheduling algorithm?

    Model answer

    Throughput is the number of operations or tasks completed within a given period of time.

    Explanation

    It measures the amount of completed work over a specified interval.

  30. 30

    What is turnaround time, and what is the usual goal for it?

    Model answer

    Turnaround time is the time from a task's submission to its completion, and it is generally something to minimize.

    Explanation

    It measures the total time a task takes from start to finish.

  31. 31

    What is waiting time for a process?

    Model answer

    Waiting time is the time the process spends in the ready queue.

    Explanation

    It measures time spent ready to run but not receiving the CPU.

  32. 32

    What is response time, and what interval does it measure?

    Model answer

    Response time is the interval from a task's submission until its first response.

    Explanation

    It measures how quickly the system first responds, not how long the task takes to finish.

  33. 33

    How can shortening the time quantum affect response time?

    Model answer

    It can improve response time because processes get opportunities to make progress sooner, reducing users' perceived delays.

    Explanation

    A shorter quantum lets the system cycle among processes more frequently.

  34. 34

    Why can a shorter time quantum worsen turnaround time and throughput?

    Model answer

    It causes more context switching and time spent in the kernel, leaving less time for productive work; tasks can take longer to finish and fewer can be completed.

    Explanation

    The overhead of frequent switching reduces the time available for process execution.

  35. 35

    Why can optimizing one scheduling criterion harm another?

    Model answer

    Scheduling criteria can conflict; for example, a short time quantum can improve response time while increasing switching overhead and reducing throughput.

    Explanation

    A scheduling choice that benefits one outcome may use resources less efficiently or worsen another outcome.

  36. 36

    Why must a scheduling system balance user and system requirements?

    Model answer

    A choice that improves the user experience, such as a very short time quantum, may use system resources inefficiently, so the scheduler must balance responsiveness with efficient resource use.

    Explanation

    Scheduling involves tradeoffs rather than maximizing every criterion independently.

  37. 37

    Which measure is the main focus for comparing scheduling algorithms in the described chapter, and what other forms of optimization may sometimes be useful?

    Model answer

    The main focus is average waiting time; in some cases, optimizing a minimum or maximum measure, such as minimizing maximum response time, may be useful.

    Explanation

    Average measures are commonly optimized, while a maximum response-time goal can help make a system more interactive.

1 of 37
Question 1 of 37

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent