Shop OBEX P1 Docs P2 Docs Learn Events
pre-emptive Multi-tasking kernel for cog's added to large model — Parallax Forums

pre-emptive Multi-tasking kernel for cog's added to large model

Bill HenningBill Henning Posts: 6,445
edited 2006-11-12 18:59 in Propeller 1
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

  • M. K. BorriM. K. Borri Posts: 279
    edited 2006-11-12 02:21
    You, sir, kick an unholy amount of ***.
  • Bill HenningBill Henning Posts: 6,445
    edited 2006-11-12 05:36
    Thank you. (blush)

    I think Propeller kicks even more ***... that's why I'm trying to help it!
  • M. K. BorriM. K. Borri Posts: 279
    edited 2006-11-12 05:44
    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 HenningBill Henning Posts: 6,445
    edited 2006-11-12 05:46
    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.
    ·
  • potatoheadpotatohead Posts: 10,254
    edited 2006-11-12 18:16
    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 @ [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
  • Bill HenningBill Henning Posts: 6,445
    edited 2006-11-12 18:36
    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.
  • potatoheadpotatohead Posts: 10,254
    edited 2006-11-12 18:59
    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!
Sign In or Register to comment.