[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: RE: cooperative multitasking
- From: "Jeff Petkau" <jeffp@...>
- Date: Fri, 7 Jun 2002 11:58:41 -0700
> Hmm, just out of curiosity, does anyone know how portable code like that
> could be? I've seen "fibers" used on x86/Linux and Windows, but what
> about the other popular processors? (*Arm, *Sparc, PPC, etc.). My
> stuff being geared mainly for games, portability to things like the
> Gameboy Advance or PS2 or other game consoles would be nifty, too.
Fibers work on pretty much any architecture; the requirements are
the same as for setjmp()/longjmp() in C, which everyone supports.
But on game consoles I think the stack space requirements really
rule fibers out, since each fiber requires its own C stack.
Coroutines at the scripting level are much more memory efficient.
Also, I haven't looked at the Lua implementation, but I had
assumed they were also more runtime efficient. In Stackless
Python, switching to a coroutine is much faster than a function
call, since the frame is already allocated and set up. I had
hoped this was true in Lua also.