Path: utzoo!attcan!uunet!cbmvax!andy From: andy@cbmvax.UUCP (Andy Finkel) Newsgroups: comp.sys.amiga.tech Subject: Re: Could somebody tell me ... Message-ID: <5519@cbmvax.UUCP> Date: 16 Dec 88 18:10:46 GMT References: <8812151937.AA17954@postgres.Berkeley.EDU> Reply-To: andy@cbmvax.UUCP (Andy Finkel) Organization: Commodore Technology, West Chester, PA Lines: 48 In article <8812151937.AA17954@postgres.Berkeley.EDU> dillon@POSTGRES.BERKELEY.EDU (Matt Dillon) writes: > Now, who can figure out what I am talking about here? The idea is >for the initial call from main() to *create* a light weight process context Hmmm....sounds like coroutines >for the subroutine and to then allow main() to continue and call other >lwp's to create them. Thus, a direct call to task1() or task2() must return > startlwp() allocates a copy of the stack accessable to the subroutine. >Specifically, M+N bytes are allocated where M is the number of bytes already yup, we're talking coroutines here. > Not bad, eh? So, why would you want to do this when the amiga has >multitasking? Because this allows you to modularize your code without >the overhead of a task for each module! The context switch is much faster >than with real tasks. > > But the real reason is to get out of the main-loop driven standard >of programming (mac users are fond of quoting the fact that multitasking >does not avoid the need for a main-event-wait-loop). Here, one would > So, I need ideas on the waiting part (that waits for some even and >does the context switching). We need something that nicely complements >Wait(), but in the lwp sense. we call it cowait() You are well underway to reinventing coroutines, Matt :-) What are coroutines ? Well, they are pretty much as Matt is on the way to describing them...lightweight processes that operate synchroniously, using your stack. The Amiga file system uses them extensively. They are a pretty clever idea. They are also found in Workbench. I think Neil Katin was sufficiently impressed with the concept that he used that model of programming internal to Workbench. > -Matt -- andy finkel {uunet|rutgers|amiga}!cbmvax!andy Commodore-Amiga, Inc. "Possibly this is a new usage of the word 'compatible' with which I was previously unfamiliar" Any expressed opinions are mine; but feel free to share. I disclaim all responsibilities, all shapes, all sizes, all colors.