comp.lang.ada
 help / color / mirror / Atom feed
From: Paul Duquennoy <paul.duquennoy@wanadoo.fr>
Subject: Re: Looking for implementation idea
Date: 1999/02/07
Date: 1999-02-07T00:00:00+00:00	[thread overview]
Message-ID: <36BDBCCC.5576F570@wanadoo.fr> (raw)
In-Reply-To: 36BD749B.DA735DB7@umundum.vol.at



Thomas Handler wrote:

> Hi everybody!
>
> I'm trying to migrate a bundle of applications to Ada95 (running GNAT
> and Intel-Linux).
> The problem I'm suffering from at the moment is that most of the apps
> are heavy I/O bounded and the first one I'm gonna touch has to control
> typically around 100 devices via serial ports and about 40-50 socket
> connections.
> <snip description>

I did something like that few years ago. I designed one dispatcher task that
did OS_select to get the available data and wad responsible to get full
messages (i.e.handle one buffer per socket where the message bytes where
stored until a full message was obtained). It then had a rendez-vous with a
task from a task array whose index was the socket number. These tasks were
generating one answer for each message, so the dispatcher task, which was
also in charge of the writes, could know if some work was in progress in the
software by the difference between input message count and output message
count. If work was in progress, the OS_select was with a null time-out and a
delay was used. If no work was in progress, the OS_select could use an
appropriate time-out.

    loop
       if Pending_Write_Count > 0 then
         select
            accept write_message (...)
                -- doing the "write" requested and decrement pending write
count
            Event.Wait;
         or
            delay (xx);
          end select;
          -- OS_Select with null time-out
          -- do reads and dispatch if full messages are got, increment
pending write count
        else
           -- OS_Select with time-out
           -- do reads and dispatch if full messages are got, increment
pending write count
        end if;
      end loop;



This method works well if it is possible for the dispatcher task to know
wether to use a time-out (blocking the program) or a delay (leaving the other
tasks work). Also, a new message from a socket could not be received before
the answer of the previous message was written. Otherwise, incomming messages
need to be inserted in a socket-specific queue.

I hope it helps.

> Thomas Handler

Paul





  reply	other threads:[~1999-02-07  0:00 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-02-07  0:00 Looking for implementation idea Thomas Handler
1999-02-07  0:00 ` Paul Duquennoy [this message]
1999-02-08  0:00   ` Thomas Handler
1999-02-07  0:00 ` Niklas Holsti
1999-02-08  0:00   ` Thomas Handler
1999-02-09  0:00     ` Niklas Holsti
1999-02-10  0:00       ` Thomas Handler
1999-02-07  0:00 ` Corey Minyard
1999-02-07  0:00   ` Larry Kilgallen
1999-02-08  0:00     ` dewar
1999-02-08  0:00       ` dennison
1999-02-08  0:00         ` robert_dewar
1999-02-07  0:00   ` Tucker Taft
1999-02-07  0:00     ` Corey Minyard
1999-02-08  0:00       ` robert_dewar
1999-02-08  0:00       ` Tucker Taft
1999-02-07  0:00         ` Corey Minyard
1999-02-08  0:00     ` dennison
1999-02-08  0:00       ` Tucker Taft
1999-02-09  0:00         ` robert_dewar
1999-02-11  0:00           ` Ehud Lamm
1999-02-08  0:00       ` robert_dewar
1999-02-07  0:00   ` Tom Moran
1999-02-07  0:00     ` Corey Minyard
1999-02-08  0:00   ` Thomas Handler
replies disabled

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