SlideShare a Scribd company logo
S
Go Lang
Ravi
Programming Model
Go concurrency motto:
"Do not communicate by sharing memory;
instead, share memory by communicating”
Quick Feature List
S Explicit support for concurrent programming.
S Compiled
S It is strongly typed and garbage-collected. Static typing
without too much keyboard typing
S High-level code when you want
S Low-level code when you want
Go Lang
Go Lang
Few Syntax
Demo
Concurrency + Parallelism
Go supports concurrency
S Go provides:
S concurrent execution (goroutines)
S synchronization and messaging (channels)
S multi-way concurrent control (select)
S “Lightweight”
S Starting 10,000 goroutines on MacBook Pro took 22ms
S Allocated memory increased by 3,014,000 bytes (301 bytes per
goroutine)
Goroutines
S Goroutines are multiplexed onto OS threads as required.
S When a goroutine blocks, that thread blocks but no other
goroutine blocks.
go foo()
go logger.Printf("Hello, %s!", who)
go func() {
logger.Printf("Hello, %s!", who)
...
}()
Channels
Channels are typed values that allow goroutines to synchronize
and exchange information.
// synchronous chan of ints
c := make(chan int)
// buffered chan of pointers to Request
c := make(chan *Request, 100
Communication
Quick syntax review
c := make(chan bool)– Makes an unbuffered channel of
bools
c <- x – Sends a value on the channel
<- c – Waits to receive a value on the channel
x = <- c – Waits to receive a value and stores it inx
x, ok = <- c – Waits to receive a value;okwill be false if
channel is closed and empty.
Multiple goroutines can send
on the same channel
S Go's Concurrency
S Built-in! Lightweight threads, no callback hell
S Readable, top-down code
S So easy to write servers
S for { conn, err := listener.Accept() // check err go serve(conn)
}
S Goroutine-per-request can scale
Use Cases
S Cloud infrastructure
S Go: the emerging language of cloud infrastructure
S Docker, Packer
S CoreOS’s etcd and fleet
S Ubuntu Juju, Mozilla Heka, Apcera’s NATS, gnatsd
S Mobile
S Go runs on ARM
S minux's iOS port of Go
S Camlistore child process, goandroid
S Audio synthesis
S https://github.com/nf/sigourney
S Language complexity
Java 8 language spec is a 780 page PDF (lol, seriously?).
http://docs.oracle.com/javase/sp...
Scala language spec is a 191 page PDF.
http://www.scala-lang.org/docu/f...
The Go language spec is webpage that prints as a 51 page PDF.
http://golang.org/ref/spec
Defining a language is not the same as learning how to use a language,
but it is a proxy for how much there is to learn (or how much there is to
confuse you when reading someone else's code).

More Related Content

PPTX
Introduction to go lang
PDF
Developing for LinkedIn's Application Platform
PDF
The Go programming language - Intro by MyLittleAdventure
PDF
Why you should care about Go (Golang)
PDF
PDF
Go language presentation
PPT
A First Look at Google's Go Programming Language
PPTX
Golang - Overview of Go (golang) Language
Introduction to go lang
Developing for LinkedIn's Application Platform
The Go programming language - Intro by MyLittleAdventure
Why you should care about Go (Golang)
Go language presentation
A First Look at Google's Go Programming Language
Golang - Overview of Go (golang) Language

What's hot (20)

PDF
An introduction to go programming language
PPT
Google Go! language
PPTX
Go Programming language, golang
PDF
Coding with golang
PDF
Mphasis Digital - Use Go (gloang) for system programming, distributed systems...
PPT
Introduction to Go-Lang
PDF
Understanding how concurrency work in os
PPTX
Wonders of Golang
PDF
Golang from Scala developer’s perspective
PPTX
PDF
GoLang Introduction
PPTX
ATO 2014 - So You Think You Know 'Go'? The Go Programming Language
PPTX
Go Language presentation
PDF
Go Programming Language by Google
PDF
Lets Go - An introduction to Google's Go Programming Language
PPTX
Introduction to GoLang
PDF
Building Command Line Tools with Golang
PDF
really really really awesome php application with bdd behat and iterfaces
PDF
[INNOVATUBE] Tech Talk #3: Golang - Takaaki Mizuno
An introduction to go programming language
Google Go! language
Go Programming language, golang
Coding with golang
Mphasis Digital - Use Go (gloang) for system programming, distributed systems...
Introduction to Go-Lang
Understanding how concurrency work in os
Wonders of Golang
Golang from Scala developer’s perspective
GoLang Introduction
ATO 2014 - So You Think You Know 'Go'? The Go Programming Language
Go Language presentation
Go Programming Language by Google
Lets Go - An introduction to Google's Go Programming Language
Introduction to GoLang
Building Command Line Tools with Golang
really really really awesome php application with bdd behat and iterfaces
[INNOVATUBE] Tech Talk #3: Golang - Takaaki Mizuno
Ad

Similar to Go Lang (20)

PDF
Ruby is dying. What languages are cool now?
ODP
Go! here we go!
PDF
Introduction to Google's Go programming language
PDF
Peyton jones-2011-parallel haskell-the_future
PDF
Simon Peyton Jones: Managing parallelism
PPT
Introduction to Go ProgrammingLanguage.ppt
PPTX
Golang workshop - Mindbowser
PDF
Realizing the Promise of Portable Data Processing with Apache Beam
PDF
Realizing the promise of portable data processing with Apache Beam
PDF
Let's Go: Introduction to Google's Go Programming Language
PDF
Introduction to Apache Beam
PPT
Google's Go Programming Language - Introduction
PPT
PDF
Inroduction to golang
PPT
The future of server side JavaScript
PPT
Introduction to java new
PPT
Introduction to java new
PDF
Intro to Rust 2019
PPTX
Socket programming with php
ODP
The D Programming Language - Why I love it!
Ruby is dying. What languages are cool now?
Go! here we go!
Introduction to Google's Go programming language
Peyton jones-2011-parallel haskell-the_future
Simon Peyton Jones: Managing parallelism
Introduction to Go ProgrammingLanguage.ppt
Golang workshop - Mindbowser
Realizing the Promise of Portable Data Processing with Apache Beam
Realizing the promise of portable data processing with Apache Beam
Let's Go: Introduction to Google's Go Programming Language
Introduction to Apache Beam
Google's Go Programming Language - Introduction
Inroduction to golang
The future of server side JavaScript
Introduction to java new
Introduction to java new
Intro to Rust 2019
Socket programming with php
The D Programming Language - Why I love it!
Ad

More from Venkata Naga Ravi (12)

PPTX
Microservices with Docker
PPTX
Processing Large Data with Apache Spark -- HasGeek
PPTX
Quick Trip with Docker
PPTX
Glint with Apache Spark
PPTX
PPTX
Big Data Benchmarking
PPTX
Kubernetes
PPTX
NoSQL & HBase overview
PPTX
Software Defined Network - SDN
PPTX
Virtual Container - Docker
PPTX
Java 8 Lambda and Streams
PPTX
In Memory Analytics with Apache Spark
Microservices with Docker
Processing Large Data with Apache Spark -- HasGeek
Quick Trip with Docker
Glint with Apache Spark
Big Data Benchmarking
Kubernetes
NoSQL & HBase overview
Software Defined Network - SDN
Virtual Container - Docker
Java 8 Lambda and Streams
In Memory Analytics with Apache Spark

Recently uploaded (20)

PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PPTX
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Heart disease approach using modified random forest and particle swarm optimi...
PPTX
1. Introduction to Computer Programming.pptx
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Machine learning based COVID-19 study performance prediction
PPTX
Machine Learning_overview_presentation.pptx
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Univ-Connecticut-ChatGPT-Presentaion.pdf
PPTX
TLE Review Electricity (Electricity).pptx
PPTX
cloud_computing_Infrastucture_as_cloud_p
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
August Patch Tuesday
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
gpt5_lecture_notes_comprehensive_20250812015547.pdf
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
Reach Out and Touch Someone: Haptics and Empathic Computing
Heart disease approach using modified random forest and particle swarm optimi...
1. Introduction to Computer Programming.pptx
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Machine learning based COVID-19 study performance prediction
Machine Learning_overview_presentation.pptx
Spectral efficient network and resource selection model in 5G networks
Univ-Connecticut-ChatGPT-Presentaion.pdf
TLE Review Electricity (Electricity).pptx
cloud_computing_Infrastucture_as_cloud_p
Digital-Transformation-Roadmap-for-Companies.pptx
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
Assigned Numbers - 2025 - Bluetooth® Document
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
August Patch Tuesday
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Mobile App Security Testing_ A Comprehensive Guide.pdf

Go Lang

  • 2. Programming Model Go concurrency motto: "Do not communicate by sharing memory; instead, share memory by communicating”
  • 3. Quick Feature List S Explicit support for concurrent programming. S Compiled S It is strongly typed and garbage-collected. Static typing without too much keyboard typing S High-level code when you want S Low-level code when you want
  • 9. Go supports concurrency S Go provides: S concurrent execution (goroutines) S synchronization and messaging (channels) S multi-way concurrent control (select) S “Lightweight” S Starting 10,000 goroutines on MacBook Pro took 22ms S Allocated memory increased by 3,014,000 bytes (301 bytes per goroutine)
  • 10. Goroutines S Goroutines are multiplexed onto OS threads as required. S When a goroutine blocks, that thread blocks but no other goroutine blocks. go foo() go logger.Printf("Hello, %s!", who) go func() { logger.Printf("Hello, %s!", who) ... }()
  • 11. Channels Channels are typed values that allow goroutines to synchronize and exchange information. // synchronous chan of ints c := make(chan int) // buffered chan of pointers to Request c := make(chan *Request, 100
  • 13. Quick syntax review c := make(chan bool)– Makes an unbuffered channel of bools c <- x – Sends a value on the channel <- c – Waits to receive a value on the channel x = <- c – Waits to receive a value and stores it inx x, ok = <- c – Waits to receive a value;okwill be false if channel is closed and empty.
  • 14. Multiple goroutines can send on the same channel
  • 15. S Go's Concurrency S Built-in! Lightweight threads, no callback hell S Readable, top-down code S So easy to write servers S for { conn, err := listener.Accept() // check err go serve(conn) } S Goroutine-per-request can scale
  • 16. Use Cases S Cloud infrastructure S Go: the emerging language of cloud infrastructure S Docker, Packer S CoreOS’s etcd and fleet S Ubuntu Juju, Mozilla Heka, Apcera’s NATS, gnatsd
  • 17. S Mobile S Go runs on ARM S minux's iOS port of Go S Camlistore child process, goandroid S Audio synthesis S https://github.com/nf/sigourney
  • 18. S Language complexity Java 8 language spec is a 780 page PDF (lol, seriously?). http://docs.oracle.com/javase/sp... Scala language spec is a 191 page PDF. http://www.scala-lang.org/docu/f... The Go language spec is webpage that prints as a 51 page PDF. http://golang.org/ref/spec Defining a language is not the same as learning how to use a language, but it is a proxy for how much there is to learn (or how much there is to confuse you when reading someone else's code).

Editor's Notes

  • #19: http://www.quora.com/Go-programming-language/Scala-vs-Go-Could-people-help-compare-contrast-these-on-relative-merits-demerits