Go Lang
Robert Griesemer, Rob Pike, and Ken Thompson.

Why they built a new language ?
-
Efficient Compilation
-
Efficient Executions
-
Ease of Programming
-
Support Multicore


And who got attracted ?





Built-in Libraries
-
web server
-
http, url
-
json, xml
-
database/sql
-
time
-
testing
-
log
-
templates
-
os

Easy to deploy
After compiling you get a single binary which can be directly run without any dependencies in the machine

Code

Language Features
-
structs
-
interface
-
pointers
-
errors
-
OOPS ?
-
garbage collection

Tools
-
go fmt
-
go vet
-
go test
-
go imports
-
go bindata
-
go envdata

Benchmarks

Go vs Java (Single Core)


Go vs Java (Quad Core)


Go vs C# (Single Core)


Go vs C# (Quad Core)


Concurrency vs Parallelism

Parallelism
Doing things at the same time

Concurrency
Dealing many things at the same time






Concurrency by Example

goroutines are super fast
It leverages the cost of context switching

Context switch in OS Threads
-
Save / restore all registers
-
16 general purpose registers
-
PC (Program Counter)
-
SP (Stack Pointer)
-
Segment registers
-
16 XMM registers
-
FP coprocessor state
-
All MSRs etc.

Context switch in goroutines
-
Save / restore Program Counter, PC
-
SP, Stack Pointer
-
DX (Destination Registers)

Channels
goroutines communicates
via
channels

Do not communicate by sharing memory; instead, share memory by communicating.

Code

Go runtime schedules goroutines

Useful Links

Questions ?
||
Dinner?


Thanks
Geeknight Golang
By arvind ram
Geeknight Golang
- 986