pre-emptive Multi-tasking kernel for cog's added to large model
Bill Henning
Posts: 6,445
Check out page 3 of that thread. please comment there as that is the main thread; I only posted here so that people who may not care about large memory models but care about running several threads per cog will find it.
Comments
I think Propeller kicks even more ***... that's why I'm trying to help it!
Writing fast, large programs was a driving motivation behind coming up with this; and while I'm working too much right now to contribute code, I'd help out where I could.
·
on cog x do
endcogdef
stopcog x
startcog x
cogstat(x)
Pretty easy to weave into a standard basic program. Would have to sort out variable declarations. Global, local to cog, shared.
byte x
long y
byte shared z
start:
print @ [noparse][[/noparse]0,0] "begin of program"
[noparse][[/noparse]some init code ]
startcog 1
loop:
print @ [noparse][[/noparse]0,1] "Watching cog do it's thing"
if z = something important then stopcog 1 : goto done
goto loop
done:
stopcog 1
print @ [noparse][[/noparse]0,3] "Cog finished, moving on..."
[noparse][[/noparse]more code]
end
oncog 1 do:
byte a, b
cogloop:
[noparse][[/noparse]do something that affects z shared]
goto cogloop:
endcogdef
Post Edited (potatohead) : 11/12/2006 8:54:04 PM GMT
Like the COGxxx keywords in SPIN; and I'd suggest using the same names and syntax
Now I'd also want a few more primitives:
threadid = NEWTHREAD faddr,fstack
DELTHREAD thredid
SUSPENDTHREAD threadid
RESUMETHREAD threadid
So once a COG is started, it can start/stop threads on itself. I'm working on some system library routines to do this.
When I read that first little code snippet you posted Bill, everything about this chip changed. Very cool!