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

Re: 6502 Multitasking OS announce



fachat@physik.tu-chemnitz.de (Andre Fachat) wrote:
  
>To share code between processes, you need not put the parameter on the
>stack. The shell, e.g. is in the ROM. The same program can run several 
>times in different tasks without any problem. This works because
>the used RAM is mapped to different pages for different tasks. 
>You can also load an executable into some RAM and let two tasks share this
>RAM. As long as they don't write to it, there's no problem. For writing
>they use the task specific RAM.

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 :-)


>reentrant routines - well, the kernel is in some respect reentrant.
>internal kernel routines call other kernel routines via the same 
>interface as other 'user' routines as well. The kernel entry/exit gates 
>detect this and do not change the memory mapping. 
>Devices, that have their own memory mapping and that are called via
>the DEVCMD interface call kernel routines. 
>But then only some routines are a kind of reentrant, esp. the STREAM routines.
>They disable Multitasking during their critical sections. The problem
>with the C64 is, that is doesn't have atomic test&set operations. So all
>task switches have to be disabled to test a semaphore, or when you enter
>a critical region.


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


-Ralph Maosn