comp.lang.ada
 help / color / mirror / Atom feed
From: ohk@ultra.tfdt-o.nta.no (Ole-Hjalmar Kristensen FOU.TD/DELAB)
Subject: Re: Ada versus Java - Tasking
Date: 1997/01/19
Date: 1997-01-19T00:00:00+00:00	[thread overview]
Message-ID: <OHK.97Jan19133540@ultra.tfdt-o.nta.no> (raw)
In-Reply-To: 01bc03ee$594dc520$829d6482@joy.ericsson.se


In article <E48D1A.1sL@world.std.com> bobduff@world.std.com (Robert A Duff) writes:

   In article <OHK.97Jan18194202@ultra.tfdt-o.nta.no>,
   Ole-Hjalmar Kristensen FOU.TD/DELAB <ohk@ultra.tfdt-o.nta.no> wrote:
   >These task switching times are still pretty horrible though. Using
   >Unix processes and pipes or System V message queues, you can do just
   >as well. Any idea of why this is so? Does it follow from the
   >definition of an Ada task, or is it just this particular
   >implementation.

   No, it's not hard to make task switching fast, if you're willing to give
   up the idea that every Ada task should map onto exactly one OS
   task/thread.  But there are some advantages to that one-for-one mapping,
   despite the HUGE performance penalty.  E.g., when a task does a blocking
   system call, it's nice if some other task gets to run while it's
   waiting.  Making that happen is hard (but I don't think impossible!)
   unless each Ada task maps to an OS task (thread).  And if the OS threads
   are horribly slow (which is often the case), then tough luck.

   >With a task switching overhead of this magnitude, tasks become
   >unattractive as a way of programs dealing with high-speed IO, for
   >example.

   Indeed.

   - Bob

I think I would be willing to give up the idea that every Ada task
should map onto exactly one OS task/thread. In my (admittedly limited)
experince with POSIX threads, you are not able to get the same amount
of overlapping IO as by using explicit asynchronous read/write
calls. My tests have been limited to SunOS and HP-UX, but I suspect
most other thread implementations will give similar results. A POSIX
thread will be suspended if the device is not ready, ans as you say,
other threads may run while the suspended thread is waiting. However,
my tests indicate that while the (blocking) read/write call is
executed, the whole OS process is suspended. At least, if you have two
threads doing IO on separate devices, you will not get any overlap of
those IO operations. In other words, using a native thread package
does not automagically transform normal blocking read/write calls into
asynchronous calls, which I find quite reasonable.

At best, the native threads give very vague promises about the degree
of real concurrency, so if I have to choose, I would rather have fast
task switching and handle any blocking system calls myself.

The new protected types seem really promising, though.

Ole-Hj. Kristensen




  parent reply	other threads:[~1997-01-19  0:00 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-01-16  0:00 Ada versus Java - Tasking Jonas Nygren
1997-01-16  0:00 ` Brad Balfour
1997-01-25  0:00   ` Robert Dewar
1997-01-16  0:00 ` wiljan
1997-01-17  0:00 ` Steve Doiel
1997-01-17  0:00 ` Jeff Carter
1997-01-19  0:00   ` David Taylor
1997-01-20  0:00     ` Jim Hopper
1997-01-20  0:00       ` Michael Paus
1997-01-21  0:00         ` Jim Hopper
1997-01-21  0:00           ` Larry Kilgallen
1997-01-21  0:00             ` jim hopper
1997-01-21  0:00     ` Dr. John B. Matthews
1997-01-23  0:00     ` Jeff Carter
1997-01-18  0:00 ` Ole-Hjalmar Kristensen FOU.TD/DELAB
1997-01-19  0:00   ` Robert A Duff
1997-01-19  0:00 ` Tom Moran
1997-01-19  0:00 ` Ole-Hjalmar Kristensen FOU.TD/DELAB [this message]
1997-01-19  0:00   ` Larry Kilgallen
1997-01-20  0:00 ` Jon S Anthony
1997-01-20  0:00 ` Dale Pontius
1997-01-20  0:00 ` Ada Tasking revisited (was: Re: Ada versus Java - Tasking) Ole-Hjalmar Kristensen FOU.TD/DELAB
1997-01-20  0:00 ` Ada versus Java - Tasking Ole-Hjalmar Kristensen FOU.TD/DELAB
1997-01-21  0:00 ` Ole-Hjalmar Kristensen FOU.TD/DELAB
replies disabled

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