Scheduler
  • A kernel is preemptive if a process switch may occur while the replaced process is executing a kernel function, that is, while it runs in Kernel Mode.
  • The main characteristic of a preemptive kernel is that a process running in Kernel Mode can be replaced by another process while in the middle of a kernel function.
  • A preempted process is not suspended, because it remains in the TASK_RUNNING state.
  • planned process switch
  • forced process switch
  • dispatch latency
    • the delay between the time they become runnable and the time they actually begin running.
  • kernel preemption is disabled(preempt_count field is greater than zero)
    1. The kernel is executing an interrupt service routine.
      • Hardirq counter subfield
      • It specifies the number of nested interrupt handlers on the local CPU (the value is increased by irq_enter( ) and decreased by irq_exit( )).
    2. The deferrable functions are disabled (always true when the kernel is executing a softirq or tasklet).
      • Softirq counter subfield
      • It specifies how many levels deep the disabling of deferrable functions is (level 0 means that deferrable functions are enabled).
    3. The kernel preemption has been explicitly disabled by setting the preemption counter to a positive value.
      • Preemption counter subfield
  • kernel can be preempted only when(see preempt_schedule)
    • preempt_count field is zero
      • It is executing an exception handler (in particular a system call)
      • the kernel preemption has not been explicitly disabled.
    • The local CPU must have local interrupts enabled
  • the time preempty happen
    • preempt_enable, preempt_check_resched, preempt_schedule
    • preempt_schedule_irq
page_revision: 1, last_edited: 1239431865|%e %b %Y, %H:%M %Z (%O ago)
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License