首页 > 试题广场 >

The Linux scheduler implements

[问答题]

The Linux scheduler implements soft real-time scheduling.What features are missing that are necessary for some real-time programming tasks?How might they be added to the kernel?

推荐

Answer:Linux's"soft"real-time scheduling provides ordering guarantees concerning the priorities of runnable processes:real-time processes will always be given a higher priority by the scheduler than normal time-sharing processes,and a real-time process will never be interrupted by another process with a lower real-time priority.However,the Linux kernel does not support"hard"real-time functionality.That is,when a process is executing a kernel service routine, that routine will always execute to completion unless it yields control back to the scheduler either explicitly or implicitly(by waiting for some asynchronous event).There is no support for preemptive scheduling of kernel-mode processes.As a result,any kernel system call that runs for a significant amount of time without rescheduling will block execution of any real-time processes. Many real-time applications require such hard real-time scheduling.In particular,they often require guaranteed worst-case response times to external events.To achieve these guarantees,and to give user-mode real time processes a true higher priority than kernel-mode lower-priority processes,it is necessary to find a way to avoid having to wait for low-priority kernel calls to complete before scheduling a real-time process.For example,if a device driver generates an interrupt that wakes up a high-priority real-time process,then the kernel needs to be able to schedule that process as soon as possible,even if some other process is already executing in kernel mode. Such preemptive rescheduling of kernel-mode routines comes at a cost.If the kernel cannot rely on non-preemption to ensure atomic updates of shared data structures,then reads of or updates to those structures must be protected by some other,finer-granularity locking mechanism.

This fine-grained locking of kernel resources is the main requirement for provision of tight scheduling guarantees.Many other kernel features could be added to support real-time pro-

gramming.Deadline-based scheduling could be achieved by making modifications to the scheduler.Prioritization of IO operations could be implemented in the block-device IO request layer.

发表于 2018-05-05 21:04:45 回复(0)