Re: [go-nuts] Is there any equivalent `fork` in Golang?

2018-03-07 Thread gansteed
thanks

Lutz Horn 于2018年3月7日周三 下午7:40写道:

> > hello, is there any replacement for `fork` syscall in Golang?
>
> See https://stackoverflow.com/a/28371586
>
> > Note that fork() has been invented at the time when no threads were
> > used at all, and a process had always had just a single thread of
> > execution in it, and hence forking it was safe. With Go, the situation
> > is radically different as it heavily uses OS-level threads to power its
> > goroutine scheduling.
>
> Regards
>
> Lutz
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "golang-nuts" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/golang-nuts/0Th87sxlzOE/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> golang-nuts+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] Re: where is the implementation of `getg`?

2018-01-16 Thread gansteed
thanks

Ian Lance Taylor 于2018年1月17日周三 上午9:53写道:

> On Tue, Jan 16, 2018 at 5:51 PM, Dave Cheney  wrote:
> > A long time ago getg was written in assembly in the runtime package.
> These
> > days it is implemented directly as pseudo instruction in the compiler.
> > Search for OpGetG in $GOROOT/src/cmd/compile/internal
>
> Yes.  The simplest way to see the generated instructions is to
> disassemble the runtime package and look for a place that you know is
> a call to getg.
>
> Ian
>
>
> > On Wednesday, 17 January 2018 12:40:48 UTC+11, Jiajun Huang wrote:
> >>
> >> Hi, all:
> >>
> >>  I'm reading golang runtime implementation, I've got a function
> >> definition:
> >>
> >> // getg returns the pointer to the current g.
> >> // The compiler rewrites calls to this function into instructions
> >> // that fetch the g directly (from TLS or from the dedicated register).
> >> func getg() *g
> >>
> >>
> >> So, is there any solution that I can reading what implementation
> does
> >> the compiler rewrite? It seems that it's Assembly code.
> >
> > --
> > 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+unsubscr...@googlegroups.com.
> > For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "golang-nuts" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/golang-nuts/KgPOzaMylHo/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> golang-nuts+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.