1

The documentation for SCHED_DEADLINE states under point 4.4 that:

This behavior of sched_yield() allows the task to wake-up exactly at the beginning of the next period.

Does this mean that using sched_yield() in a SCHED_DEADLINE thread guarantees that the thread will wake up exactly at the start of the next period? Even when other SCHED_DEADLINE threads are present?

Claudio
  • 10,614
  • 4
  • 31
  • 71
Bjarke Freund-Hansen
  • 28,728
  • 25
  • 92
  • 135
  • Probably not since vanilla Linux doesn't provide realtime guarantees. – scai Aug 17 '17 at 07:02
  • @scai: The whole point of SCHED_{FIFO|RR|DEADLINE} is to provide realtime guarantees. SCHED_DEADLINE guarantees a certain amount of runtime each period before each deadline. Are you saying this does not work? Because in my experience it works perfectly even under heavy network/cpu/disk/etc. load, as it should do, because it was designed to do so. – Bjarke Freund-Hansen Aug 17 '17 at 07:10
  • The vanilla Linux kernel does not make realtime guarantees -- in other words, there is no guarantee that your thread will wake up within X microseconds/seconds/minutes of when it becomes schedulable. This is true regardless of the scheduling algorithm in use. Linux with the PREEMPT_RT patch set (and the correct settings) is capable of making guarantees. Typically the guarantee is that the highest priority task will wake up within X microseconds of becoming schedulable, where X is between 10 and 100 microseconds (depending on hardware and configuration). – crosstalk Aug 26 '17 at 05:08
  • In short: Neither the vanilla kernel nor the PREEMPT_RT patch set make the guarantee that the task will wake up *exactly* at the start of the next period. In both cases, the kernel will "try its best", and PREEMPT_RT-patched Linux is able to make some level of guarantee (whereas vanilla Linux does not). – crosstalk Aug 26 '17 at 05:13

1 Answers1

0

Yes, the scheduler will wake up the task exactly (based on the timing granularity, of course) at the start of the next period. However, the task will start executing only if it will have the earliest deadline among all ready SCHED_DEADLINE tasks. More precisely, it will be scheduled only once it gets among the m SCHED_DEADLINE tasks with the earliest absolute deadline, where 'm' is the number of CPUs in the scheduling domain.

Claudio
  • 10,614
  • 4
  • 31
  • 71