All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai-help] timeout in native API calls (cond, sem, mutex, etc).
@ 2005-10-20 16:20 Ignacio García Pérez
  2005-10-20 16:46 ` Jan Kiszka
  0 siblings, 1 reply; 19+ messages in thread
From: Ignacio García Pérez @ 2005-10-20 16:20 UTC (permalink / raw)
  To: xenomai

Hi,

While porting my application, I noticed that all synchronization
primitives locking calls take a relative timeout as a parameter, right?

Of course, I can get the current time, calculate the timeout interval by
substracting the current time from the desired timeout moment, and call
the function. But wouldn't something like this be possible?:

Suppose I want to wait on a semaphore until t=1000, and now=900.

1- I get current time (900).
2- I calculate the relative timeout as 1000-900 = 100
3- I call rt_sem_p(&mysem, 100);

In the best case, no preemption will occur between steps 1 and 3, but my
thread will still be sleeping not until t=1000, but until some time
later, t=1000+d, where d is the time used by the code in steps 1-3 and
into the native skin/nucleus.

In the worst case, in addition to that, the thread will be preempted
between steps 1 and 3. If it is preempted by another higher priority
thread for, say, 50 ticks, and the call in step 3 is actually executed
at t=950, the thread will be sleeping until t=1050+d, which may not be
acceptable.

What do you think?

Nacho.






^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2005-10-21 18:55 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-10-20 16:20 [Xenomai-help] timeout in native API calls (cond, sem, mutex, etc) Ignacio García Pérez
2005-10-20 16:46 ` Jan Kiszka
2005-10-20 17:09   ` Ignacio García Pérez
2005-10-20 17:33     ` Jan Kiszka
2005-10-20 18:18       ` Philippe Gerum
2005-10-20 18:16     ` Philippe Gerum
2005-10-21  7:20       ` Ignacio García Pérez
2005-10-21 10:29         ` Philippe Gerum
2005-10-21 12:02           ` Ignacio García Pérez
2005-10-21 10:51         ` Ignacio García Pérez
2005-10-21 12:23           ` Jan Kiszka
2005-10-21 14:46             ` Ignacio García Pérez
2005-10-21 16:45             ` Philippe Gerum
2005-10-21 16:39           ` Philippe Gerum
2005-10-21 18:55             ` Ignacio García Pérez
2005-10-21 10:52         ` Ignacio García Pérez
2005-10-21 12:16           ` Jan Kiszka
2005-10-21 14:40             ` Ignacio García Pérez
2005-10-21 16:42           ` Philippe Gerum

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.