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

Re: 6502 Multitasking OS announce



Ralph Mason (ralph.mason@liffe.com) wrote:
: You have sorta missed what I was meaning here.  Sure you can map code
: around here and there - but if many processes are going to use the
: same routines the routienes better not use any global data.  These
: routine should use the stack for any working data. I guess you use no
: absolute jumps :-)

I do use absolute jumps. With an MMU, each task has its own kind of 
virtual machine. you can jump anywhere you want.
Without MMU, only tasks that use different memory locations -
in the zeropage, other RAM and program address space - can coexist.


: what about a eor ?  

: you pass in the critial section as the adress and eor that adress with
: say 1

: if

: wait:
: 	cmp addr,0
: 	beq get
: 	call scheduler yeild function
: 	jmp wait
: get: 
: 	eor addr,1
: 	jz wait

: ..you should have the critical section here

This version doesn't work. If the task gets interrupted between the 
cmp and the eor, another task can eor the address and enter the critical
region. After the first task gets back, it eor's the address again, 
making it zero again and then having free entry to the critical region.
Boom.

But then, as many have pointed out, the 6502 has some test&set like
operations, i.e. the 'shift' and the 'inc/dec'  operations. One
can surely build semaphores with them too.

But in my OS, all possible blocks are done with the scheduler that
puts the task to sleep instead of letting it spinlock, wasting CPU time.
And interrupt routines should never block - so they can only call
save - i.e. with SEI protected - routines.

Andre
 
--
fachat@physik.tu-chemnitz.de | Andre Fachat,        Phone: ++49-371-531-3551
-----------------------------| Vettersstr. 72/622,  09126 Chemnitz,  Germany
Distribution via the         |---------------------------------------------- 
Microsoft Network prohibited!| Unix was invented prior to user-friendlyness!