SlideShare a Scribd company logo
1 of 32
Twitter: @prateekgogia
Github: @prateekgogia
Docker daemon
eth0 Linux machine
Docker
Daemon
Docker runtime adopted Go
• Promoted wider adoption of Go as a systems language
• Bug fixes in Docker produced more Go programmers
• Identifying systems level problem in Go runtime related to syscalls / threads
Isolation in Docker container: namespaces
• Process trees (PID Namespace)
• Mounts (MNT namespace)
• Network (Net namespace)
• Users / UIDs (User Namespace)
• Hostnames (UTS Namespace)
• Inter Process Communication (IPC Namespace)
Lets see this in action
Running a Go Process on Linux machine
eth0 Linux machine
Go Process
OS thread
Goroutine
Add new Network Namespace with lo
(loopback) only interface
eth0
net namespaces n
Linux machine
Go Process
OS thread
Goroutine
Adding worker goroutines to new network
namespaces
eth0
Worker
goroutines
net namespaces n
Linux machine
Go Process
OS thread
Goroutine
runtime.LockOSThread()
Adding worker goroutines to host network
namespace
eth0
Worker
goroutines
net namespaces n
Linux machine
Go Process
OS thread
Goroutine
runtime.LockOSThread()
Adding worker goroutines to host network
namespace
eth0
more
Worker
goroutines
net namespaces n
Linux machine Go Process
OS thread
Goroutine
runtime.LockOSThread()
Incorrect interfaces detected by goroutines
eth0
more
Worker
goroutines
net namespaces n
Linux machine Go Process
goroutine
with wrong
interface info
Go runtime scheduler
M P G G G G
M P G
M
P
G
OS thread
Processor (Logical)
Goroutine
Go runtime scheduler
M P G G G G
M P G G G
Global queue
M
P
G
OS thread
Processor (Logical)
Goroutine
Go runtime Scheduler
M P G G G G
M P G G G
M P G G G
M P G G G G G G
Global queue
M
P
G
OS thread
Processor (Logical)
Goroutine
Go runtime Scheduler
M P G G G G
M P G G G
M P G G G
M P G G G G G G
Global queue
New threads inherit
state from already
running threads
Go runtime model
eth0
more
Worker
goroutines
net namespaces n
Linux machine Go Process
OS thread
Goroutine
runtime.LockOSThread()
Go runtime model
eth0
more
Worker
goroutines
net namespaces n
Linux machine Go Process
How Go 1.10 Fixed it
Go runtime scheduler
M P G G G G
M P G
M
P
G
OS thread
Processor (Logical)
Goroutine
Go runtime scheduler
M P G
M P G
M
P
G
OS thread
Processor
(Logical)
Goroutine
runtime.LockOSThread()
Go runtime scheduler in go 1.10
M P G
M P G
startTemplateThread()
M
P
G
OS thread
Processor
(Logical)
Goroutine
runtime.LockOSThread()
LockOSThread() in go 1.10
M P G
M P G
Template thread
M
P
G
OS thread
Processor (Logical)
Goroutine
runtime.LockOSThread()
Go runtime scheduler in 1.10
M P G
M P G
Template thread
M
P
G
OS thread
Processor (Logical)
Goroutine
runtime.LockOSThread()
M P G
M P G
Template thread creation in Go Process
eth0
net namespaces n
Linux machine
Go Process
Template
thread
Adding worker goroutines to host network
namespace
eth0
net namespaces n
Linux machine
Go Process
Template
thread
Summary
• If creating / managing Linux network namespaces using Go, use Go
version >= 1.10
Thank You!!!
runtime.LockOSThread()
M P G
M P G
M P G G G
M P G G G G G G
Global queue
Goroutine called
LockOSThread()
M
P
G
OS thread
Processor
(Logical)
Goroutine
runtime.LockOSThread()
Docker runtime adopted Go ??
• Static compilation
• Asynchronous primitives
• Multi-arch builds
• Faster development
• Awesome Documentations
How to manage network namespaces
with Go 1.10 and beyond
ns := createNetNamespace()
runtime.LockOSThread()
defer runtime.UnlockOSThread()
ns.Do(func(_ ns.NetNS) error {
runtime.LockOSThread()
cb()
}
If the goroutine here changes the state of the
thread, let the thread exit with goroutine
Bonus feature
• OS thread terminates if goroutine exits
• runtime.LockOSThread() is nested.
• UnlockOSThread must be called the same number of times in order to unlock the thread.

More Related Content

What's hot

Learn Git Fundamentals
Learn Git FundamentalsLearn Git Fundamentals
Learn Git FundamentalsJatin Sharma
 
Deep dark-side of git: How git works internally
Deep dark-side of git: How git works internallyDeep dark-side of git: How git works internally
Deep dark-side of git: How git works internallySeongJae Park
 
Dive into Pinkoi 2013
Dive into Pinkoi 2013Dive into Pinkoi 2013
Dive into Pinkoi 2013Mosky Liu
 
Tài liệu sử dụng GitHub
Tài liệu sử dụng GitHubTài liệu sử dụng GitHub
Tài liệu sử dụng GitHubviet nghiem
 
Resource Discovery for the Web Platform using a P2P Overlay Network with WebR...
Resource Discovery for the Web Platform using a P2P Overlay Network with WebR...Resource Discovery for the Web Platform using a P2P Overlay Network with WebR...
Resource Discovery for the Web Platform using a P2P Overlay Network with WebR...David Dias
 
Concurrency
ConcurrencyConcurrency
Concurrencyehuard
 
GIT: Content-addressable filesystem and Version Control System
GIT: Content-addressable filesystem and Version Control SystemGIT: Content-addressable filesystem and Version Control System
GIT: Content-addressable filesystem and Version Control SystemTommaso Visconti
 
Reversing the dropbox client on windows
Reversing the dropbox client on windowsReversing the dropbox client on windows
Reversing the dropbox client on windowsextremecoders
 
PuppetConf 2017: How People Actually Write Puppet- Gareth Rushgrove, Puppet
PuppetConf 2017: How People Actually Write Puppet- Gareth Rushgrove, PuppetPuppetConf 2017: How People Actually Write Puppet- Gareth Rushgrove, Puppet
PuppetConf 2017: How People Actually Write Puppet- Gareth Rushgrove, PuppetPuppet
 
Dev8d 2011-pipe2 py
Dev8d 2011-pipe2 pyDev8d 2011-pipe2 py
Dev8d 2011-pipe2 pyTony Hirst
 
PuppetConf 2017: Puppet Platform: A Path Forward- Eric Sorenson, Puppet
PuppetConf 2017: Puppet Platform: A Path Forward- Eric Sorenson, PuppetPuppetConf 2017: Puppet Platform: A Path Forward- Eric Sorenson, Puppet
PuppetConf 2017: Puppet Platform: A Path Forward- Eric Sorenson, PuppetPuppet
 
Golang Performance : microbenchmarks, profilers, and a war story
Golang Performance : microbenchmarks, profilers, and a war storyGolang Performance : microbenchmarks, profilers, and a war story
Golang Performance : microbenchmarks, profilers, and a war storyAerospike
 
Taming Rich GML with Stetl - FOSS4G 2013 Nottingham
Taming Rich GML with Stetl - FOSS4G 2013 NottinghamTaming Rich GML with Stetl - FOSS4G 2013 Nottingham
Taming Rich GML with Stetl - FOSS4G 2013 NottinghamJust van den Broecke
 

What's hot (20)

Learn Git Fundamentals
Learn Git FundamentalsLearn Git Fundamentals
Learn Git Fundamentals
 
Deep dark-side of git: How git works internally
Deep dark-side of git: How git works internallyDeep dark-side of git: How git works internally
Deep dark-side of git: How git works internally
 
Dive into Pinkoi 2013
Dive into Pinkoi 2013Dive into Pinkoi 2013
Dive into Pinkoi 2013
 
Tài liệu sử dụng GitHub
Tài liệu sử dụng GitHubTài liệu sử dụng GitHub
Tài liệu sử dụng GitHub
 
Linux comands for Hadoop
Linux comands for HadoopLinux comands for Hadoop
Linux comands for Hadoop
 
Resource Discovery for the Web Platform using a P2P Overlay Network with WebR...
Resource Discovery for the Web Platform using a P2P Overlay Network with WebR...Resource Discovery for the Web Platform using a P2P Overlay Network with WebR...
Resource Discovery for the Web Platform using a P2P Overlay Network with WebR...
 
Git in 5 Minutes
Git in 5 MinutesGit in 5 Minutes
Git in 5 Minutes
 
Concurrency
ConcurrencyConcurrency
Concurrency
 
GIT: Content-addressable filesystem and Version Control System
GIT: Content-addressable filesystem and Version Control SystemGIT: Content-addressable filesystem and Version Control System
GIT: Content-addressable filesystem and Version Control System
 
Reversing the dropbox client on windows
Reversing the dropbox client on windowsReversing the dropbox client on windows
Reversing the dropbox client on windows
 
PuppetConf 2017: How People Actually Write Puppet- Gareth Rushgrove, Puppet
PuppetConf 2017: How People Actually Write Puppet- Gareth Rushgrove, PuppetPuppetConf 2017: How People Actually Write Puppet- Gareth Rushgrove, Puppet
PuppetConf 2017: How People Actually Write Puppet- Gareth Rushgrove, Puppet
 
Git basic
Git basicGit basic
Git basic
 
Dev8d 2011-pipe2 py
Dev8d 2011-pipe2 pyDev8d 2011-pipe2 py
Dev8d 2011-pipe2 py
 
PuppetConf 2017: Puppet Platform: A Path Forward- Eric Sorenson, Puppet
PuppetConf 2017: Puppet Platform: A Path Forward- Eric Sorenson, PuppetPuppetConf 2017: Puppet Platform: A Path Forward- Eric Sorenson, Puppet
PuppetConf 2017: Puppet Platform: A Path Forward- Eric Sorenson, Puppet
 
Scapy
ScapyScapy
Scapy
 
Rpm Introduction
Rpm IntroductionRpm Introduction
Rpm Introduction
 
Now i git it!!!
Now i git it!!!Now i git it!!!
Now i git it!!!
 
Golang Performance : microbenchmarks, profilers, and a war story
Golang Performance : microbenchmarks, profilers, and a war storyGolang Performance : microbenchmarks, profilers, and a war story
Golang Performance : microbenchmarks, profilers, and a war story
 
Knolx master-slides
Knolx master-slidesKnolx master-slides
Knolx master-slides
 
Taming Rich GML with Stetl - FOSS4G 2013 Nottingham
Taming Rich GML with Stetl - FOSS4G 2013 NottinghamTaming Rich GML with Stetl - FOSS4G 2013 Nottingham
Taming Rich GML with Stetl - FOSS4G 2013 Nottingham
 

Similar to GopherCon Denver LT 2018

Demystifying the Go Scheduler
Demystifying the Go SchedulerDemystifying the Go Scheduler
Demystifying the Go Schedulermatthewrdale
 
Introduzione a GitHub Actions (beta)
Introduzione a GitHub Actions (beta)Introduzione a GitHub Actions (beta)
Introduzione a GitHub Actions (beta)Giulio Vian
 
Git 101, or, how to sanely manage your Koha customizations
Git 101, or, how to sanely manage your Koha customizationsGit 101, or, how to sanely manage your Koha customizations
Git 101, or, how to sanely manage your Koha customizationsIan Walls
 
Jordan Hubbard Talk @ LISA
Jordan Hubbard Talk @ LISAJordan Hubbard Talk @ LISA
Jordan Hubbard Talk @ LISAguest4c923d
 
Startup Camp - Git, Python, Django session
Startup Camp - Git, Python, Django sessionStartup Camp - Git, Python, Django session
Startup Camp - Git, Python, Django sessionJuraj Michálek
 
Software Quality Assurance Tooling - Wintersession 2024
Software Quality Assurance Tooling - Wintersession 2024Software Quality Assurance Tooling - Wintersession 2024
Software Quality Assurance Tooling - Wintersession 2024Henry Schreiner
 
Terraform GitOps on Codefresh
Terraform GitOps on CodefreshTerraform GitOps on Codefresh
Terraform GitOps on CodefreshCodefresh
 
"Modern DevOps & Real Life Applications. 3.0.0-devops+20230318", Igor Fesenko
"Modern DevOps & Real Life Applications. 3.0.0-devops+20230318", Igor Fesenko "Modern DevOps & Real Life Applications. 3.0.0-devops+20230318", Igor Fesenko
"Modern DevOps & Real Life Applications. 3.0.0-devops+20230318", Igor Fesenko Fwdays
 
GIT: a Gentle InTroduction
GIT: a Gentle InTroductionGIT: a Gentle InTroduction
GIT: a Gentle InTroductionCodemotion
 
1032 cs208 g operation system ip camera case share.v0.2
1032 cs208 g operation system ip camera case share.v0.21032 cs208 g operation system ip camera case share.v0.2
1032 cs208 g operation system ip camera case share.v0.2Stanley Ho
 
Docker 0.11 at MaxCDN meetup in Los Angeles
Docker 0.11 at MaxCDN meetup in Los AngelesDocker 0.11 at MaxCDN meetup in Los Angeles
Docker 0.11 at MaxCDN meetup in Los AngelesJérôme Petazzoni
 
Geecon11 - Git: a Gentle InTroduction
Geecon11 -  Git: a Gentle InTroductionGeecon11 -  Git: a Gentle InTroduction
Geecon11 - Git: a Gentle InTroductionBruno Bossola
 
Javascript in Linux Desktop
Javascript in Linux DesktopJavascript in Linux Desktop
Javascript in Linux DesktopYuren Ju
 
Pharo 7.0 and 8.0 alpha
Pharo 7.0 and 8.0 alphaPharo 7.0 and 8.0 alpha
Pharo 7.0 and 8.0 alphaPharo
 
Docker architecture rework case study
Docker  architecture rework case studyDocker  architecture rework case study
Docker architecture rework case studydchaffiol
 
The GO Language : From Beginners to Gophers
The GO Language : From Beginners to GophersThe GO Language : From Beginners to Gophers
The GO Language : From Beginners to GophersAlessandro Sanino
 
Digital RSE: automated code quality checks - RSE group meeting
Digital RSE: automated code quality checks - RSE group meetingDigital RSE: automated code quality checks - RSE group meeting
Digital RSE: automated code quality checks - RSE group meetingHenry Schreiner
 
Linux containers_Docker
Linux containers_DockerLinux containers_Docker
Linux containers_DockerDmitry Fedorov
 

Similar to GopherCon Denver LT 2018 (20)

Demystifying the Go Scheduler
Demystifying the Go SchedulerDemystifying the Go Scheduler
Demystifying the Go Scheduler
 
Introduzione a GitHub Actions (beta)
Introduzione a GitHub Actions (beta)Introduzione a GitHub Actions (beta)
Introduzione a GitHub Actions (beta)
 
Git 101, or, how to sanely manage your Koha customizations
Git 101, or, how to sanely manage your Koha customizationsGit 101, or, how to sanely manage your Koha customizations
Git 101, or, how to sanely manage your Koha customizations
 
Ontopia tutorial
Ontopia tutorialOntopia tutorial
Ontopia tutorial
 
Jordan Hubbard Talk @ LISA
Jordan Hubbard Talk @ LISAJordan Hubbard Talk @ LISA
Jordan Hubbard Talk @ LISA
 
Startup Camp - Git, Python, Django session
Startup Camp - Git, Python, Django sessionStartup Camp - Git, Python, Django session
Startup Camp - Git, Python, Django session
 
Software Quality Assurance Tooling - Wintersession 2024
Software Quality Assurance Tooling - Wintersession 2024Software Quality Assurance Tooling - Wintersession 2024
Software Quality Assurance Tooling - Wintersession 2024
 
Terraform GitOps on Codefresh
Terraform GitOps on CodefreshTerraform GitOps on Codefresh
Terraform GitOps on Codefresh
 
"Modern DevOps & Real Life Applications. 3.0.0-devops+20230318", Igor Fesenko
"Modern DevOps & Real Life Applications. 3.0.0-devops+20230318", Igor Fesenko "Modern DevOps & Real Life Applications. 3.0.0-devops+20230318", Igor Fesenko
"Modern DevOps & Real Life Applications. 3.0.0-devops+20230318", Igor Fesenko
 
GIT: a Gentle InTroduction
GIT: a Gentle InTroductionGIT: a Gentle InTroduction
GIT: a Gentle InTroduction
 
1032 cs208 g operation system ip camera case share.v0.2
1032 cs208 g operation system ip camera case share.v0.21032 cs208 g operation system ip camera case share.v0.2
1032 cs208 g operation system ip camera case share.v0.2
 
Docker 0.11 at MaxCDN meetup in Los Angeles
Docker 0.11 at MaxCDN meetup in Los AngelesDocker 0.11 at MaxCDN meetup in Los Angeles
Docker 0.11 at MaxCDN meetup in Los Angeles
 
What's New in Groovy 1.6?
What's New in Groovy 1.6?What's New in Groovy 1.6?
What's New in Groovy 1.6?
 
Geecon11 - Git: a Gentle InTroduction
Geecon11 -  Git: a Gentle InTroductionGeecon11 -  Git: a Gentle InTroduction
Geecon11 - Git: a Gentle InTroduction
 
Javascript in Linux Desktop
Javascript in Linux DesktopJavascript in Linux Desktop
Javascript in Linux Desktop
 
Pharo 7.0 and 8.0 alpha
Pharo 7.0 and 8.0 alphaPharo 7.0 and 8.0 alpha
Pharo 7.0 and 8.0 alpha
 
Docker architecture rework case study
Docker  architecture rework case studyDocker  architecture rework case study
Docker architecture rework case study
 
The GO Language : From Beginners to Gophers
The GO Language : From Beginners to GophersThe GO Language : From Beginners to Gophers
The GO Language : From Beginners to Gophers
 
Digital RSE: automated code quality checks - RSE group meeting
Digital RSE: automated code quality checks - RSE group meetingDigital RSE: automated code quality checks - RSE group meeting
Digital RSE: automated code quality checks - RSE group meeting
 
Linux containers_Docker
Linux containers_DockerLinux containers_Docker
Linux containers_Docker
 

Recently uploaded

Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...roncy bisnoi
 
Glass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesGlass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesPrabhanshu Chaturvedi
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Call Girls in Nagpur High Profile
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...Call Girls in Nagpur High Profile
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxupamatechverse
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college projectTonystark477637
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdfankushspencer015
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxupamatechverse
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSISrknatarajan
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlysanyuktamishra911
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSSIVASHANKAR N
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingrknatarajan
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxpranjaldaimarysona
 

Recently uploaded (20)

Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
 
Glass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesGlass Ceramics: Processing and Properties
Glass Ceramics: Processing and Properties
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptx
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college project
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptx
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSIS
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptx
 

GopherCon Denver LT 2018

  • 2. Docker daemon eth0 Linux machine Docker Daemon
  • 3. Docker runtime adopted Go • Promoted wider adoption of Go as a systems language • Bug fixes in Docker produced more Go programmers • Identifying systems level problem in Go runtime related to syscalls / threads
  • 4. Isolation in Docker container: namespaces • Process trees (PID Namespace) • Mounts (MNT namespace) • Network (Net namespace) • Users / UIDs (User Namespace) • Hostnames (UTS Namespace) • Inter Process Communication (IPC Namespace)
  • 5. Lets see this in action
  • 6. Running a Go Process on Linux machine eth0 Linux machine Go Process OS thread Goroutine
  • 7. Add new Network Namespace with lo (loopback) only interface eth0 net namespaces n Linux machine Go Process OS thread Goroutine
  • 8. Adding worker goroutines to new network namespaces eth0 Worker goroutines net namespaces n Linux machine Go Process OS thread Goroutine runtime.LockOSThread()
  • 9. Adding worker goroutines to host network namespace eth0 Worker goroutines net namespaces n Linux machine Go Process OS thread Goroutine runtime.LockOSThread()
  • 10. Adding worker goroutines to host network namespace eth0 more Worker goroutines net namespaces n Linux machine Go Process OS thread Goroutine runtime.LockOSThread()
  • 11. Incorrect interfaces detected by goroutines eth0 more Worker goroutines net namespaces n Linux machine Go Process goroutine with wrong interface info
  • 12. Go runtime scheduler M P G G G G M P G M P G OS thread Processor (Logical) Goroutine
  • 13. Go runtime scheduler M P G G G G M P G G G Global queue M P G OS thread Processor (Logical) Goroutine
  • 14. Go runtime Scheduler M P G G G G M P G G G M P G G G M P G G G G G G Global queue M P G OS thread Processor (Logical) Goroutine
  • 15. Go runtime Scheduler M P G G G G M P G G G M P G G G M P G G G G G G Global queue New threads inherit state from already running threads
  • 16. Go runtime model eth0 more Worker goroutines net namespaces n Linux machine Go Process OS thread Goroutine runtime.LockOSThread()
  • 17. Go runtime model eth0 more Worker goroutines net namespaces n Linux machine Go Process
  • 18. How Go 1.10 Fixed it
  • 19. Go runtime scheduler M P G G G G M P G M P G OS thread Processor (Logical) Goroutine
  • 20. Go runtime scheduler M P G M P G M P G OS thread Processor (Logical) Goroutine runtime.LockOSThread()
  • 21. Go runtime scheduler in go 1.10 M P G M P G startTemplateThread() M P G OS thread Processor (Logical) Goroutine runtime.LockOSThread()
  • 22. LockOSThread() in go 1.10 M P G M P G Template thread M P G OS thread Processor (Logical) Goroutine runtime.LockOSThread()
  • 23. Go runtime scheduler in 1.10 M P G M P G Template thread M P G OS thread Processor (Logical) Goroutine runtime.LockOSThread() M P G M P G
  • 24. Template thread creation in Go Process eth0 net namespaces n Linux machine Go Process Template thread
  • 25. Adding worker goroutines to host network namespace eth0 net namespaces n Linux machine Go Process Template thread
  • 26. Summary • If creating / managing Linux network namespaces using Go, use Go version >= 1.10
  • 28. runtime.LockOSThread() M P G M P G M P G G G M P G G G G G G Global queue Goroutine called LockOSThread() M P G OS thread Processor (Logical) Goroutine runtime.LockOSThread()
  • 29. Docker runtime adopted Go ?? • Static compilation • Asynchronous primitives • Multi-arch builds • Faster development • Awesome Documentations
  • 30.
  • 31. How to manage network namespaces with Go 1.10 and beyond ns := createNetNamespace() runtime.LockOSThread() defer runtime.UnlockOSThread() ns.Do(func(_ ns.NetNS) error { runtime.LockOSThread() cb() } If the goroutine here changes the state of the thread, let the thread exit with goroutine
  • 32. Bonus feature • OS thread terminates if goroutine exits • runtime.LockOSThread() is nested. • UnlockOSThread must be called the same number of times in order to unlock the thread.

Editor's Notes

  1. How Goroutines, threads, processors work in Go
  2. How Goroutines, threads, processors work in Go
  3. How Goroutines, threads, processors work in Go
  4. How Goroutines, threads, processors work in Go
  5. How Goroutines, threads, processors work in Go
  6. How Goroutines, threads, processors work in Go
  7. How Goroutines, threads, processors work in Go
  8. How Goroutines, threads, processors work in Go
  9. How Goroutines, threads, processors work in Go
  10. How Goroutines, threads, processors work in Go
  11. How Goroutines, threads, processors work in Go