Article View: comp.sys.powerpc
Article #3074Re: Debate: PowerMac "trounces" Pentium....???
From: Kenneth Jason Fair
Date: Wed, 07 Feb 1996 02:55
Date: Wed, 07 Feb 1996 02:55
72 lines
3656 bytes
3656 bytes
In article <kevinbDMCMIy.B26@netcom.com>, kevin@frobozz.sccsi.com (Kevin
Brown) wrote:
>In article <nevin-0302960411460001@150.135.1.79>,
>Nevin ":-]" Liber <nevin@CS.Arizona.EDU> wrote:
>>In article <19960201.11A2980.E21F@olympus.net>, dons@olympus.net (Don
>>Schmelling) wrote:
>>
>>> And once again, I must ask the question, but how are you runing more than
>>> one program at once in a cooperative multitasking system, while a program
>>> like that one is being run.
>>
>>If I ever have an occasion to run a brain-dead program like void
>>main(void) { for (;;); }, I'll let you know. It isn't a very interesting
>>question to me, since it just doesn't come up in Real Life. If you wish
>>to pay me to test brain dead programs on a Mac, I'd be more than happy to
>>oblige.
>
>Fine. Then try running a "brain-dead" program like this instead:
>
> main()
> {
> while ( there_is_useful_work_to_be_done )
> {
> do_the_computationally_intensive_useful_work();
> }
> display_the_results();
> }
>
>where there_is_useful_work_to_be_done remains true for long periods of
>time (minutes, hours, perhaps even days).
>
>Such a program could be an image renderer (e.g., the type used to
>produce "Toy Story") or a finite element analysis program, or any
>number of useful things.
And this is, in fact, how the typical Mac program operates. In general:
main()
{
InitOSStuff();
InitYourProgram();
while ( there_is_useful_work_to_be_done )
{
WaitNextEvent(parms);
switch (event)
/* handle the various types of events, keypresses, etc. */
do_the_computationally_intensive_work();
}
CleanUpProgram():
}
Again, the only real difference is that you should throw a WaitNextEvent
in so that your program checks to see if the user has called for a context
switch. You don't have to make your program recognize any events. You can
even make your program background only if you want. This takes ten minutes
to figure out. It's probably one of the three or four things I learned
first about programming the Mac. And I'm not even a good programmer.
Cooperative multitasking IS still multitasking, even with rogue programs
that won't release the CPU. They're just not COOPERATING. That's why
it's called *cooperative* multitasking. True, PM doesn't require cooperation
on the part of the programs. Yes, that does make things a bit more
flexible. But it's just not a big problem 99.9% of the time.
--
KEN FAIR - U. Chicago Law | Power Mac! | Net since '90 | Net.cop
kjfair@midway.uchicago.edu | CABAL(tm) Member | I'm w/in McQ - R U?
** Fuck the Communications Decency Act of 1996. **
Why does George Carlin determine the seven words I cannot say?
Technical Details
Message-ID:
<kjfair-0602962055530001@ngrh-34.rh.uchicago.edu>Path:
arc1-ca.pugleaf.net!ngrh-34.rh.uchicago.edu!userReferences:
<4csn1n$klb@macshack.com> <jragosta-2601961539320001 <19960201.11A2980.E21F@olympus.net> <nevin-0302960411460001@150.135.1.79> <kevinbDMCMIy.B26@netcom.com>Show Full Headers
Complete Article Headers
Newsgroups: comp.sys.powerpc,comp.os.linux.advocacy,comp.sys.mac.advocacy,comp.os.os2.advocacy,comp.sys.amiga.advocacy,comp.sys.intel Path: arc1-ca.pugleaf.net!ngrh-34.rh.uchicago.edu!user From: kjfair@midway.uchicago.edu (Kenneth Jason Fair) Subject: Re: Debate: PowerMac "trounces" Pentium....??? X-Nntp-Posting-Host: ngrh-34.rh.uchicago.edu X-Kook-Number-2: 5 Message-ID: <kjfair-0602962055530001@ngrh-34.rh.uchicago.edu> X-Kook-Code-2: (Grubor++)*2 Boursy+ Sender: news@midway.uchicago.edu (News Administrator) Organization: University of Chicago School of Law X-Newsreader: Yet Another NewsWatcher 2.1.8 References: <4csn1n$klb@macshack.com> <jragosta-2601961539320001 <19960201.11A2980.E21F@olympus.net> <nevin-0302960411460001@150.135.1.79> <kevinbDMCMIy.B26@netcom.com> Date: Wed, 7 Feb 1996 02:55:53 GMT