Go Lang
Developed By Google
Yet another language ?
Why they built a new language ?
-
Efficient Compilation
-
Efficient Executions
-
Ease of Programming
-
Support Multicore
And who got attracted ?
Let us see what attracted these big shots
Simple
yet
powerful!!
What made golang so special ?
What makes a language adoptable ?
- Easy learning curve
- Cross platform
- Performance
- Support for programming practices
- Supported paradigms
- Strong library base
- Security
- Good community
- Low memory footprint
- Easy deployment
Easy to Learn
Took us just two weeks to start coding
Built-in Libraries
-
web server
-
http, url, smtp
-
json, xml
-
database/sql
-
os
-
time
-
testing
-
log
-
crypto
-
html
-
image
-
sync
Easy to deploy
After compiling you get a single binary which can be directly run without any dependencies in the machine
What is the secret sauce?
goroutines
Language Features
-
variables
-
functions
-
structs
-
errors
-
recovery
-
interface
-
reflection
-
garbage collection
Tools
-
go fmt
-
go vet
-
go test
Code kata
fundamentals
Let's take a break
Concurrency vs Parallelism
Concurrency
Dealing many things at the same time
Studying for UT, grumbling about internals, asking for important questions in watsapp
Ticket Booking Scenario
-
Block Tickets in DB
-
Cancel other requests
-
Send e-mail
-
Send SMS
Parallelism
Doing things at the same time
Ticket Booking Scenario
1000s of users booking tickets at the same time
Tuesday Nights ;)
Rob Pike's Talk
Go is a concurrent programming language
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)
Go runtime schedules goroutines
Channels
goroutines communicates
via
channels
Code Kata
goroutines
Useful Links
Questions ?
Feedback
Thanks for your time
Arvind Ram
arvindram03@gmail.com
80 56 43 50 23
or
Post in facebook Drona group
Golang
By arvind ram
Golang
- 598