comp.lang.ada
 help / color / mirror / Atom feed
From: Brad Moore <brad.moore@shaw.ca>
Subject: Re: Barrier re-evaluation issue with GNAT 4.3.2
Date: Fri, 25 Sep 2009 13:39:48 -0600
Date: 2009-09-25T13:39:48-06:00	[thread overview]
Message-ID: <709vm.1523$3G7.161@newsfe03.iad> (raw)
In-Reply-To: <1m2k0pew7wla9$.1bml843g8z0in$.dlg@40tude.net>

Dmitry A. Kazakov wrote:
> This would mean that the hardware device encapsulated that task (e.g. HDD
> controller). I don't think this could be considered a realistic scenario.
> Hardware I/O on most platforms is too slow to be performed from a protected
> action. If you have an OS, it is 10-100 times slower, at least. Doing this
> within a protected action is not a good idea. One can imagine protected
> action as a being performed by a task with highest real-time priority.
> Without OS, considering low-level I/O, like DAQ boards, DMA access etc, the
> performance penalty might be even higher.

I was thinking more along the lines of changing the voltage of some 
output port on some device, or writing directly to the console buffer, 
rather than invoking some dialog with a HDD controller.
Depending on the device, it may be as simple as writing a single value 
to some memory address. Technically, this is a non-blocking scenario. It 
may (or may not) be slower than normal memory writes, but still 
satisfies RM 9.5.1(8). Just because it is protected, does not mean it 
cannot be preempted by a higher priority (e.g. interrupt) task. It wont 
cause deadlock. I think this is very much a realistic scenario.

> 
>> Timing_Events should handle a reasonable number of events in the system. 
>> If your application has millions of these firing all over the place, 
>> then scalability could become an issue, and perhaps for such a system, 
>> some alternate design would be more appropriate.
> 
> No, because these events need to be handled by somewhere. Million events
> handled by one task? That is the monitor task taking the shortest delay
> from a queue of. Million tasks will not work anyway.

I was agreeing with you that scalability could become an issue. 
Channeling everything through a single timer task (if that is how it is 
implemented) could introduce unacceptable latencies, if the number 
events grows too large.

>>> Timing_Events does not have any advantages over delay or asynchronous
>>> transfer of control. I guess it was provided for some low-level stuff like
>>> interrupts from hardware timers. However there was already a support for
>>> interrupts mapped into protected operations, so it really puzzles me why
>>> Timing_Events were added.
>> I see timing events as being potentially useful reusable concurrency 
>> component.
>> If you ever need something that looks like timing_events, then hopefully
>> it will save you from having to write your own. It may have utility in 
>> some areas such as discrete event simulation, for example, if you need 
>> something to coordinate multiple tasks and ensure that signalling events 
>> occur and run to completion before before signaling subsequent events.
> 
> This is IMO a different case, e.g. pulse events. Yes I have an
> implementation of pulse events. But I don't see why pulse events cannot be
> signaled from a scheduler task. The event source is unrelated to the way an
> event is handled. Basically Timing_Events saves you exactly one "scheduler"
> task, keeping in mind that the implementation of could deploy some hidden
> task (thread) anyway. It does not save you the worker task(s).
> 

Agreed, timing_events *is* basically a scheduler task. In my example, 
assuming Call_Police is not potentially blocking, and you try to rewrite
the example without having some type of a scheduler task, (whether it be
timing_events or your scheduler), then you may end up having to create 
some dedicated task to manage the timeout for the alarm. (Extra to the 
thread of control encapsulated by the hardware device) The scheduler 
model could be considered as being an improvement over this, but as 
system requirements can differ dramatically across different systems, YMMV.

Regards,
Brad



  reply	other threads:[~2009-09-25 19:39 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-24 17:02 Barrier re-evaluation issue with GNAT 4.3.2 Reto Buerki
2009-09-24 17:47 ` Dmitry A. Kazakov
2009-09-25  8:50   ` Brad Moore
2009-09-25  9:17     ` Dmitry A. Kazakov
2009-09-25  9:57       ` Ludovic Brenta
2009-09-25 10:31         ` Dmitry A. Kazakov
2009-09-25 11:23       ` Jean-Pierre Rosen
2009-09-28 10:41         ` Reto Buerki
2009-09-25 17:06       ` Brad Moore
2009-09-25 18:42         ` Dmitry A. Kazakov
2009-09-25 19:39           ` Brad Moore [this message]
2009-09-28 10:18   ` Reto Buerki
2009-09-25 15:56 ` John B. Matthews
2009-09-26 14:23   ` John B. Matthews
2009-09-28 10:28   ` Reto Buerki
2009-09-28 12:39     ` John B. Matthews
2009-09-28 13:25       ` Reto Buerki
2009-09-28 14:05         ` Reto Buerki
2009-09-28 18:38           ` Jeffrey R. Carter
2009-09-28 18:51             ` Dmitry A. Kazakov
2009-09-29  8:37               ` Reto Buerki
2009-09-28 21:13             ` Robert A Duff
2009-09-28 22:28               ` Jeffrey R. Carter
2009-10-10  5:41                 ` Randy Brukardt
2009-09-29  8:30             ` Reto Buerki
2009-09-29 15:06               ` John B. Matthews
2009-09-30 14:12                 ` Reto Buerki
2009-09-30 15:59                   ` John B. Matthews
2009-10-01 16:12                     ` John B. Matthews
2009-10-01 17:17                       ` Anh Vo
2009-10-02  2:26                         ` John B. Matthews
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox