🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.apple2.gno
Article #442

Re: Idea for improved user control of restart flag.

#442
From: Phillip Vandry
Date: Wed, 06 Jan 1993 02:05
60 lines
3157 bytes
jamesb@ecst.csuchico.edu (James L. Brookes) writes:

>I've noticed that, if I have a restartable program running in the
>background, and try to run the same application in the foreground, it will
>not restart.  No surprise, that's to be expected.  But, even after one
>execution, this copy of the app won't restart.  So, is it to be presumed
>that there can only be one copy of a given restartable application in memory
>at a time?  Is it possible, in a multiuser system, for someone (for example)
>on console to use a restartable program, then exit, and for another person
>not on console to use the copy in memory?

Oh, wait a minute. You bring up some interesting things here.

Let's say you start a second instance of a restartable program. Is it logical
to simply duplicate the existing copy rather than get it from disk? I think
not for two reasons. 1. You can't relocate it again. 2. [Explained below]

Also, if a process is kill(SIGKILL)ed, (or other "destructive" signal), it 
should never be restarted from memory. Here's why:

If I wrote a program that changes itself (or even changes a GS/OS parameter
block) then changes itself back (which I do often) I would make this program
restartable (assuming the rest of the program is restartable). Sure it assumes
that a certain address will contain a certain value, and that value gets 
changed later, but it gets changed right back, and unless the program exits
between the changing and the changing back, it's ok. The problem is that the
SIGKILL could easily occur between the two.

Example:

main      lda refnum
          sta readrec+2
          ReadGS readrec
          lda #500
          sta len
          ReadGS readrec
          lda #200
          sta len
          ...
readrec   dc  i'2'
          ds  2
          dc  a4'buffer'
len       dc  i4'200'
          ds  4

This fragment reads 700 bytes. The first read assumes that len will be set to
200. Unless the program exits while it is temporarily at 500, it will in fact
be at 200.

Yesterday I would have made this program restartable, but now I see that it is
not since the program could die while len is set to 500.

What is the solution?

>|          James Brookes            | Inet: bb252@cleveland.freenet.edu |
 ______________________________________________________________________
|~~~~~~~~~~~~~~~~|~~~~~~~~~~~~~~~~|~~~~~~~~~~~~~~~~|~~~~~~~~~~~~~~~~~~~|
| Phillip Vandry | Vandry@Cam.Org | II the future! | II 1993!          |
|________________|________________|________________|___________________|
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Technical Details
Message-ID: <C0Ettz.51o@CAM.ORG>
Path: arc1-ca.pugleaf.net!sparky!uunet!newsflash.concordia.ca!clyde.concordia.ca!altitude!vandry
References: <1ians2INNaur@charnel.ecst.csuchico.edu> <bazyar.726209355@teal> <1icpfiINNd21@charnel.ecst.csuchico.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!newsflash.concordia.ca!clyde.concordia.ca!altitude!vandry
From: vandry@CAM.ORG (Phillip Vandry)
Newsgroups: comp.sys.apple2.gno
Subject: Re: Idea for improved user control of restart flag.
Keywords: restartability
Message-ID: <C0Ettz.51o@CAM.ORG>
Date: 6 Jan 93 02:05:58 GMT
References: <1ians2INNaur@charnel.ecst.csuchico.edu> <bazyar.726209355@teal> <1icpfiINNd21@charnel.ecst.csuchico.edu>
Organization: Champlain Regional College, St-Lambert QC CANADA
Lines: 60