comp.lang.ada
 help / color / mirror / Atom feed
From: "Warren W. Gay VE3WWG" <ve3wwg@cogeco.ca>
Subject: Re: terminate applications
Date: Thu, 24 Jul 2003 10:46:46 -0400
Date: 2003-07-24T10:46:46-04:00	[thread overview]
Message-ID: <HoSTa.8061$tJ4.468936@read1.cgocable.net> (raw)
In-Reply-To: vhu27v687nsdc8@corp.supernews.com

"Randy Brukardt" <randy@rrsoftware.com> wrote in message news:vhu27v687nsdc8@corp.supernews.com...
> "Marin David Condic" <nobody@noplace.com> wrote in message
> news:3F1E7E1E.8090302@noplace.com...
> > What's wrong with the nothion of having a "Standard Ada Library" that
> > provides all these sorts of utilities? Why shouldn't it be done in a
> > Standard Ada Way instead of a Standard C Way? Why shouldn't Ada aim at
> > providing every capability you find in other languages - and then some -
> > in order to be the One-Stop Shopping source for the developer?
>
> I would be extremely opposed to any standard "library" functions which
> allowed you to end-run finalization. Indeed, I'd be extremely opposed to
> *anything* standard that allowed you to end-run finalization.
>
> Finalization is the key to building maintainable abstractions, and we simply
> cannot allow cases in which that finalization does not happen. You might
> say, "well, the program is going away anyway. Why do we care if the heap is
> consistent?" Of course, we don't care of the heap is consistent. But we do
> care that resources that the operating system either does not know about, or
> does not recover for some reason, are returned.
>
> One odd example is that calling the Win32 Exit_Process on some Windows
> systems can leave open files permanently locked until the next reboot. If
> the file is something important (say the body of Text_IO), it can leave your
> computer unusable.
>
> A more realistic example is interrupt handlers on Windows 95/98. If you
> install a handler on those systems, you had better remove if before the
> program exits. Otherwise, the system will crash the next time that interrupt
> is triggered.

One of the reasons that kill -9 exists under UNIX is because of
"finalization" type activities that can hang a process. What I mean
is that you can sometimes kill a process, and then watch it hang as
it performs C atexit() processing. After a hang of this type,
you then only have two choices:

  1. Leave it alone (ignore it)
  2. Pull out the kill -9 with extreme prejudice

However, kill -9 can have nasty effects under UNIX. For example, under
SCO UNIX, I have seen tape device drivers get hung this way for a
tape backup. This renders that tape device unusable until the next
reboot, since there are no external ways to unravel the problem.

Likewise, your example of a win32 process leaving the system unstable. I
would maintain that the win32 kernel should take care of disconnecting
the interrupt handler, but even that may not be enough (a null or
invalid interrupt handler may still leave the system unstable)

Consequently I think there are two sides to termination:

 - for some apps, you don't want finalization (kill -9 approach)
 - for others, it will be always/sometimes necessary

It really comes down to the nature of the application and the design
choices made. The criticality of the application is of course, another
factor in the choice.

> The Win32 documentation for Exit_Process suggests that it should not be
> called, because it could leave the OS in an inconsistent state. I don't
> think we want to make it easier to do things that ought to be avoided in the
> first place.

Personally, I believe many of the instances of this problem are due to
M$ laziness in getting things right. Sure, there will be some cases that
are unsolvable (perhaps device driver issues). UNIX kernels are much more
meticulous about what they clean up after a process exit, including
semaphores if the SEM_UNDO features are exploited, IMHO.

> As a vendor, I do not want to be forced, by the inclusion of a poorly
> defined "Halt" function (which would be very confusing to our users, as we
> already have a safe-ish "Halt" function), to eliminate all finalization from
> our run-time, and especially, to be forced to eliminate useful functionality
> from the run-time. The Janus/Ada Halt runs all finalization before exists,
> similarly to Aborting the environment task. But then there doesn't seem to
> be much benefit to having it at all. (We needed it in Ada 83 because you
> couldn't abort the environment task - it had no name.)

To solve MDC's problem, and all that is needed is a sufficiently rounded
GPLed Halt package, that applies to popular platforms. That leaves the
vendors off of the hook, leaves it out of the standards process, and gives
the users the empowerment to do as they please. This package need be
nothing more than a very small binding. Or perhaps a GNAT.Halt
package ;-)

> If your program hangs when you abort the environment task, it has a bug.
> That bug should be fixed, because it probably can occur on a normal exit as
> well. (And if it is a bug in your compiler, you should report it and they
> ought to fix it.)

I would generally agree with this, but it may turn out that the bug is
in the O/S handling of the event- in which case, a bigger hammer might
be required.

Warren.
-- 
Warren W. Gay VE3WWG
http://home.cogeco.ca/~ve3wwg





  parent reply	other threads:[~2003-07-24 14:46 UTC|newest]

Thread overview: 75+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-18  9:36 terminate applications christoph.grein
2003-07-18 10:54 ` Jeffrey Creem
2003-07-18 11:51   ` Marin David Condic
2003-07-18 13:26     ` Nick Roberts
2003-07-18 15:18     ` Jeffrey Creem
2003-07-19 15:44       ` Marin David Condic
2003-07-20  2:03         ` Robert I. Eachus
2003-07-20 11:04           ` Marin David Condic
2003-07-20 17:53             ` Robert I. Eachus
2003-07-21 12:02               ` Marin David Condic
2003-07-21 20:31                 ` Robert I. Eachus
2003-07-22 12:11                   ` Marin David Condic
2003-07-22 12:26                     ` Arnaud Charlet
2003-07-22 12:36                       ` Marin David Condic
2003-07-22 13:23                         ` Arnaud Charlet
2003-07-22 23:23                           ` Marin David Condic
2003-07-22 23:46                             ` Samuel Tardieu
2003-07-23 12:22                               ` Marin David Condic
2003-07-23 22:17                                 ` Randy Brukardt
2003-07-24  1:47                                   ` Hyman Rosen
2003-07-24  3:36                                     ` tmoran
2003-07-24  3:44                                       ` Hyman Rosen
2003-07-24  8:02                                         ` Samuel Tardieu
2003-07-24 19:54                                         ` Randy Brukardt
2003-07-24  7:45                                     ` Dmitry A. Kazakov
2003-07-24 14:54                                       ` Warren W. Gay VE3WWG
2003-07-24 15:46                                         ` Dmitry A. Kazakov
2003-07-26  2:58                                           ` Warren W. Gay VE3WWG
2003-07-28  8:17                                             ` Dmitry A. Kazakov
2003-07-28 21:08                                               ` Warren W. Gay VE3WWG
2003-07-29 10:42                                                 ` Marin David Condic
2003-07-29 13:47                                                   ` Hyman Rosen
2003-07-29 17:04                                                     ` Warren W. Gay VE3WWG
2003-07-24 12:01                                     ` Marin David Condic
2003-07-24 20:12                                     ` Randy Brukardt
2003-07-24 23:11                                       ` Robert I. Eachus
2003-07-26 12:52                                         ` Marin David Condic
2003-07-26  3:28                                       ` Warren W. Gay VE3WWG
2003-07-24 11:51                                   ` Marin David Condic
2003-07-24 20:32                                     ` Randy Brukardt
2003-07-26  3:16                                       ` Warren W. Gay VE3WWG
2003-07-26 13:16                                         ` Marin David Condic
2003-07-26 15:23                                           ` Nick Roberts
2003-07-26 15:48                                             ` Warren W. Gay VE3WWG
2003-07-27 11:36                                             ` Marin David Condic
2003-07-26 19:52                                           ` rleif
2003-07-26 13:01                                       ` Marin David Condic
2003-07-24 14:46                                   ` Warren W. Gay VE3WWG [this message]
2003-07-24 18:50                                     ` tmoran
2003-07-26 13:21                                       ` Marin David Condic
2003-07-23  4:02                             ` Robert I. Eachus
2003-07-23 12:28                               ` Marin David Condic
2003-07-24 16:06                                 ` Robert I. Eachus
2003-07-26 13:33                         ` Larry Kilgallen
     [not found]                         ` <Pine.LNX.4.44.0307221518190.26977-10000Organization: LJK Software <$TwrUBtoh25l@eisner.encompasserve.org>
2003-07-26 15:07                           ` Warren W. Gay VE3WWG
2003-07-27 11:43                           ` Marin David Condic
2003-07-26 17:27                         ` Larry Kilgallen
     [not found]                         ` <Pine.LNX.4.44.0307221518190.26977-10000Organization: LJK Software <etldVqgp8sE1@eisner.encompasserve.org>
2003-07-26 20:18                           ` Warren W. Gay VE3WWG
2003-07-26 20:24                         ` Larry Kilgallen
     [not found]                         ` <Pine.LNX.4.44.0307221518190.26977-10000Organization: LJK Software <q5jLYypXp6Yg@eisner.encompasserve.org>
2003-07-27 21:52                           ` Warren W. Gay VE3WWG
2003-07-28  2:45                         ` Larry Kilgallen
2003-08-01 17:00                           ` Warren W. Gay VE3WWG
2003-08-01 17:56                         ` Larry Kilgallen
2003-08-01 18:17                           ` Warren W. Gay VE3WWG
2003-08-01 18:48                         ` Larry Kilgallen
2003-07-22 12:59                       ` Lutz Donnerhacke
2003-07-22  5:16                 ` Randy Brukardt
2003-07-22 12:02                   ` Marin David Condic
2003-07-22 14:45                     ` Nick Roberts
2003-07-23  1:08 ` Dave Thompson
  -- strict thread matches above, loose matches on Subject: below --
2003-07-17 10:39 Riccardo
2003-07-17 19:54 ` Nick Roberts
2003-07-17 20:55   ` Mark A. Biggar
2003-07-17 22:44     ` Nick Roberts
2003-07-18  3:55 ` sk
replies disabled

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