dloop
dloop

Reputation: 21

Is there a way to align the periods of two processes using SCHED_DEADLINE on Linux?

I have a process that needs to interact with hardware at very tightly controlled periods. I have a second process that can start at any time and needs to interact with the first process without affecting the first process' timing. I'm using SCHED_DEADLINE to control the period on both processes. Is there a way to get the second process to align its period with the first process?

I know I can synchronize communication using semaphores. This is not what I'm talking about.

Consider the scenario:

  1. piece of hard requires communication every 1ms (+- 10000 ns).
  2. Process 1 is running with a period of 1ms under SCHED_DEADLINE
  3. Process 2 starts and is also running with a period of 1ms under SCHED_DEADLINE, but is offset from process 1 by 0.5 ms.
  4. Process 1 wakes up but must wait 0.5 ms for process 2 to be ready to communicate.

Therefore, on the first time step the 2 processes try to communicate, the timing for contacting the hardware is thrown off by 0.5ms. IF the periods of the 2 processes were synchronized then this problem would not happen.

For those interested, the hardware in this case is EtherCAT based and using a Distributed Clock (DC). The 1 time step jitter would desynchronize the DC, forcing the DC to re-synchronize. The re-sync time is about 7 seconds. I really want to avoid that time penalty since a person will be interacting with the system and regular 7s delays are unacceptable.

I have tried using semaphores to set the task scheduler up on the second process at a specifically synchronized time with the first process. This did not get the periods of the tasks synchronized close enough.

Upvotes: 0

Views: 27

Answers (0)

Related Questions