lua-users home
lua-l archive

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

At a risk of repeating what previous posters wrote (I'm sorry, it's
too early in the morning for me to understand "less 'no
non-preemptive' guarantees" :P), from what I know:
goroutines are partially similar to coroutines, especially in that
they tend to veer on the "cooperative" side of the fence (e.g. an
empty loop is uncooperative); however, they can be executed in
parallel over a pool of threads (where the count of threads is
~implementation-defined, but see also GOMAXPROCS). And it's true that
"there are some clear points of control transfer" (although
personally, I didn't yet care enough to investigate if they are really
so clearly defined in the spec) - meaning that at these points a
goroutine can be paused and some other one chosen to execute on a
particular thread.

Hope this helps should you still have some doubts.

Regarding channels, I'm not sure what would you like to know. I think
their basic ideas are already described pretty extensively on in all the tutorials and faqs.

Mateusz Czapliński

On Thu, Mar 24, 2011 at 4:05 AM, Dimiter "malkia" Stanev
<> wrote:
> Hi Tang,
> From
> "A goroutine has a simple model: it is a function executing in parallel with
> other goroutines in the same address space"
> lua coroutines are not executed in parallel, but cooperative (hence the co-
> prefix)
> My understanding is that go communicates through explicit channels, lua
> through implicit yield, but this is probably not entirely correct. I myself
> am go and lua newbie.
> Thanks,
> Dimiter "malkia" Stanev
> On 3/23/2011 7:50 PM, Tang Daogang wrote:
>> Dear all,
>> Recently I am reading some introductions on go language, find that it
>> has a new concept: goroutine.
>> Anybody knows the differences between lua coroutine and golang
>> goroutine, and further 'channel'?
>> BR.
>> --
>> Nothing is impossible.