[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Coroutines and Go
- From: steve donovan <steve.j.donovan@...>
- Date: Thu, 12 Nov 2009 13:16:54 +0200
http://golang.org/doc/go_lang_faq.html
A most interesting paragraph:
[[
Goroutines are part of making concurrency easy to use. The idea, which
has been around for a while, is to multiplex independently executing
functions—coroutines, really—onto a set of threads. When a coroutine
blocks, such as by calling a blocking system call, the run-time
automatically moves other coroutines on the same operating system
thread to a different, runnable thread so they won't be blocked. The
programmer sees none of this, which is the point. The result, which we
call goroutines, can be very cheap: unless they spend a lot of time in
long-running system calls, they cost little more than the memory for
the stack.
]]
We obviously don't need to be convinced about coroutines, but the idea
of moving blocked ones to another thread is intriguing.
steve d.