Wait groups in golang

  Рет қаралды 23,717

Hitesh Choudhary

Hitesh Choudhary

2 жыл бұрын

Welcome to a youtube channel dedicated to programming and coding related tutorials. We talk about tech, write code, discuss about cloud and devops. That’s what we do all day, all year. We roll out a lot of series and videos on our channel.
All the learning resources such as code files, documentations, articles and community discussions are available on our website:
chaicode.com/
You can find our discord link, github link etc on the above website.
Twitter/X link: x.com/hiteshdotcom
Discord link: hitesh.ai/discord
Learn React with 10 projects: • Let's learn react from...
Learn Docker: • A practical guide on D...
Learn Kubernetes: • Complete Kubernetes Co...
How does a browser works: • How does a browser wor...
How nodejs works: • How node JS works | En...
Learn Redux-toolkit: • Learn Redux Toolkit in...
Learn NextJS: • Nextjs Full stack course
Learn Typescript: • Why to learn Typescript
Learn Javascript: • Welcome to new JavaScr...
Learn React Native: • React Native Mastery: ...
Learn Zustand: • React state management...
Learn Golang: • How to get started wit...

Пікірлер: 19
@r00t_sh3ll
@r00t_sh3ll 2 жыл бұрын
Loving this series! Great work.
@74Bagas
@74Bagas 2 жыл бұрын
that gooogle though... oh my god, made my day. hahahha
@powpowson
@powpowson Жыл бұрын
Thanks for the video, I'm just now seeing the beauty in goroutines
@hiteshbhagwat8952
@hiteshbhagwat8952 2 жыл бұрын
Hi Hitesh really love yur videos sir 💝💝😊
@omkesh12sajjanwar.22
@omkesh12sajjanwar.22 Жыл бұрын
Hey Could we call wg.Add(1) before go routine, in rear scenario there might chances to miss wg.Add() after goroutine spawn.
@abhinavkumar3751
@abhinavkumar3751 6 ай бұрын
Yeah we can do that, if you know you're going to have exactly 100 threads, then you can do wg.Add(100) at start.
@soniapaul288
@soniapaul288 2 жыл бұрын
wg is a pointer variable but neither asterisk (*) nor (&) is being used, why ?
@dhanushs1802
@dhanushs1802 2 жыл бұрын
we are making a copy of sync.WaitGroup by taking advantage of zero value in golang here. And we are not assigning anything to wg here after declaring it. We are just calling the relevant methods on it. So we don't have a need of pointers here isn't it.
@flexairz
@flexairz 2 жыл бұрын
Why did you remove my comment about the wg.Add(1) being in the wrong place? My Go did not accept that, so I wanted to help out.
@HiteshChoudharydotcom
@HiteshChoudharydotcom 2 жыл бұрын
I didn’t removed anything, your comments are landing in spam
@dhanushs1802
@dhanushs1802 2 жыл бұрын
Curious, where do you think is the right place to add? And why?
@VarunSingh-cv4oi
@VarunSingh-cv4oi Жыл бұрын
what if we are not concernerd with result of go routine, do we still need to use wait?
@SagarKumar-yr4ky
@SagarKumar-yr4ky Жыл бұрын
Same question, let's say we fire multiple go routines in a for loop & we just want them to process something or do some CRUD operation in DB and we don't care about the result of the method called by these go routines, do we still need wait groups in that case too? I mean, CRUD operation will be executed in the background anyways right ?
@SanthoshM25
@SanthoshM25 Жыл бұрын
@@SagarKumar-yr4ky yes you will need wait groups in these scenarios too. Basically whenever you want all your go routines executions to be done/finish properly you have to use wait group. If you don't use wait group then the main process execution may end before the complete execution of go routine, so to keep the main process to wait for these go routines to complete their process we need to add wait group.
@Randomguy48279xyz
@Randomguy48279xyz 2 жыл бұрын
👍
@satwikanandchauhan
@satwikanandchauhan 2 жыл бұрын
1st comment and like
@PikasoCapture
@PikasoCapture Жыл бұрын
okay
@debankanmitra2425
@debankanmitra2425 Жыл бұрын
That doesn't seems to be faster , i expect it to be more faster
@codeunited5905
@codeunited5905 Жыл бұрын
i measured the time taken to send requests synchronously and concurrently. The concurrent way was 2.1x faster than synchronous way.
Mutex in golang
5:41
Hitesh Choudhary
Рет қаралды 23 М.
Channels and Deadlock in golang
18:39
Hitesh Choudhary
Рет қаралды 23 М.
БОЛЬШОЙ ПЕТУШОК #shorts
00:21
Паша Осадчий
Рет қаралды 9 МЛН
I Can't Believe We Did This...
00:38
Stokes Twins
Рет қаралды 92 МЛН
100❤️
00:19
MY💝No War🤝
Рет қаралды 14 МЛН
버블티로 체감되는 요즘 물가
00:16
진영민yeongmin
Рет қаралды 116 МЛН
Concurrency and goroutines in golang
13:18
Hitesh Choudhary
Рет қаралды 38 М.
Master Golang with Interfaces
21:54
Kantan Coding
Рет қаралды 8 М.
Golang Channels Or Wait Groups? Let Me Explain.
18:32
Anthony GG
Рет қаралды 18 М.
This Is The BEST Way To Structure Your GO Projects
11:08
Melkey
Рет қаралды 65 М.
Concurrency in Go
18:40
Jake Wright
Рет қаралды 608 М.
Working with files in golang
12:40
Hitesh Choudhary
Рет қаралды 36 М.
Go vs Rust: Which To Learn In 2024?
6:27
Kodaps Academy
Рет қаралды 143 М.
Опыт использования Мини ПК от TECNO
1:00
Андронет
Рет қаралды 758 М.
iPhone 16 с инновационным аккумулятором
0:45
ÉЖИ АКСЁНОВ
Рет қаралды 7 МЛН
Урна с айфонами!
0:30
По ту сторону Гугла
Рет қаралды 8 МЛН
Samsung Galaxy Unpacked July 2024: Official Replay
1:8:53
Samsung
Рет қаралды 23 МЛН