TIB: Re: Multitasking


[Prev][Next][Index][Thread]

TIB: Re: Multitasking





>> sure we can.  l've already made a program for the TI-86 that will halt one
>> program,  run another one, and then return to the last one and restore
>> variables A-J.
>
>The key word is HALT. It's not multitasking if one of them is halted.
>But who would need a real multitask anyway? Nobody needs back-
>ground operation. This, if it works, would satisfy the original question.
How can two programs run on the same processor at the same time? They 
can't, unless you have a parallel processing. Off the top of my head 
there are two types of multitasking: cooperative and preemptive. 
Cooperative is where the programs yield to others so they get a chance to 
run. Preemptive is where the kernel sets up an interrupt so that every 
once and a while a program's (yielding or not) control of the processor 
is ripped away and the kernel gives another program the chance to run. A 
real life example is the Mac OS is both. Programs running on a Mac are 
engaged in cooperative multitasking, while the OS has preemptive tasks, 
such as the cursor, device managers and the likes.

So all multitasking I know of (except parallel processing) is done by 
halting a programs execution. Background printing is halted and continued 
if done right before the printer's buffer runs out of data to print. 
Sound on a multitasking system will play until the buffer runs out if the 
program that is playing the sound is not called long enough.

Virtually all cooperative and preemptive multitasking OS can be brought 
to their knees by a well constructed or poorly constructed program, as 
the case might be. Yes, NT's preemptive multitasking can be render 
useless by a simple program, it eats all of the processor time giving no 
time to anything else (halts the system). Search the news groups if you 
doubt this.
> 
>  To sum up on the multitasking discussion:
> 
>  Doing true multitasking in TI-BASIC is proveably impossible.
>  Yes, you could do a function that saves important variables, but you
>  cannot break from the middle of a Tetris game to do physics and then
>  expect to return to the exact point you stopped. You simply do not have
>  the interrupt option. This could be put into the program but not
>  efficiently. The program would have to ask constantly if you want to
>  interrupt, and nothing else would ever happen.
Not true. I have written a cooperative multitasking OS in TI-BASIC. The 
main problem is switching folders which takes up a considerable amount of 
time if you want instruction by instruction code. However, I can get a 
couple of counters and drawing programs moving at an okay clip. To play 
tetris you would need to convert the program into a list of strings 
(mostly time, little skill needed). After a program is written all one 
needs is set a priority to the program and the game runs at an almost 
normal speed.

If anyone wants a copy of the os/kernel let me know <mikev@iserv.net>
>  Thus, multitasking will not be done in TI-BASIC.
>  Good points and ideas have come up, people have discussed them in a
>  constructive manner, and they might be useful in other contexts.
>  However, the cold, hard fact remains that we can't do cost-efficient
>  (pseudo-)multitasking using TI-BASIC alone.

If you can dream it, someone can program it,


Michael Van Der Kolk
mikev@iserv.net
http://www.iserv.net/~mikev


Follow-Ups: