Популярное

Музыка Кино и Анимация Автомобили Животные Спорт Путешествия Игры Юмор

Интересные видео

2025 Сериалы Трейлеры Новости Как сделать Видеоуроки Diy своими руками

Топ запросов

смотреть а4 schoolboy runaway турецкий сериал смотреть мультфильмы эдисон
dTub
Скачать

Learning Golang: Introduction to Concurrency Patterns, goroutines and channels

Автор: Mario Carrion

Загружено: 2021-08-12

Просмотров: 56965

Описание:

Welcome! Let's learn about Go/Golang Concurrency Patterns, but first let's learn about concurrency in Go/Golang, including goroutines, channels and the different keywords needed: like close, range and select.

What is a goroutine?
It is lightweight thread managed by the Go/Golang runtime, independently executed function that has its own call stack.

What is a channel?
Is a mechanism through which we can send and receive values, it uses the arrow operator which indicates data flow.

By default sender and receiver will block if the other side is not ready

What is a buffered channel?
It's a type of buffer that has a length.

Sending to a buffered channel will block if it is full and receiving from a buffered channel will only block when it's empty.

What else can we do with channels?

There are 3 new keywords applicable to channels: "close", "select" and "range":

"close" allows closing the channel, this means we can't receive or send values to it.
"selects" allows to receive messages from multiple channels via "cases", it's like a "switch", it also supports a "default" value.
"range" is similar to the keyword used when looping through slices/arrays; but in this cases it will continuously receive values from the channel until it gets closed.

Recall this is the "Introduction to Concurrency Patterns in Go/Golang", in future episodes I will describe concrete patterns to use when building concurrent programs.

---

RELEVANT LINKS

Previous episode: "Learning Golang: Interface Types - Part 2 (empty interface, type assertion and type switches)"    • Learning Golang: Interface Types - Part 2 ...  

Example code: https://github.com/MarioCarrion/video...

Playlist "Software Architecture in Go":    • Software Architecture and System Design in...  
Playlist "Learning Go":    • Learning Go/Golang  
Playlist "Building Microservices in Go":    • Building Microservices in Golang/Go  
Playlist "GoTools and Packages":    • Golang/Go Tools and Packages  
Playlist "Testing in Go":    • Testing in Golang/Go  

00:00 Intro
00:16 What is Concurrency?
00:36 What is Parallelism?
00:46 Analogy: Concurrency
01:53 Analogy: Parallelism
02:20 What is a goroutine in Golang?
02:49 Example: goroutine in Golang
04:03 What is channel in Golang?
05:30 Example 1: channels in Golang
06:40 Example 2: channels and goroutines in Golang
08:35 What is a buffered channel in Golang?
09:56 Example: buffered channels in Golang
11:39 Channels: Close, Select and Range in Golang
12:33 Example: goroutines and channels in Golang
17:12 Conclusion: Introduction to Concurrency Patterns in Golang

---

Who am I:

Hello👋🏼! I'm Mario, a Hands-on Software Architect and Lead Backend Engineer with more than 16 years of professional experience building all kinds of software including on-premise Industrial Automation Systems, Linux Accessibility Desktop and Browser Components as well as Distributed Advertising Microservices.

Every week I will share with you different topics I've learned while working for small startups and large companies including the processes I've followed over the years for successfully delivering complex enterprise systems from start to end.

Subscribe if you like Software Development, Software Architecture and Systems Design!

Keep it up. Don't give up!

  / mariocarrion  
  / mario.carrion  

#golang #tutorial #concurrency

--- Our affiliate links below

Shop our Amazon favorites → https://www.amazon.com/shop/rubycarrion
Shop my IG feed on my LIKEtoKNOWit (LTK) page → https://www.liketoknow.it/RubyCarrion
Shop Top Deals and Featured Offers at Best Buy → https://bestbuy.7tiv.net/c/2558226/68...
Get a 30 day FREE Trial of Epidemic Sound → https://www.epidemicsound.com/referra...
Try Amazon Prime 30-day FREE Trial → https://amzn.to/3yf9a0f
I love getting Cash Back and think you will too! Join for FREE and get $30 when you spend $30. https://www.rakuten.com/r/RUBYRA132?e...

--- Our Vlog Channel

   / rubycarrion  

Learning Golang: Introduction to Concurrency Patterns, goroutines and channels

Поделиться в:

Доступные форматы для скачивания:

Скачать видео mp4

  • Информация по загрузке:

Скачать аудио mp3

Похожие видео

Learning Golang: Concurrency Patterns Fan-In and Fan-Out

Learning Golang: Concurrency Patterns Fan-In and Fan-Out

Golang Concurrency - All the Basics you have to know!

Golang Concurrency - All the Basics you have to know!

Секреты внутреннего устройства планировщика Go

Секреты внутреннего устройства планировщика Go

Master Go Programming With These Concurrency Patterns (in 40 minutes)

Master Go Programming With These Concurrency Patterns (in 40 minutes)

Планировщик Go — самый подробный гайд простым языком

Планировщик Go — самый подробный гайд простым языком

Concurrency in Go

Concurrency in Go

Google I/O 2012 - Go Concurrency Patterns

Google I/O 2012 - Go Concurrency Patterns

Транзакции в контекстных значениях в Golang, это нормально? r/golang

Транзакции в контекстных значениях в Golang, это нормально? r/golang

Goroutines ARE USELESS

Goroutines ARE USELESS

Golang Concurrency Explained (Crash Course)

Golang Concurrency Explained (Crash Course)

Everything I did to become an expert in Golang (you can do this too)

Everything I did to become an expert in Golang (you can do this too)

19. Роб Пайк — Что мы сделали правильно, что мы сделали неправильно | GopherConAU 2023

19. Роб Пайк — Что мы сделали правильно, что мы сделали неправильно | GopherConAU 2023

Concurrency is not Parallelism by Rob Pike

Concurrency is not Parallelism by Rob Pike

Golang 1.25: What is new?

Golang 1.25: What is new?

Kubernetes — Простым Языком на Понятном Примере

Kubernetes — Простым Языком на Понятном Примере

This is why Go Channels are awesome

This is why Go Channels are awesome

Алгоритмы и структуры данных за 15 минут! Вместо 4 лет универа

Алгоритмы и структуры данных за 15 минут! Вместо 4 лет универа

Объяснение параллелизма в Go: процедуры и каналы Go

Объяснение параллелизма в Go: процедуры и каналы Go

Понимание выделения памяти: стек и куча — GopherCon SG 2019

Понимание выделения памяти: стек и куча — GopherCon SG 2019

Принципы SOLID на реальном примере

Принципы SOLID на реальном примере

© 2025 dtub. Все права защищены.



  • Контакты
  • О нас
  • Политика конфиденциальности



Контакты для правообладателей: [email protected]