[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: 6502 Multitasking OS announce
In article <4j58eh$btc@saluki-news.wham.siu.edu> <agent@siu.edu> writes:
>How about this idea, to handle stacks? I read a similar thing in an
>issue of Dr. Dobbs Journal, in an article about a small multitasker.
>Given that the stack is mostly going to be used for minor parameter
>passing and jsr's. I think is a good assumption -- other data
>structures are better suited for larger jobs.
>Instead of copying the stack to and fro on every task switch, how about
>subdividing it? Each task would be allocated a portion of the stack. A
>task switch moves between the portions by adding or subtracting numbers
>from the stack register.
I guess, it will not work. The tasks cannot be executed independently. Only
the task on top of the stack will work without causing errors. Assume the
parameters of task 1 have been pushed to the top of the stack. The parameters
of task 2 are below of them. Now you try to execute task 2. Your stack
register will point to the bottom of the parameters of task 1. Pushing any
data to the stack will overwrite the parameters of task 1. Assume your
system decides to execute task 1 after executing task 2. Since the parameters
of task 1 are corrupted in this case, the system will crash.
Holger