Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!ut-sally!husc6!bloom-beacon!gatech!rutgers!ames!lll-tis!ptsfa!hoptoad!academ!uhnix1!nuchat!sugar!karl From: karl@sugar.UUCP (Karl Lehenbauer) Newsgroups: comp.sys.amiga Subject: A proposed solution to the resource tracking problem Message-ID: <636@sugar.UUCP> Date: Fri, 4-Sep-87 17:43:43 EDT Article-I.D.: sugar.636 Posted: Fri Sep 4 17:43:43 1987 Date-Received: Wed, 9-Sep-87 05:38:43 EDT Organization: Sugar Land UNIX - Houston, TX Lines: 71 The question often comes up on the net, "How can I kill my Amiga tasks?" or more often, "Why can't I kill my Amiga tasks?". The problem, of course, is resource tracking, or more specifically the lack of support for it under AmigaDOS. We've been told that there would be too much overhead to implement this. I think most of us tend to discount that as we end up having to write equivalent (and tricky) code in each of our programs anyway. There is a case to be made for the former position, though, as the existing OS routines (memory alloc, etc.) are quite speedy and it would undeniably increase overhead to add resource tracking. Anyway, I think any solution should be compatible with existing code (as much as possible possible), easy to use and would be most likely to succeed if it didn't require changing the operating system. Peter da Silva (sugar!peter) and I were quite surprised recently when we found out that Mac windows all behave in a manner that is analogous to the Amiga's simple refresh windows. What that means is that every time your program's window gets resized or has something moved from in front of it, it has to redraw part or all of the window. This makes even "Hello, world" type programs hard to write. The Maccians get around this by using libraries as a front-end to the toobox calls to provide some enhanced capabilities that aren't present in the toolbox itself. We should do that, too. The memory allocation problem can be solved by using AllocRemember (Thanks, Peter, for showing me this). Library routines would front-end calls to create message ports and such. The library routines would keep track of what things need to be cleaned up on termination and how to do the cleanup in addition to making the system calls to perform the specified operations. The _main (for C people) startup code would set up to receive a software interrupt on the various control keys. The interrupt would call the code that cleans everything up. All a programmer would have to do to use this is to link from the new resource-tracking library. It is even possible for the routines in this new library to have the same names as their non-resource- tracking counterparts. The existing names, after all, are just the names of assembly routines that call an offset to A6 after playing with the stack and registers. You give those routines new names and call them, via their new names, from the new resource tracking routines that bear the original names. If one were to do the same for RemTask, one wouldn't need to explicitly call any special resource tracking code at all! (Peter came up with this part. I think it'll work.) Yes, it is stinky that the resource tracking code will have to be linked into every program that makes use of it rather than just being part of the OS. It mightn't neccessarily increase the size of programs a whole lot, though, as it could be implemented as a shared, reentrant, dynamically-loaded library like the ones in LIBS:. --- Now I'd like to end my posting, which I hope has provided a positive and technical contribution to this newsgroup, with a remark that postings about the inappropriateness of other postings, please-don't- post-about-this postings, postings about the danger to the net posed by all the garbage postings and so on consume net bandwidth too, and often create the destructive meta discussions warned about in the netnews new user docs. Flaming, also, increases net bandwidth, as few people are going to be willing to undergo a thorough, public charcoaling without making some sort of public reply. For most people, to not do so feels like tacit surrender to the flamer, with additional scorching caused by the provocative language that characterizes such flames. -- ...!soma!uhnix1!sugar!karl "Life is wasted on the living." - Z.B. IV