Newsgroups: comp.sys.amiga.programmer
From: dnavas@oracle.uucp (David Navas)
Subject: Re: How to program multi-threaded programs on Amiga ?
Organization: Oracle Corporation, Redwood Shores CA
Date: Fri, 13 Nov 1992 23:24:58 GMT
X-Disclaimer: This message was written by an unauthenticated user
              at Oracle Corporation.  The opinions expressed are those
              of the user and not necessarily those of Oracle.

In article <1992Nov12.195317.19859@csus.edu> wittb@nextnet.csus.edu (brian witt) writes:
>Message ports don't have a buffer limit.  Because there is no memory
>protection and Exec lists have no upper limit, you can exhaust all
>memory with messages attached to a message port.

Last I heard, Intuition actually pre-allocates a set number of messages
per UserPort (or something like that).  I believe if it runs out that it
continually allocates more.  I believe that this is a one way process,
however, in that these extra messages aren't actually deleted (until the
UserPort goes away).

Perhaps this is what is being referred to?

>However, I realize you probably also want some sort of low proiorty/
>high priorty scheme to handle the mouse and to handle screen updating.
>You may want to try this (but you may be flamed).
[description of perfectly reasonable setup deleted]

Or you can use SHADOW V and run your methods synchronously/asynchronously
across as many processes at as many priorities as you like.

SHADOW V will be available at a local ftp site near you as soon as I can
coax netcom to stay alive long enough to transfer the 260k (compressed)
file....  [Don't worry, the library is 27k or something like that, it's
the 500k of Docs that come with it....]

The WEB Data Acq. and Analysis program (plug plug) runs its GUI at a higher
priority than all of the data-handling processes in just such a manner,
and certainly once I get a reasonable GUI up and running, things like
Auto-Layout will run at some low-priority....

>	Open libraries and such first off.

Problem -- CBM doesn't want you to share library bases anymore :(

>	At exit time, send the low priorty process a kill message.
>	Then loop with a sleep() call until some global varaible is
>	set to indicate OK to die.

SHADOW will cleanup your subprocesses automatically for you if you just
use the AddAutoResource() call....
It will also handle all the method dispatching automagically (although
not the IntuiMessage translation to method dispatch, obviously -- you'll have
to rewrite the METH_PROC_HANDLER method for that).

>may need some semphores in the case where the normal priority process

Wanna wait for a condition?  SHADOW has conditional-variable semaphores.
And bazillion other kinds of semaphores.  They're slower than Exec's, though :(
Amazing how the speed of Exec semaphores doubled when I started using
SAS/C V6 ;)

>'concurrency' and 'deadlock avoidance' -- knew ya could.)

Yes, well, you obviously still have to deal with this.

>other programs are running a little slower... (maybe)
>(Windows/NT at the Fall 1991 Comdex did something like this.)

Windows/NT running its programs slower?  Nah  :)

>>>I also want to use more than one (two, three..) processes for other things.
>>>It would be nice to be able to edit one text while you process another :-)

You can have a method-dispatch create a new process for each invocation, or
redirect each method into an arbitrary process, etc. etc.
[where arbitrary process == SHADOW process, of course! :)]

>My knowledge goes up to ADOS 1.3 as I still have (and am typing on) an
>Amiga 1000  !!!!!!!!!!

Brian is being very modest here.
He was a VERY good source of information while I was writing SHADOW, so
herein -- a salute!

>PS:  I'm looking for an Amiga 1000 ethernet adapter and a 68020 with MMU
>     and memory plug-in (used OK).

Pay $1100 for an A3000 and get an ethernet adapter for that :)
David C. Navas						dnavas@oracle.com
Working for, but not speaking on behalf of, Oracle Corp.