lua-users home
lua-l archive

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


> Message: 2
>    Date: Sun, 22 Oct 2000 20:57:27 +0200
>    From: Edgar Toernig <froese@gmx.de>
> Subject: About coroutines and light threads
>

> There's one downside of this:  The coroutines will be optional
> because they can't be implemented in a portable way.  It requires
> a couple of lines of assembler code.  Currently supported are
> x86 Linux and FreeBSD.

Do you think it would be hard to port it to Win32? I just had a look at
coro.c and the assembler doesn't look too scary (I used to write assembler
x86 when I was a kid) and apart from that there is only a suspicious call to
mmap().


> Btw, Python was mentioned several times.  Don't only look at
> stackless Python.  There's also a Python-coro.  eGroups.com is
> completely written in it.  It uses the same C coroutine library
> that I'll take for Lua.

I will for sure. Thanks for the pointer.


>   And, they are _really_ easy to implement.  Unfortunately only
> in a system dependent way.  But, putting it into the standard
> C library would have increased its size by about 0.1%.  Seems,
> that was too much *ig*

At this point if dependency only means 12 lines of assembler and if
dependency means that without too much trouble I can port it to Arm or
another RISC (let's say DreamCast) then it's a dependency I can accept. I'll
investigate that.

Another comment (not from ET):

> The biggest problem with the coroutine (or setjmp) approach, is that
> you have to allocate a stakc per thread and have to find an
> apropriate size what will allow all threads to run without overflow
> yet be carefull not to overuse memory.

That is also an issue, beside system dependency, and I'll have to see what
this implies in practical terms.
I wish 4.0 was already out so I could check for reference Edgar's approach.
:)
--
WildHeart'2k - mailto:stf@apl.it
Homepage: http://come.to/wildheart/

<<<Tian xia wu nan shi, zhi pa you xin ren ---
   Nothing in the world is difficult for those who set their mind to it>>>