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 Foundations

What is the scheduler's central responsibility when deciding how to use processor resources?

37 questions

  1. 1

    What is the scheduler's central responsibility when deciding how to use processor resources?

    1. A

      To determine which files each process is allowed to access

    2. B

      To translate each process's source code into machine instructions

    3. C

      To select which process receives a CPU and for how long

    4. D

      To perform the input and output requested by each process

    Correct answer
    C

    To select which process receives a CPU and for how long

    Explanation

    The scheduler chooses which process runs on a CPU and, in time-sharing systems, how long it runs. With multiple CPUs, it also determines which process gets which CPU.

  2. 2

    Why might introductory scheduling discussions assume a single CPU before considering multiprocessor scheduling?

    1. A

      A single CPU makes it easier to understand core scheduling concepts before adding multiprocessor issues

    2. B

      A single CPU guarantees that every process receives the same amount of processor time

    3. C

      Multiprocessor systems do not use ready queues or scheduling algorithms

    4. D

      A single CPU eliminates the need for a scheduler to choose among ready processes

    Correct answer
    A

    A single CPU makes it easier to understand core scheduling concepts before adding multiprocessor issues

    Explanation

    The single-CPU assumption helps establish important scheduling concepts first; scheduling across multiple processors introduces additional issues to consider.

  3. 3

    What does the short-term scheduler do?

    1. A

      Selects a process from the waiting state and directly resumes it

    2. B

      Selects an I/O device and assigns it to a waiting process

    3. C

      Selects a process from the ready queue and assigns it the CPU

    4. D

      Selects a file from storage and loads it into the ready queue

    Correct answer
    C

    Selects a process from the ready queue and assigns it the CPU

    Explanation

    The short-term scheduler examines the ready queue, picks a process, and gives that process the CPU.

  4. 4

    Why does the term “ready queue” not necessarily mean that the processes are stored in a first-in, first-out queue?

    1. A

      The ready queue is a logical collection that can use different data structures

    2. B

      The ready queue is always stored in the processor's hardware registers

    3. C

      The ready queue can contain only one process at a time

    4. D

      The ready queue contains only processes that have already finished running

    Correct answer
    A

    The ready queue is a logical collection that can use different data structures

    Explanation

    Operating-system terminology uses “ready queue” for the collection of ready processes, but it can be implemented using structures such as a FIFO queue, priority queue, or tree.

  5. 5

    Why are priority queues or trees useful for implementing a ready queue in many modern operating systems?

    1. A

      They can organize ready processes according to scheduling priorities

    2. B

      They prevent processes from entering the waiting state for I/O

    3. C

      They eliminate the need to make scheduling decisions

    4. D

      They ensure every ready process runs for exactly the same duration

    Correct answer
    A

    They can organize ready processes according to scheduling priorities

    Explanation

    The content notes that modern operating systems use priorities and that priority-based scheduling calls for a structure, such as a priority queue or tree, that can support them.

  6. 6

    From the operating system's perspective, which activity counts as part of a process's CPU burst?

    1. A

      Waiting for keyboard input to arrive

    2. B

      Executing a load instruction, even if the memory system makes the CPU stall

    3. C

      Waiting for a requested file read to finish

    4. D

      Waiting for a requested screen write to finish

    Correct answer
    B

    Executing a load instruction, even if the memory system makes the CPU stall

    Explanation

    A CPU burst includes processor-side activity such as arithmetic and memory operations. Even if a load or store stalls the CPU, the operating system counts that interval as CPU time for the process; waiting for I/O is not CPU time.

  7. 7

    What event typically ends a CPU burst and begins an I/O burst?

    1. A

      The scheduler places the process in the ready queue

    2. B

      The process requests an I/O service that requires operating-system intervention

    3. C

      The process performs a load or store instruction

    4. D

      The process executes an arithmetic instruction

    Correct answer
    B

    The process requests an I/O service that requires operating-system intervention

    Explanation

    A request such as reading a file or keyboard input requires operating-system intervention. That request ends the CPU burst, and the process waits while the I/O service is performed.

  8. 8

    After a process's requested I/O completes, what is the next step before it can run again?

    1. A

      It returns to the waiting state until another process terminates

    2. B

      It moves directly to the running state without a scheduling decision

    3. C

      It terminates because completing I/O ends its execution

    4. D

      It moves to the ready state, where the scheduler can select it

    Correct answer
    D

    It moves to the ready state, where the scheduler can select it

    Explanation

    When I/O completes, the process moves from waiting to ready. It does not automatically receive the CPU; the scheduler must select it.

  9. 9

    Which description correctly distinguishes a CPU burst from an I/O burst?

    1. A

      A CPU burst covers all time until termination; an I/O burst covers only system-call execution

    2. B

      A CPU burst covers time in the ready queue; an I/O burst covers time in the running state

    3. C

      A CPU burst covers only arithmetic; an I/O burst covers arithmetic and memory operations

    4. D

      A CPU burst covers computation and memory operations; an I/O burst covers time waiting for I/O service

    Correct answer
    D

    A CPU burst covers computation and memory operations; an I/O burst covers time waiting for I/O service

    Explanation

    CPU bursts include operations such as arithmetic, loads, and stores. I/O bursts are periods when a process waits for an I/O request to be serviced.

  10. 10

    What does a histogram of CPU-burst lengths represent?

    1. A

      Process priority on the horizontal axis and turnaround time on the vertical axis

    2. B

      I/O duration on the horizontal axis and CPU utilization on the vertical axis

    3. C

      Burst frequency on the horizontal axis and the number of ready processes on the vertical axis

    4. D

      Burst duration on the horizontal axis and how frequently each duration occurs on the vertical axis

    Correct answer
    D

    Burst duration on the horizontal axis and how frequently each duration occurs on the vertical axis

    Explanation

    The histogram described plots CPU-burst duration along the horizontal axis and the frequency of occurrence along the vertical axis.

  11. 11

    What pattern in CPU-burst lengths is described in the content?

    1. A

      Bursts longer than eight milliseconds are most common, while two-millisecond bursts are rare

    2. B

      Bursts around eight milliseconds are most common, while bursts shorter than two milliseconds are rare

    3. C

      Bursts around two milliseconds are most common, while bursts longer than eight milliseconds are rare

    4. D

      Bursts of every duration occur with roughly equal frequency

    Correct answer
    C

    Bursts around two milliseconds are most common, while bursts longer than eight milliseconds are rare

    Explanation

    The distribution described has its most frequent CPU-burst length at about two milliseconds, and CPU bursts longer than eight milliseconds are rare.

  12. 12

    Why are very long CPU bursts described as uncommon?

    1. A

      Memory operations are classified as I/O and therefore end every CPU burst

    2. B

      Processes commonly request I/O rather than continue computing for long periods without interruption

    3. C

      A process cannot execute more than a few instructions before entering the ready state

    4. D

      The scheduler terminates every process after a fixed number of CPU operations

    Correct answer
    B

    Processes commonly request I/O rather than continue computing for long periods without interruption

    Explanation

    The explanation given is that it is unusual for a process to continue for a long time without I/O, such as reading input or accessing a file.

  13. 13

    On a one-gigahertz processor, approximately how many clock cycles occur in one second?

    1. A

      One thousand cycles

    2. B

      One million cycles

    3. C

      One billion cycles

    4. D

      One hundred thousand cycles

    Correct answer
    C

    One billion cycles

    Explanation

    A one-gigahertz processor operates at one billion cycles per second.

  14. 14

    Which statement best describes how the number of cycles required by an operation can vary?

    1. A

      An add and multiply must take the same number of cycles, but loads take none

    2. B

      An add may take hundreds of cycles, a multiply one, and a cache-missing load a few

    3. C

      Every operation takes one cycle unless it requests an operating-system service

    4. D

      An add may take one cycle, a multiply a few, and a cache-missing load hundreds

    Correct answer
    D

    An add may take one cycle, a multiply a few, and a cache-missing load hundreds

    Explanation

    The content contrasts a one-cycle add, a multiply that may take a few cycles, and a load that misses cache and accesses main memory, which can take hundreds of cycles.

  15. 15

    Using the content's rough estimate of ten cycles per operation, how many operations can a one-gigahertz processor perform in one millisecond?

    1. A

      About one thousand operations

    2. B

      About one billion operations

    3. C

      About one hundred thousand operations

    4. D

      About ten million operations

    Correct answer
    C

    About one hundred thousand operations

    Explanation

    At one billion cycles per second and about ten cycles per operation, the estimate is 10810^8108 operations per second, or about 10510^5105 operations per millisecond.

  16. 16

    What is preemptive scheduling?

    1. A

      Scheduling in which the system can interrupt a running process and take the CPU away

    2. B

      Scheduling in which the process chooses which other process runs next

    3. C

      Scheduling in which a process keeps the CPU until it finishes all of its I/O

    4. D

      Scheduling in which the system assigns CPUs only when a process terminates

    Correct answer
    A

    Scheduling in which the system can interrupt a running process and take the CPU away

    Explanation

    In preemptive scheduling, the system can interrupt a running process, commonly through a timer interrupt, and reassign the CPU.

  17. 17

    What hardware support is necessary for the timer-based preemption described in the content?

    1. A

      A timer that can interrupt the running process

    2. B

      A priority queue implemented directly in the CPU

    3. C

      A storage device that can interrupt each arithmetic operation

    4. D

      A separate processor for every ready process

    Correct answer
    A

    A timer that can interrupt the running process

    Explanation

    The operating system needs a hardware timer to generate the interruption that allows it to preempt a running process.

  18. 18

    How does non-preemptive scheduling differ from preemptive scheduling?

    1. A

      The system makes no scheduling decisions after processes become ready

    2. B

      The system assigns every process a CPU at the same time

    3. C

      The system interrupts processes more frequently than a timer-based scheduler

    4. D

      The system does not interrupt a process; the process releases the CPU itself

    Correct answer
    D

    The system does not interrupt a process; the process releases the CPU itself

    Explanation

    In non-preemptive scheduling, the system does not forcibly interrupt a process. The process retains the CPU until it releases it, such as by requesting I/O.

  19. 19

    Which event can cause a preemptive scheduler to move a process from running to ready?

    1. A

      A timer interrupt that causes the system to take the CPU away

    2. B

      Completion of an I/O request while the process is still running

    3. C

      The process's initial submission before it enters the ready queue

    4. D

      The dispatcher switching the process into user mode

    Correct answer
    A

    A timer interrupt that causes the system to take the CPU away

    Explanation

    A timer interrupt can preempt a running process, causing it to leave the running state and return to the ready state.

  20. 20

    Which pair of events can prompt a scheduling decision even without a running process being preempted?

    1. A

      A process moving from ready to running, or remaining in the ready queue

    2. B

      A process executing an add instruction, or executing a load instruction

    3. C

      A process moving from running to waiting, or from waiting to ready

    4. D

      A process changing from user mode to kernel mode, or back again

    Correct answer
    C

    A process moving from running to waiting, or from waiting to ready

    Explanation

    Scheduling decisions can occur when a process blocks by moving from running to waiting, and when an I/O completion moves a process from waiting to ready.

  21. 21

    What is the dispatcher responsible for?

    1. A

      Carrying out the scheduler's decision to give the CPU to a selected process

    2. B

      Choosing the scheduling priorities for every process in the system

    3. C

      Deciding when a process should request I/O from a device

    4. D

      Measuring how many operations a process has completed

    Correct answer
    A

    Carrying out the scheduler's decision to give the CPU to a selected process

    Explanation

    The scheduler decides which process should run; the dispatcher performs the work needed to implement that decision.

  22. 22

    Which action is part of a context switch performed by the dispatcher?

    1. A

      Saving the state of the process losing the CPU and restoring the state of the selected process

    2. B

      Changing the priority of every process in the ready queue

    3. C

      Completing the I/O request of the process losing the CPU

    4. D

      Translating the selected process's program into machine code

    Correct answer
    A

    Saving the state of the process losing the CPU and restoring the state of the selected process

    Explanation

    Context switching includes saving the outgoing process's state and restoring the incoming process's state.

  23. 23

    Why must the dispatcher switch to user mode before transferring control to a user process?

    1. A

      Otherwise, the scheduler could not measure the process's CPU burst

    2. B

      Otherwise, the user process would be unable to enter the ready state

    3. C

      Otherwise, the process would be forced to run on every available CPU

    4. D

      Otherwise, the user process could execute with kernel-level privileges

    Correct answer
    D

    Otherwise, the user process could execute with kernel-level privileges

    Explanation

    If a user process were allowed to run in kernel mode, it could have the kernel's privileges. Switching to user mode protects the system.

  24. 24

    After restoring a process's state, where should the dispatcher transfer control?

    1. A

      To the beginning of the operating system's boot sequence

    2. B

      To the first instruction of every other ready process

    3. C

      To the appropriate location in the program where execution should resume

    4. D

      To the end of the process's I/O queue

    Correct answer
    C

    To the appropriate location in the program where execution should resume

    Explanation

    The dispatcher must jump to the proper location in the selected program so that the process can resume or start execution correctly.

  25. 25

    What does dispatch latency measure?

    1. A

      The time required for the dispatcher to carry out a process switch

    2. B

      The time a process spends waiting for an I/O request to finish

    3. C

      The time from task submission until the first response

    4. D

      The time from task submission until the task completes

    Correct answer
    A

    The time required for the dispatcher to carry out a process switch

    Explanation

    Dispatch latency is the time taken to perform the work of dispatching, including tasks such as switching context and transferring control.

  26. 26

    Which scheduling criterion measures the fraction or degree of time the CPU is doing useful work?

    1. A

      Response time

    2. B

      Throughput

    3. C

      Waiting time

    4. D

      CPU utilization

    Correct answer
    D

    CPU utilization

    Explanation

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

  27. 27

    How is throughput defined in the content?

    1. A

      The number of tasks completed during a given period

    2. B

      The time from submission until a task's completion

    3. C

      The time from submission until a task's first response

    4. D

      The time a process spends waiting in the ready queue

    Correct answer
    A

    The number of tasks completed during a given period

    Explanation

    Throughput is the amount of work completed in a specified period, described as the number of operations or tasks completed during that time.

  28. 28

    What does turnaround time measure?

    1. A

      The time from a task's submission to its completion

    2. B

      The time from a task's submission to its first response

    3. C

      The time required to save and restore process state

    4. D

      The time a process spends waiting only in the ready queue

    Correct answer
    A

    The time from a task's submission to its completion

    Explanation

    Turnaround time is the total time from submission of a task to completion.

  29. 29

    What does waiting time measure in the scheduling criteria described?

    1. A

      The time from submission until the process first runs

    2. B

      The time a process spends in the ready queue

    3. C

      The time the dispatcher spends restoring process state

    4. D

      The time a process spends waiting for I/O to complete

    Correct answer
    B

    The time a process spends in the ready queue

    Explanation

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

  30. 30

    What does response time measure?

    1. A

      The total time a process spends in the ready queue

    2. B

      The total time the CPU spends executing the process

    3. C

      The time from task submission until its first response

    4. D

      The time from task submission until its final completion

    Correct answer
    C

    The time from task submission until its first response

    Explanation

    Response time is the interval between submitting a task and receiving its first response.

  31. 31

    Which direction should a scheduler generally aim to move CPU utilization, throughput, waiting time, and turnaround time?

    1. A

      Increase utilization and throughput while reducing waiting and turnaround time

    2. B

      Reduce utilization and waiting time while increasing throughput and turnaround time

    3. C

      Reduce utilization and throughput while increasing waiting and turnaround time

    4. D

      Increase utilization and waiting time while reducing throughput and turnaround time

    Correct answer
    A

    Increase utilization and throughput while reducing waiting and turnaround time

    Explanation

    CPU utilization and throughput are generally metrics to maximize, while waiting time and turnaround time are metrics to minimize.

  32. 32

    Why might a scheduler need to balance different performance criteria rather than optimize only one?

    1. A

      Improving one criterion can worsen another because the criteria can trade off

    2. B

      The dispatcher prevents the scheduler from considering user needs

    3. C

      Only throughput can be measured by an operating system

    4. D

      All criteria always improve or worsen together in exactly the same way

    Correct answer
    A

    Improving one criterion can worsen another because the criteria can trade off

    Explanation

    Scheduling criteria can conflict: a change that improves one measure may negatively affect another, so the system must balance its goals.

  33. 33

    What is a likely effect of using a shorter time quantum in a time-sharing system?

    1. A

      Processes spend less time in the kernel, shortening turnaround time

    2. B

      Processes complete more work per context switch, improving throughput

    3. C

      Processes avoid returning to the ready queue after being interrupted

    4. D

      Processes receive opportunities to run sooner, improving perceived responsiveness

    Correct answer
    D

    Processes receive opportunities to run sooner, improving perceived responsiveness

    Explanation

    A shorter time quantum lets multiple processes make progress sooner, which can reduce users' perceived delays and improve response time.

  34. 34

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

    1. A

      It prevents the scheduler from selecting processes in the ready queue

    2. B

      It increases the number of CPU cycles required by each arithmetic operation

    3. C

      It causes more context switching, using more time for kernel work instead of useful work

    4. D

      It forces every process to wait for I/O after each instruction

    Correct answer
    C

    It causes more context switching, using more time for kernel work instead of useful work

    Explanation

    More frequent switching means more time spent in the kernel performing context switches, leaving less time for useful work and potentially increasing completion time.

  35. 35

    Which tradeoff best describes the effect of making the time quantum shorter?

    1. A

      Response time and throughput must improve, while turnaround time stays unchanged

    2. B

      Response time can worsen, while turnaround time and throughput can improve

    3. C

      Response time can improve, while turnaround time and throughput can worsen

    4. D

      Response time, turnaround time, and throughput must all improve together

    Correct answer
    C

    Response time can improve, while turnaround time and throughput can worsen

    Explanation

    A shorter quantum can make the system feel more responsive, but added context-switching overhead can worsen turnaround time and reduce throughput.

  36. 36

    Why might a system avoid making the time quantum extremely short even if users value responsiveness?

    1. A

      An extremely short quantum eliminates all scheduling decisions

    2. B

      A short quantum prevents the system from using timer hardware for preemption

    3. C

      Excessive context switching can waste resources and reduce the amount of useful work completed

    4. D

      A short quantum guarantees that every process waits longer for its first response

    Correct answer
    C

    Excessive context switching can waste resources and reduce the amount of useful work completed

    Explanation

    The system must balance user-facing responsiveness against efficient resource use. Very short quanta can increase context-switching overhead and reduce useful work.

  37. 37

    Which measure is identified as a primary basis for evaluating scheduling algorithms in the discussion?

    1. A

      Number of processes in the waiting state

    2. B

      Maximum CPU burst length

    3. C

      Average waiting time

    4. D

      Average number of instructions per context switch

    Correct answer
    C

    Average waiting time

    Explanation

    The discussion identifies average waiting time as the main criterion for evaluating the scheduling algorithms considered.

Question 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