Preemptive and Non-Preemptive Scheduling

Neso Academy
25 Aug 201918:56

Summary

TLDRThis lecture delves into the concepts of pre-emptive and non-pre-emptive CPU scheduling, explaining that they are not algorithms but methods of CPU scheduling. It clarifies the roles of the CPU scheduler and dispatcher, introduces the concept of dispatch latency, and outlines four key circumstances under which CPU scheduling decisions occur. The lecture distinguishes between non-pre-emptive (cooperative) scheduling, where the CPU is only reassigned upon process termination or waiting, and pre-emptive scheduling, which allows for the CPU to be taken away even while a process is running, highlighting the importance of these concepts in operating systems.

Takeaways

  • 😀 Pre-emptive and non-pre-emptive scheduling are two methods of CPU scheduling, not specific algorithms.
  • 🔄 CPU scheduling involves decisions made by the CPU scheduler and dispatcher, where the scheduler selects a process and the dispatcher allocates the CPU to it.
  • 🕒 Dispatch latency is the time taken by the dispatcher to switch the CPU from one process to another, and minimizing it is crucial for efficient computation.
  • 🔄 CPU scheduling decisions can occur in four circumstances: a process switching to a waiting state, a process switching to a ready state due to an interrupt, a process switching from a waiting to a ready state after IO completion, and a process terminating.
  • ✅ In situations 1 and 4, there is no choice in CPU scheduling; a new process from the ready queue must be selected for execution.
  • ❓ In situations 2 and 3, there is a choice in CPU scheduling; the CPU can be given to the same process that was interrupted or waiting, or it can be given to a different process.
  • 🚫 Non-preemptive scheduling occurs when the CPU is only reassigned under circumstances 1 and 4, meaning the CPU is not forcibly taken away from a running process.
  • 🛑 Pre-emptive scheduling allows the CPU to be taken away from a running process even before it completes execution, under circumstances 2 and 3.
  • 🔄 The choice between pre-emptive and non-preemptive scheduling depends on the scenario; both have their advantages and are used in different operating systems.
  • 🔄 Pre-emptive scheduling can be necessary for high-priority processes, but it may lead to issues like inconsistent data when dealing with shared memory.
  • 📚 Understanding pre-emptive and non-preemptive scheduling is fundamental to studying CPU scheduling algorithms and related topics in operating systems.

Q & A

  • What are the two main types of CPU scheduling discussed in the lecture?

    -The two main types of CPU scheduling discussed are pre-emptive and non-pre-emptive scheduling.

  • What is the role of the CPU scheduler in the context of CPU scheduling?

    -The CPU scheduler is responsible for selecting a process from the ready queue to be executed when the CPU becomes idle.

  • What is the dispatcher in the context of CPU scheduling?

    -The dispatcher is the module that gives control of the CPU to the process selected by the CPU scheduler.

  • What is dispatch latency in CPU scheduling?

    -Dispatch latency is the time taken by the dispatcher to stop one process and start another, which is the time it takes to switch the CPU between two processes.

  • Under which circumstances can CPU scheduling decisions take place according to the lecture?

    -CPU scheduling decisions can take place under four circumstances: 1) when a process switches from running to waiting state, 2) when a process switches from running to ready state due to an interrupt, 3) when a process switches from waiting to ready state after IO completion, and 4) when a process terminates.

  • What is the difference between pre-emptive and non-pre-emptive scheduling in terms of when the CPU can be taken away from a process?

    -In non-pre-emptive scheduling, the CPU is not taken away from a process until it has either completed its execution or gone to a waiting state. In pre-emptive scheduling, the CPU can be taken away from a process even while it is running and given to another process.

  • Why is it said that non-pre-emptive scheduling is also known as cooperative scheduling?

    -Non-pre-emptive scheduling is called cooperative because a process is allowed to use the CPU until its execution is complete without being disturbed, indicating cooperation between processes.

  • What are the potential issues with pre-emptive scheduling when it comes to shared memory?

    -One potential issue with pre-emptive scheduling in shared memory scenarios is that if a process is preempted while writing to shared memory, another process might read inconsistent data from that memory region.

  • Why can't we say that one type of scheduling is universally better than the other?

    -We cannot say one type of scheduling is universally better than the other because different scenarios require different approaches. Pre-emptive scheduling may be necessary for high-priority processes, while non-pre-emptive scheduling can be beneficial when process interruption is not desirable.

  • What is the importance of understanding pre-emptive and non-pre-emptive scheduling in the study of operating systems?

    -Understanding pre-emptive and non-pre-emptive scheduling is important as it helps in the study of CPU scheduling algorithms and other related topics in operating systems, allowing for better system design and process management.

  • How does the lecture define the running state and waiting state of a process in the context of CPU scheduling?

    -The running state is when a process is currently using the CPU and undergoing execution. The waiting state is when a process is not making use of the CPU because it is waiting for IO operations or other events to complete.

Outlines

plate

Dieser Bereich ist nur für Premium-Benutzer verfügbar. Bitte führen Sie ein Upgrade durch, um auf diesen Abschnitt zuzugreifen.

Upgrade durchführen

Mindmap

plate

Dieser Bereich ist nur für Premium-Benutzer verfügbar. Bitte führen Sie ein Upgrade durch, um auf diesen Abschnitt zuzugreifen.

Upgrade durchführen

Keywords

plate

Dieser Bereich ist nur für Premium-Benutzer verfügbar. Bitte führen Sie ein Upgrade durch, um auf diesen Abschnitt zuzugreifen.

Upgrade durchführen

Highlights

plate

Dieser Bereich ist nur für Premium-Benutzer verfügbar. Bitte führen Sie ein Upgrade durch, um auf diesen Abschnitt zuzugreifen.

Upgrade durchführen

Transcripts

plate

Dieser Bereich ist nur für Premium-Benutzer verfügbar. Bitte führen Sie ein Upgrade durch, um auf diesen Abschnitt zuzugreifen.

Upgrade durchführen
Rate This

5.0 / 5 (0 votes)

Ähnliche Tags
CPU SchedulingPreemptiveNon-PreemptiveOperating SystemProcess StatesScheduling AlgorithmsProcess ManagementSystem EfficiencyInterrupt HandlingResource Allocation
Benötigen Sie eine Zusammenfassung auf Englisch?