comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Structure of the multitasking server
Date: Sun, 21 Sep 2008 21:24:55 +0200
Date: 2008-09-21T21:24:57+02:00	[thread overview]
Message-ID: <11dyqk0lqb1je.ap31n7jjew7l.dlg@40tude.net> (raw)
In-Reply-To: 259e95c5-92e6-4200-bc6e-5f35d99336a9@l64g2000hse.googlegroups.com

On Sun, 21 Sep 2008 10:30:37 -0700 (PDT), Maciej Sobczak wrote:

> On 19 Wrz, 19:02, "Dmitry A. Kazakov" <mail...@dmitry-kazakov.de>
> wrote:
> 
>> Note that task termination is usually a difficult problem in Ada. You
>> should pay an attention to this early.
> 
> No problem with that. With separate protected object (instead of
> rendezvous) it is enough to do this:

Of course there is a problem because conditional and timed entry calls may
not contain a "terminate" alternative. This is another reason why a
protected object might be a poor choice. But the way you used protected
object looks like a design noise. Technically you just replaced a
rendezvous queue with a protected entry queue. Instead of just server and
workers, you have server, workers, channels and management stuff. Very
OO-ish in the negative sense of this word.

The second problem which adds complexity is server to worker 1-n
communication. Should be n-1 worker to server, simpler (classic
client-server) and more efficient too.

Due to complexity you have overlooked to make a channel idle again after a
job is done. You also have overlooked to add a "Shut_Down" state in order
to finalize workers: four channel states instead of just none. And note,
that the type Channel cannot call to the procedure Finish to set Shut_Down
from its Finalize (if it were controlled). That is because Worker is a
component of. The thing will hang up on channel destruction. 

> There is no need to introduce any special type of job ("poison pill").

Job carries the parameters of a worker. You used it too, under the name
Job_Type.

> Above, the job space is not polluted with task lifetime management
> concepts - these should be kept separate.

You have polluted it with the procedure Finish, that has to be called
outside the worker tasks.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



  reply	other threads:[~2008-09-21 19:24 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-19 12:21 Structure of the multitasking server Maciej Sobczak
2008-09-19 13:34 ` Jean-Pierre Rosen
2008-09-19 17:02   ` Dmitry A. Kazakov
2008-09-21 17:30     ` Maciej Sobczak
2008-09-21 19:24       ` Dmitry A. Kazakov [this message]
2008-09-21 21:27         ` Maciej Sobczak
2008-09-22  8:12           ` Dmitry A. Kazakov
2008-09-22 12:47             ` Maciej Sobczak
2008-09-22 14:11               ` Dmitry A. Kazakov
2008-09-23  8:07                 ` Maciej Sobczak
2008-09-23  9:37                   ` Dmitry A. Kazakov
2008-09-23 10:47                   ` Jean-Pierre Rosen
2008-09-21 17:23   ` Maciej Sobczak
2008-09-22  8:23     ` Jean-Pierre Rosen
2015-03-12 16:07   ` gautier_niouzes
2015-03-12 21:38     ` Jacob Sparre Andersen
2015-03-12 22:39       ` gautier_niouzes
2015-03-13  8:15         ` Dmitry A. Kazakov
2015-03-13 20:16           ` gautier_niouzes
2015-03-13 20:47             ` Dmitry A. Kazakov
2015-03-15  7:43               ` gautier_niouzes
2015-03-15  8:35                 ` Simon Wright
2015-03-15  8:52                 ` J-P. Rosen
2015-03-15  9:21                   ` Jacob Sparre Andersen
2015-03-15 16:04                     ` Brad Moore
2015-03-13 23:04             ` Randy Brukardt
2015-03-14  8:22               ` Simon Wright
2008-09-19 23:01 ` anon
2008-09-21 17:37   ` Maciej Sobczak
2008-09-22  2:32     ` anon
2008-09-22 13:05       ` Maciej Sobczak
2008-09-23  9:25         ` anon
replies disabled

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