|
> Please - don't tell me why reesource tracking is wonderful. Tell me how you
> do it without breaking the world.
>
> <mike
Well, how about providing some kind of tag that you associate with a resource
that marks it as PUBLIC or PRIVATE. PUBLIC stuff is untouched at resource
collection time, PRIVATE stuff is freed.
By taking PUBLIC as the default (ie state of all resources used in the
past 5 years) you don't break existing programs.
Of course the logistics of implementing the PUBLIC/PRIVATE tags can be a
nightmare - not unlike getting virtual memory support quitely slipped in.
john
P.S. resource tracking *can be* wonderfull.
|
| I agree that we don't want to break a large percentage of the software.
If someone wants resource tracking that badly they will be able to get UNIX.
Some people think that partial resource tracking is useless though and I
would tend to disagree. If there are some things which can be
done to make the system more reliable without significantly damaging
performance and compatibility, then I think would should pursue them.
One interesting thing which was suggested on usenet and I believe
someone from CBM liked (valentin?) was using the MMU to protect
"unallocated" memory. I think this is a pretty neat idea which would
catch a lot of buggy programs. I don't know if anyone ever wrote
a program to do this though I guess it probably would have to be CBM.
Unfortunately, without good resource tracking there isn't much you can
do when someone trounces a free memory location.
Providing mechanisms for new code to utilize would over time I think
allow programmers to use the protected mechanisms. I haven't heard
anyone say that this is NOT possible, but a number of people complain
they want all or nothing. As John suggests in .1 I think we could
make a gradual transition to a protected system. The drawbacks however
are that programs have to explicitly declare resources to be protected.
On most protected systems this is not the case, but so what! Declaring
removable resources explicitly is certainly no worse than the many, many
hacks on the PC and MAC for doing multitasking. We've already got one
up on those machines and they are leapfrogging over us with hardware
solutions (80486, etc).
Sorry for the long-windedness...
-steve
|
| Re .1 -
Well, there's the much-ignored MEMF_PUBLIC flag on memory allocations. Trouble
is, almost nobody uses it, and the system doesn't enforce it, so even those
who _try_ to use it don't know if they managed to get all the bugs out. Of
course, it was never explicitly documented as to what is/isn't required to
be tagged as public (e.g. - disk IO buffers?), so even if you got them all
"right", you may not have them right according to the system.
CBM has added a new flag - MEMF_VIRTUAL - but they aren't saying what its for.
Also, this only solves 1/2 the problems resource tracking lets you deal with -
protection. The other (and more important, in my view) is being able to
terminate a task and reclaim it's resources without it's cooperation.
Re .2 -
Resource tracking and protection are different, but related, things. CBM
has already made several tools available to developers that reports when you
write or read from memory that's not yours. Right now, all it does is spew
text out one of the hardware ports (serial or parallel). A version that used
the 2.0 software error requester (i.e. - suspend the process, or reboot)
would be reasonable to give to users. It would also mean you could catch
programs _before_ they trashed large parts of your system.
Going to a fully protected system (one where each task can only manipulate
that which belongs to it) has the same kinds of problems as doing full
resource tracking - you have to break sharing. I personally feel that a
mostly protected system (by default, you can't write on code, or touch
memory not allocated by some task) would be a major win, and would _not_
break anything.
Resource tracking, on the other hand, doesn't have a partial state. Either the
system correctly knows what is your process is "owns", or it doesn't. Full
protection requires resource tracking, but not vice versa. Getting resource
tracking means you have to deal with resource sharing.
While resource tracking is great, so is unresticted sharing. I want to know
if you can get both, or at least a reasonable facsimile of the latter with
the former.
<mike
|
| Re: .0
>Finally, and here's the real point, I can't see any way to add resource
>tracking without breaking the system as it now exists. More explicitly,
>it breaks the free-for-all resource sharing that has existed for the last
>five years.
I agree that it would be a disaster to make the current AmigaDOS system
calls do resource tracking. However, I don't see any reason not to add
a whole new set of functions to do resource tracking: If you call
OpenScreen() you get a non-tracked screen. If you call RTOpenScreen(),
you get a screen that is closed by the system if your task dies.
An observation: it isn't that there is no resource tracking on the Amiga;
it's just that all of the resource tracking is ad hoc. All of the well
written Amiga programs have their own method of doing resource tracking.
Popular methods are: use the standard C library, use the ARP library,
write your own exit() function, track everything with if statements.
The only thing that needs doing is to standardize how resource tracking
is done (so the system can deallocate the resources if the program
doesn't) and to hide the tracking so that programmers don't have
to worry with it.
For example, back in the days before the Lattice C debugger, I used
Metascope to debug my programs. If I stepped the program to the
bug and wanted the program to terminate early, I would just edit
the PC to point at exit() and continue the program. Exit() closed
all of the files and released memory, and I had a clean abort of the
task. When I was doing a lot of AmigaDOS magic, I could pull the
same trick by calling my cleanup routine that closed the windows,
screens, and libraries before calling exit().
There would be a lot of mileage in adding a longword to the Exec
task structure for a task abort function...
|