comp.lang.ada
 help / color / mirror / Atom feed
From: James Rogers <jimmaureenrogers@worldnet.att.net>
Subject: Re: Unix-daemons in Ada
Date: Sun, 01 Jul 2001 14:07:36 GMT
Date: 2001-07-01T14:07:36+00:00	[thread overview]
Message-ID: <3B3F2F39.50BAF3CF@worldnet.att.net> (raw)
In-Reply-To: 87sngg3jp8.fsf@520075220525-0001.dialin.t-online.de

This is much easier using tasks in Ada. In the Ada task there will be
no forking. Instead, a task will be created to handle the work.

You have several options in your task design. You can dynamically
create (and destroy) tasks as you need them, or you can create a pool
of tasks that get used over and over. The task pool approach is 
more complicated to manage, but limits the amount of memory
required for your program. The dynamic creation approach is easier
to manage, but expands memory usage in an uncontrolled manner.

Using the dynamic task approach you would do the following:

1) Declare a task type that perfoms your "real work"
2) Have the main process create an instance of the task type
   as needed for the service.
3) Pass necessary data to the task instance through an entry
   call.
At this point the task will do its work, and the main procedure
can loop back to monitoring its inputs so that it can start
another task as needed.

Jim Rogers
Colorado Springs, Colorado USA

Stefan Nobis wrote:
> 
> Hi.
> 
> I'm learning Ada and i tried to write a simple Unix daemon in Ada (a very
> simple web server). I want the main process, which is attached to a tty, to
> exit, something like
> 
> if (fork()) exit 0;
> else do_real_work();
> 
> in C. I played a little bit with Adas Tasks, but i have no clue how to
> implement the above in Ada.
> 
> --
> Until the next mail...,
> Stefan.



  reply	other threads:[~2001-07-01 14:07 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-07-01 12:41 Unix-daemons in Ada Stefan Nobis
2001-07-01 14:07 ` James Rogers [this message]
2001-07-01 14:35   ` Stefan Nobis
2001-07-01 17:20     ` James Rogers
2001-07-03 20:48       ` Stefan Skoglund
2001-07-03 22:39         ` Larry Kilgallen
2001-07-06 14:15           ` Tarjei T. Jensen
2001-07-06 17:05             ` Larry Kilgallen
2001-07-06 22:33               ` Tarjei Tj�stheim Jensen
2001-07-13  7:51                 ` Maxim Reznik
2001-07-01 19:51 ` Florian Weimer
2001-07-01 21:47 ` David C. Hoos, Sr.
2001-07-02 19:18   ` Stefan Nobis
2001-07-02 20:16     ` David C. Hoos
replies disabled

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