Saturday, December 30, 2017

How is the Scheduler Called?


How is the Scheduler Called?



__schedule() is the main scheduler function.
*
* The main means of driving the scheduler and thus entering this function are:
*
*   1. Explicit blocking: mutex, semaphore, waitqueue, etc.
*
*   2. TIF_NEED_RESCHED flag is checked on interrupt and userspace return
*      paths. For example, see arch/x86/entry_64.S.
*
*      To drive preemption between tasks, the scheduler sets the flag in timer
*      interrupt handler scheduler_tick().
*
*   3. Wakeups don't really cause entry into schedule(). They add a
*      task to the run-queue and that's it.
*
*      Now, if the new task added to the run-queue preempts the current
*      task, then the wakeup sets TIF_NEED_RESCHED and schedule() gets
*      called on the nearest possible occasion:



No comments:

Post a Comment

Featured Post

XDP - Getting Started with XDP (Linux)