--
You received this message because you are subscribed to the Google Groups "golang-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Go is a simple compiled programming language. It is intended to be easy to learn, easy to deploy, and relatively easy to understand code written in Go. Go’s design also addresses some problems observed in Google-scale C++ programs: dependencies between Go packages are strictly layered (no cycles), there is no preprocessor, and the default linking mode is static. As a general rule, Go tries to present a few-knobs interface to users. One GC knob, one threading knob, effectively one compiler knob.
Go’s threading model is “Green” or “M-on-N”; in Go itself the thread-like entities are called goroutines, and these are what is multiplexed onto OS threads. Goroutines don’t have user-visible thread-local storage, don’t support priorities, and don’t yet support any sort of processor affinity. It’s possible for goroutines to communicate through shared memory, but use of channels is preferred. Goroutines are intended to be very lightweight; 100,000 goroutines on a phone-class computer should be possible. Because of this, goroutine stacks are initially allocated small and are dynamically resized (copied into larger and larger pieces of contiguous storage) as necessary.
Scheduling of goroutines is “cooperative”, meaning that it is enforced with compiler-inserted safepoints and at certain points in the runtime system. Blocking (network) I/O calls are virtualized to avoid blocking an OS thread. In practice this means that only a small number of OS threads are needed to run a large number of goroutines.
The Go garbage collector is precise, (currently) non-generational, concurrent, parallel, and imposes very small pause times; normally under 100µs (this relies on write barriers enabled during GC). Garbage collections are initiated before heap limits are reached, with the goal that devoting 25% of available CPU to GC will allow the GC to finish just as the heap limit is reached. If a goroutine allocates at a higher-than-expected rate during a garbage collection, it may be drafted to perform additional GC work proportional to its excess allocation. Heap objects are never relocated, but stacks can be if they grow or shrink. The garbage collector also handles interior pointers correctly. Native code has limited access to Go pointers.
Pointers have no tags and objects have no headers; pointers within objects are located using bitmaps initialized at object allocation time. The Go equivalent of Java “Object” or C “void*” is “interface{}”, which contains both a pointer to the actual object and the type of that object. The Go library makes ample and elegant use of reflection on interface types.
The Go compiler (gc) is descended from a simple compiler written in C, now converted to Go, and currently being refined and enhanced. The front end produces AST which is checked, transformed, and subject to some optimizations. Notably, the AST analysis includes an interprocedural ad hoc escape analysis to convert (some) heap allocations to stack allocations. The compiler then converts AST to SSA, to which various SSA-style optimizations are applied. The Go community is sensitive to compile times, so the optimizations performed are chosen and coded carefully. The calling convention is currently non-ABI, in memory, mostly because of inertia and constraints imposed by stack growth and garbage collection.
================--
To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+...@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-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+...@googlegroups.com.