[GAP] Periodic task
Tullio Vardanega
tullio.vardanega at math.unipd.it
Fri Sep 15 11:18:50 CEST 2006
There are two key issues that you have to mind here:
(1) that the absolute time on which your task wants to wait
starts from a "system-level" reference and, in case case of
a cyclic tasks, proceeds at the exact period from it
(2) that the activity you want the task to perform does fit
in the assigned period (we usually say C<T, where C is the
the task computation time and T is the task period).
If you have done (1), then the semantics of "delay until" on
a past time (when (2) was not true) is that the task continues
running bar preemption event (because invoking "delay until"
incurs a dispatching point).
Else you'll happily run at the desired frequency.
I attach some code templates that do the trick in case you cared
to look at them.
-- Tullio Vardanega
> Hello,
>
> I'm trying to write a periodic task. It has to send a UDP packet for
> every 10 ms time slice. But an obvious solution:
>
> declare
> Slice : Time_Span := Milliseconds (10);
> Slot : Time := Clock;
>
> ...
>
> loop
> -- send packet
> Send_Socket (Socket, Token, Last);
>
> -- wait until next slot time
> Slot := Slot + Slice;
> delay until Slot;
> end loop;
>
> doesn't work properly. Time period between sending packet is 7 - 20
> millisconds.
>
> How can I make a properly working periodic task?
>
> Regards,
> Daniel Lewandowski
>
>
> _______________________________________________
> GAP mailing list
> GAP at gnat.info
> /no-more-mailman.html
> To unsubscribe from this list, please contact the GAP GNAT Tracker administrator
> within your organization.
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TASKS.tgz
Type: application/x-compressed-tar
Size: 769 bytes
Desc: not available
Url : /pipermail/gap/attachments/20060915/63572129/TASKS.bin
More information about the GAP
mailing list