1. Home
  2. Explore
  3. Computer Science
  4. Process Scheduling

Study methods

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

Process Scheduling

  • 58Unfamiliar
  • 0Learning
  • 0Familiar
  • 0Mastered
Topic: Scheduling Foundations

What does scheduling mean in general, and how does assigning a class to a classroom illustrate it?

58 questions

  1. 1

    What does scheduling mean in general, and how does assigning a class to a classroom illustrate it?

    Model answer

    Scheduling assigns a resource to someone who needs it at a particular time. A class schedule assigns students to a classroom at a specified time.

    Explanation

    The example shows that scheduling coordinates who uses a resource and when.

  2. 2

    What is process scheduling, and what is another name for it?

    Model answer

    Process scheduling assigns a process to the CPU at a particular time. It is also called CPU scheduling.

    Explanation

    The CPU is the resource to which the operating system assigns processes.

  3. 3

    Why is process scheduling necessary when a computer has many processes but a limited number of CPUs?

    Model answer

    Many processes may be waiting in the ready queue, but only a limited number can use the CPUs at once. The operating system must choose which process or processes run and when.

    Explanation

    Scheduling coordinates access to scarce CPU resources.

  4. 4

    Why is responsiveness important in a system such as a mail server?

    Model answer

    Users expect a prompt response to requests, such as opening or retrieving mail. Long delays frustrate users, so scheduling should give processes timely access to the CPU.

    Explanation

    The server may have many users and processes competing for a limited number of CPUs.

  5. 5

    How does a scheduler help ensure that processes waiting for the CPU eventually get a chance to run?

    Model answer

    It selects processes from the ready queue and assigns them CPU time. A scheduling policy should avoid letting some processes wait indefinitely while others repeatedly run.

    Explanation

    Preventing indefinite waiting is important for fair access and avoiding starvation.

  6. 6

    Why can a program that only performs computation be unusual in practice?

    Model answer

    Most programs perform both computation and input/output. Even a simple program that prints a message computes the message and then writes it to a console.

    Explanation

    The example illustrates that computation and I/O commonly occur within the same program.

  7. 7

    What is the usual pattern of activity as a program executes?

    Model answer

    A program typically alternates between CPU bursts and I/O bursts.

    Explanation

    A program may compute, request I/O, compute again, and then request further I/O.

  8. 8

    What are a CPU burst and an I/O burst?

    Model answer

    A CPU burst is a period of computation using the CPU; an I/O burst is a period in which the program performs or waits for input/output activity.

    Explanation

    These bursts describe the alternating phases of program execution.

  9. 9

    Do CPU bursts and I/O bursts have to be the same length?

    Model answer

    No. Their lengths can differ, and I/O bursts often take much longer than CPU bursts.

    Explanation

    I/O devices are generally slower than the CPU.

  10. 10

    Why can the CPU perform other work while a process is carrying out I/O?

    Model answer

    During I/O, the transfer is generally handled between the device and memory, often using direct memory access, so the CPU is not needed for that transfer.

    Explanation

    The CPU can be idle with respect to the process performing I/O and can instead run another process.

  11. 11

    What inefficiency occurs when a single process alternates between CPU work and I/O?

    Model answer

    The CPU is idle while that process performs I/O, and the I/O device is idle while the process uses the CPU.

    Explanation

    With only one process, the CPU and device do not make productive use of one another’s idle periods.

  12. 12

    How can scheduling two processes improve CPU and I/O device utilization?

    Model answer

    When one process is doing I/O, the CPU can run another process; when that second process requests I/O, the first may be ready to use the CPU again. This overlaps computation and I/O.

    Explanation

    Overlapping the bursts lets multiple jobs make progress during one another’s idle periods.

  13. 13

    What is the degree of multiprogramming?

    Model answer

    It is the maximum number of processes admitted into or executing in the system at the same time, including processes in different states such as running, ready, waiting, or suspended.

    Explanation

    Processes need not all be using the CPU simultaneously to count toward the degree of multiprogramming.

  14. 14

    If a system has four CPUs, what is the maximum number of processes that can be running at the same instant, and how does this relate to the degree of multiprogramming?

    Model answer

    At most four processes can be running at once. The degree of multiprogramming can be higher because additional processes may be ready, waiting, or suspended.

    Explanation

    The number of running processes is limited by the number of CPUs, while the total number of processes in the system can include other states.

  15. 15

    What makes a job CPU-bound, and why is matrix multiplication an example?

    Model answer

    A CPU-bound job spends much of its time computing. Matrix multiplication involves on the order of n3n^3n3 operations while reading two n×nn \times nn×n matrices involves on the order of n2n^2n2 input elements.

    Explanation

    The example has substantially more computation than input operations as the matrix size grows.

  16. 16

    What makes a job I/O-bound, and why is matrix addition an example?

    Model answer

    An I/O-bound job spends a relatively large amount of time on input/output. Matrix addition performs on the order of n2n^2n2 additions and requires reading matrix elements, so I/O can be a significant part of its work.

    Explanation

    The content contrasts matrix addition with matrix multiplication and notes that I/O takes longer than computation.

  17. 17

    Why can scheduling a mixture of CPU-bound and I/O-bound jobs be beneficial?

    Model answer

    Their different burst patterns allow one job to use the CPU while another performs I/O. This can improve utilization of both the CPU and I/O devices.

    Explanation

    A job waiting for I/O need not leave the CPU idle if another job is ready to run.

  18. 18

    What are the distinct responsibilities of the scheduler and the dispatcher?

    Model answer

    The scheduler selects which process should run next. The dispatcher transfers control of the CPU to the selected process.

    Explanation

    Selection and the actual handoff to the CPU are separate tasks.

  19. 19

    What does a long-term scheduler manage, and what kind of work is it associated with?

    Model answer

    A long-term scheduler manages the admission or scheduling of jobs that can run for extended periods. It is associated with batch jobs, such as large simulations submitted for later completion.

    Explanation

    Batch work is not typically an interactive request that needs an immediate response.

  20. 20

    What is the medium-term scheduler in relation to the other scheduler types?

    Model answer

    It is an intermediate type of scheduler, positioned between the long-term and short-term schedulers.

    Explanation

    The content identifies it by its position between the other two types.

  21. 21

    What kinds of systems commonly rely on a short-term scheduler?

    Model answer

    Short-term scheduling is important in interactive and real-time systems, such as when a user expects a prompt result after an action on a mobile phone.

    Explanation

    These systems need to decide quickly which process should run next.

  22. 22

    How do the invocation rates of long-term and short-term schedulers differ?

    Model answer

    A long-term scheduler may be invoked every few seconds or minutes, whereas a short-term scheduler may be invoked every millisecond or tens of milliseconds.

    Explanation

    Short-term decisions are made much more frequently to manage immediate CPU access.

  23. 23

    Which process-state changes can a CPU scheduler make?

    Model answer

    It can move a process from running to waiting, running to ready, or waiting to ready, and it can terminate a process.

    Explanation

    These decisions respond to events such as requests for services, interrupts, completion of services, and process termination.

  24. 24

    Why might a running process move to the waiting state?

    Model answer

    It may request a service from the operating system, such as an I/O operation, and wait for that service to complete.

    Explanation

    The process cannot continue the requested work until the service is finished.

  25. 25

    Why might a running process move to the ready state without requesting a service?

    Model answer

    An external interrupt can cause the process to stop running and return to the ready state.

    Explanation

    The process is not necessarily blocked; it may simply need to wait for another opportunity to use the CPU.

  26. 26

    When can a waiting process move back to the ready state?

    Model answer

    It can move to the ready state when the service or system call it was waiting for has completed.

    Explanation

    The process is then able to compete for CPU time again.

  27. 27

    What are two reasons a process might be terminated?

    Model answer

    A process may finish its execution, or it may encounter an unrecoverable error such as division by zero.

    Explanation

    In either case, it cannot continue normal execution.

  28. 28

    What is non-preemptive scheduling?

    Model answer

    In non-preemptive scheduling, the operating system does not forcibly stop a running process; the process gives up the CPU voluntarily or completes its CPU burst.

    Explanation

    A process may relinquish the CPU by terminating or requesting I/O.

  29. 29

    What is preemptive scheduling?

    Model answer

    In preemptive scheduling, the operating system can forcibly stop a running process and take back the CPU.

    Explanation

    This lets the operating system assign CPU time to another process before the current one finishes its CPU burst.

  30. 30

    How can a trap return control to the operating system, and what are examples of events that may cause one?

    Model answer

    A trap is detected by hardware, which transfers control to an interrupt service routine in the operating system. Examples include division by zero, accessing a nonexistent page, writing to a read-only segment, or a stack overflow.

    Explanation

    The operating system can respond to the error and, if necessary, stop the process.

  31. 31

    Why is non-preemptive execution described as cooperative scheduling?

    Model answer

    The process must voluntarily give up the CPU, for example by requesting I/O or yielding after using the CPU. The operating system cannot forcibly stop it during execution.

    Explanation

    The process’s own action, rather than an operating-system decision to preempt it, returns control.

  32. 32

    How does a timer interrupt enable preemptive scheduling?

    Model answer

    The operating system programs a hardware timer; when the timer interrupt occurs, control transfers to the operating system, which can preempt the currently running process.

    Explanation

    The interrupt lets the operating system regain the CPU even when the running process has not voluntarily yielded.

  33. 33

    How can preemptive scheduling reduce starvation?

    Model answer

    It prevents one process from keeping the CPU indefinitely and allows the operating system to give other processes opportunities to run within a reasonable time.

    Explanation

    Preemption makes it possible to take the CPU away from a process that would otherwise monopolize it.

  34. 34

    What additional concerns can arise with preemptive scheduling?

    Model answer

    Preemption raises issues such as coordinating access to shared data and deciding whether one interrupt can interrupt another.

    Explanation

    Interrupting execution can affect how shared resources and interrupt handling are managed.

  35. 35

    What is the dispatcher responsible for doing after the scheduler selects a process?

    Model answer

    It takes the CPU from the current process, saves its information, loads the selected process’s information, and hands over CPU control.

    Explanation

    These operations perform the task or context switch between processes.

  36. 36

    What is dispatch latency?

    Model answer

    Dispatch latency is the time required for the dispatcher to stop one process and start another.

    Explanation

    It measures the delay involved in switching CPU execution between processes.

  37. 37

    Why must the dispatcher switch to user mode before giving control to a user program?

    Model answer

    The user program should execute with user-level privileges, not with the operating system’s more privileged kernel-level access.

    Explanation

    Giving control to the program before switching modes could let it run in kernel mode and create a security vulnerability.

  38. 38

    Why does the order of the dispatcher’s mode switch and handoff matter?

    Model answer

    The dispatcher must first switch from kernel mode to user mode and then give control to the user program. Reversing the order could allow the program to execute temporarily with kernel privileges.

    Explanation

    The sequence protects the boundary between operating-system privileges and user-program privileges.

  39. 39

    How are the scheduler and dispatcher associated with kernel execution?

    Model answer

    Scheduling and dispatching are operating-system activities performed at the kernel level; the dispatcher then switches to user mode before the user program runs.

    Explanation

    The dispatcher carries out the kernel’s selected scheduling decision while ensuring that user code runs in user mode.

  40. 40

    Which scheduler’s decision is most directly associated with an immediate dispatcher handoff?

    Model answer

    The short-term scheduler’s decision is most directly associated with an immediate handoff because it selects the next process to use the CPU.

    Explanation

    The dispatcher acts on the scheduler’s selection to begin or resume execution.

  41. 41

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

    Model answer

    CPU utilization measures how much of the time the CPU is being used; scheduling generally aims to maximize it.

    Explanation

    Keeping the CPU productively occupied is an important scheduling goal.

  42. 42

    What is throughput in process scheduling?

    Model answer

    Throughput is the number of processes that complete their execution per unit of time.

    Explanation

    It measures completed work rather than simply how busy the CPU is.

  43. 43

    Why can maximizing CPU utilization alone lead to starvation?

    Model answer

    A scheduler could keep one long-running process on the CPU to maintain high utilization while other processes wait indefinitely.

    Explanation

    Utilization does not by itself measure whether other processes are making progress.

  44. 44

    How can throughput complement CPU utilization when evaluating a schedule?

    Model answer

    Throughput shows how many processes finish, helping distinguish a schedule that completes work for multiple processes from one that keeps the CPU busy on only one process.

    Explanation

    Considering both measures can reveal problems that utilization alone would miss.

  45. 45

    What is turnaround time?

    Model answer

    Turnaround time is the total time from a process’s arrival until it finishes.

    Explanation

    It includes the process’s time in the system up to completion.

  46. 46

    What is waiting time in scheduling, and which queue is relevant to it?

    Model answer

    Waiting time is the time a process spends waiting in the ready queue for CPU access.

    Explanation

    Time spent waiting for an I/O device is not the scheduler’s ready-queue waiting time.

  47. 47

    What is response time, and how does it differ from turnaround time?

    Model answer

    Response time is the time from submitting a request until the first response is produced; it does not require the full output to be complete. Turnaround time measures the time until the process finishes.

    Explanation

    A quick initial acknowledgment can matter even when the requested work takes longer to finish.

  48. 48

    How is waiting time calculated for a non-preemptive process?

    Model answer

    Waiting time is start time−arrival time\text{start time} - \text{arrival time}start time−arrival time.

    Explanation

    In the described non-preemptive case, the process waits in the ready queue before starting and does not return to it during execution.

  49. 49

    How is total waiting time calculated for a preemptive process?

    Model answer

    Total waiting time is finish time−arrival time−CPU time\text{finish time} - \text{arrival time} - \text{CPU time}finish time−arrival time−CPU time.

    Explanation

    The process may return to the ready queue multiple times, so its total wait is not just the delay before its first start.

  50. 50

    How is turnaround time calculated?

    Model answer

    Turnaround time is finish time−arrival time\text{finish time} - \text{arrival time}finish time−arrival time.

    Explanation

    It spans the full interval from arrival to completion.

  51. 51

    What trade-off does the example of one 100100100-unit job and two 252525-unit jobs illustrate?

    Model answer

    Running only the long job can keep the CPU busy but complete just one process in the interval. Completing shorter jobs as well can increase throughput while still using the CPU.

    Explanation

    The example shows why CPU utilization should be considered alongside the number of completed processes.

  52. 52

    Which performance measures are generally maximized or minimized by scheduling algorithms?

    Model answer

    Scheduling generally aims to maximize CPU utilization and throughput while minimizing turnaround time, waiting time, and response time.

    Explanation

    These measures capture different aspects of resource use and process experience.

  53. 53

    Why should a scheduling algorithm minimize variation in its performance measures?

    Model answer

    Low variation makes performance more predictable. If delays vary widely, users cannot reliably anticipate how long their processes will take.

    Explanation

    Predictability helps users trust the system even when its performance is not always fast.

  54. 54

    How can a scheduling algorithm prioritize worst-case performance differently from average-case performance?

    Model answer

    An algorithm can be designed to limit how bad the worst case becomes, or it can deliver excellent average performance while allowing occasional poor cases.

    Explanation

    These approaches reflect different choices about which performance outcomes matter most.

  55. 55

    Why does the intended use of a system affect which scheduling criterion is most important?

    Model answer

    Different systems serve different needs: interactive and real-time systems value prompt responses, while batch workloads may prioritize throughput or the time until a job finishes.

    Explanation

    There is no single scheduling measure that is most appropriate for every system.

  56. 56

    Which scheduling measures are especially relevant to an interactive or real-time system?

    Model answer

    Response time is especially important because users or real-time tasks need a prompt initial response to a request.

    Explanation

    Waiting for the entire job to finish is different from receiving its first response.

  57. 57

    Which scheduling measure may matter most to someone submitting a batch simulation?

    Model answer

    Turnaround time may be especially important because the user wants to know how long it takes for the submitted job to finish.

    Explanation

    A batch user may care more about completion time than an immediate interactive response.

  58. 58

    How does each scheduling algorithm relate to the goals of scheduling?

    Model answer

    Each algorithm manages scheduling criteria differently, producing a different balance among utilization, throughput, waiting, turnaround, response time, and predictability.

    Explanation

    The chosen algorithm reflects which performance goals are being optimized.

1 of 58
Question 1 of 58

Ask anything

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

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent