PDA

View Full Version : pre-emptive Multi-tasking kernel for cog's added to large model



Bill Henning
11-11-2006, 04:27 PM
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.

M. K. Borri
11-12-2006, 10:21 AM
You, sir, kick an unholy amount of ***.

Bill Henning
11-12-2006, 01:36 PM
Thank you. (blush)

I think Propeller kicks even more ***... that's why I'm trying to help it!

M. K. Borri
11-12-2006, 01:44 PM
I don't think I can be of a lot of help, so far the only decent thing I wrote that isn't application-dependent is that math library. I still can't grok Propeller asm too well. However, I had a lot of people ask me if it's feasible to program a Prop in Basic, would that be worthwhile?

Bill Henning
11-12-2006, 01:46 PM
I'd LOVE to see someone write a large model basic compiler for the Propeller!!!

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.

potatohead
11-13-2006, 02:16 AM
The addition of a few BASIC keywords to manage COG's would make the multi-processing element of the prop very accessable.

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 @ [0,0] "begin of program"
[some init code ]
startcog 1

loop:
print @ [0,1] "Watching cog do it's thing"
if z = something important then stopcog 1 : goto done
goto loop

done:
stopcog 1
print @ [0,3] "Cog finished, moving on..."
[more code]
end

oncog 1 do:
byte a, b
cogloop:
[do something that affects z shared]
goto cogloop:
endcogdef

Post Edited (potatohead) : 11/12/2006 8:54:04 PM GMT

Bill Henning
11-13-2006, 02:36 AM
Agreed!

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.

potatohead
11-13-2006, 02:59 AM
Agreed likewise. I like the idea of keeping our existing syntax definitions where possible.

When I read that first little code snippet you posted Bill, everything about this chip changed. Very cool!