FAQ
Can I configure Go to switch goroutine only when calling system API?
The scenario is when a server handling a large number of connections while the business logic is
very simple (that is, IO-bound not CPU bound), the switching of goroutines is expensive, and also unnecessary.

So, is there a goroutine schedule schema in which one goroutine runs until it traps into kernel mode.

thanks
------------------
Sincerely yours
                          ZHOU Xiaobo

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

  • Dave Cheney at Jul 6, 2013 at 1:08 pm
    How did you decide that switching goroutines was causing a performance bottleneck. Please provide some profile data or a repeatable piece if sample code to support your position.
    On 06/07/2013, at 22:57, "ZHOU Xiaobo" wrote:

    Can I configure Go to switch goroutine only when calling system API?
    The scenario is when a server handling a large number of connections while the business logic is
    very simple (that is, IO-bound not CPU bound), the switching of goroutines is expensive, and also unnecessary.

    So, is there a goroutine schedule schema in which one goroutine runs until it traps into kernel mode.

    thanks
    ------------------
    Sincerely yours
    ZHOU Xiaobo

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Wang King at Jul 7, 2013 at 3:14 am
    you might hack the sys api you call by providing a wrap then call Gosched()
    after the real syscall?
    by the way gorouting switch is expensive?

    ref: http://www.sizeofvoid.net/goroutine-under-the-hood/


    在 2013年7月6日星期六UTC+8下午8时57分34秒,ZHOU Xiaobo写道:
    Can I configure Go to switch goroutine only when calling system API?
    The scenario is when a server handling a large number of connections while
    the business logic is
    very simple (that is, IO-bound not CPU bound), the switching of goroutines
    is expensive, and also unnecessary.

    So, is there a goroutine schedule schema in which one goroutine runs until
    it traps into kernel mode.

    thanks
    ------------------
    Sincerely yours
    ZHOU Xiaobo
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Dmitry Vyukov at Jul 16, 2013 at 7:55 pm

    On Sat, Jul 6, 2013 at 4:57 PM, ZHOU Xiaobo wrote:
    Can I configure Go to switch goroutine only when calling system API?
    The scenario is when a server handling a large number of connections while the business logic is
    very simple (that is, IO-bound not CPU bound), the switching of goroutines is expensive, and also unnecessary.

    So, is there a goroutine schedule schema in which one goroutine runs until it traps into kernel mode.
    The scheduler does not do unnecessary goroutines switches. I do not
    understand what you mean.

    How will it work if a goroutine blocks on a channel? Do you want the
    program to deadlock in this case?

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Robert Johnstone at Jul 16, 2013 at 8:03 pm
    The scheduler is currently cooperative. Therefore, you should only get
    switching when blocked (mutex, channel, etc.), making a syscall, or using
    CGO (can anyone confirm this last one?). Finally, if you are truly
    IO-bound, then switching is not costing you anything - you couldn't make
    use of those CPU cycles in any case.

    On Saturday, 6 July 2013 08:57:34 UTC-4, ZHOU Xiaobo wrote:

    Can I configure Go to switch goroutine only when calling system API?
    The scenario is when a server handling a large number of connections while
    the business logic is
    very simple (that is, IO-bound not CPU bound), the switching of goroutines
    is expensive, and also unnecessary.

    So, is there a goroutine schedule schema in which one goroutine runs until
    it traps into kernel mode.

    thanks
    ------------------
    Sincerely yours
    ZHOU Xiaobo
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Dmitry Vyukov at Jul 16, 2013 at 8:24 pm

    On Wed, Jul 17, 2013 at 12:03 AM, Robert Johnstone wrote:
    The scheduler is currently cooperative. Therefore, you should only get
    switching when blocked (mutex, channel, etc.), making a syscall, or using
    CGO (can anyone confirm this last one?
    Yes, this is true.
    ). Finally, if you are truly
    IO-bound, then switching is not costing you anything - you couldn't make use
    of those CPU cycles in any case.


    On Saturday, 6 July 2013 08:57:34 UTC-4, ZHOU Xiaobo wrote:

    Can I configure Go to switch goroutine only when calling system API?
    The scenario is when a server handling a large number of connections while
    the business logic is
    very simple (that is, IO-bound not CPU bound), the switching of goroutines
    is expensive, and also unnecessary.

    So, is there a goroutine schedule schema in which one goroutine runs until
    it traps into kernel mode.

    thanks
    ------------------
    Sincerely yours
    ZHOU Xiaobo
    --
    You received this message because you are subscribed to the Google Groups
    "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an
    email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedJul 6, '13 at 12:57p
activeJul 16, '13 at 8:24p
posts6
users5
websitegolang.org

People

Translate

site design / logo © 2018 Grokbase