Channels and Deadlock in golang
HTML-код
- Опубликовано: 8 фев 2025
- 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/hiteshdo...
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...
Thank you Sir for this awesome course.If possible could you make a short video precisely only for channels & go routines explaining its real world implementation to understand it better.Also some exercises or activities would help. Thank you once again.
One of the pivotal points of channels not mentioned is from the CTX or context package.
Channels depending on the application can hang and you will want a want to kill them so your application can continue. CTX provides a timeout feature for such cases.
Amongst a lot of other featues.
Thanks for the beautiful explanation!
Thank you for this course Hitesh!
Hey I watched the whole playlist its amazing, in this video I have on dobut in both of the go Routines you are saying ch as prototype for what reason? is it to make these Routines as Read Only or Send Only?
All likes, not a single dislike yet, very nice. The first thing comes into mind with 'Channels', is related to Medical, injecting fluids into human body.
Really awesome series bhaiya, bt can u pls make a little more detailed video about these channels.
At last you said totally a different video can be made on structuring an application in Go. please make video on structuring an application with go . Big request.
Very nice and thanks for covering all points
Thank you sir, it was an amazing journey
Amazing course content, thankyou
You have explained the things very well. Thanks
Awesome content as usual. Stay blessed brother❤️
Very informative 👌🏻👍🏻
please add some adding testcases videos too to make it complete course .
Thanks
Dude one way to explain it to your viewers is: have you used pipes in Linux? the LValue is the sender, the Pipe is channel, and the RValue is the receiver and surprisingly is the sender has nothing more to deliver to the receiver, then the channel is closed!
Great video 👍
Thank you sir for this series
🙂
To be honest, programming the web makes more sense than OOP with this brand new paradigm of concurrency that Go offers us. Is like a more natural logic, it feels closer to how we experiment the reality: you don't go around and live making everything a component or object and relate it with other objects, if you do it so, it's because of living too much time developing under OOP paradigm, but the common sense is more like the concurrency: you do multiple tasks at a time and you are just the main channel retrieving data from multiple processes and based on the data you do one thing, stop another and so on. What do you guys think? I like OOP, is cool and functional, has passed the test of times and empires have been raised up on technologies with this paradigm, but haven't you sometimes felt cumbersome and overengineered a solution made on OOP? Like wow, so many code, so many files, names, classes, layers and steps through just for uploading a damn file!
Hitesh Sir, Kindly can you make the video on refactoring topics in Golang?
One question, if we have multiple go routines and one of them is emitting data while other are listening to it, then how will we know which routine will get which data ?
go func1 ( listener )
go func2 ( listener )
go func3 ( emitter ) {
emits( val1 );
emits( val2 );
}
How will we know which value goes to which function ?
It totally depends on the go scheduler, similar to threads in java. Its totally random depends on the scheduler.
you can create separate channels, and listen to specific channel in respective goroutine
any video on select
thanks a lot.
Go is pure love
Amazing
i think u used the Mych for closing instead ch ,that is reason it is not closing
Hello sir you gave ch in function and accessed myChannel in function how is it working I am not getting I tried to do it but got an error
It is a anonymous function hence although we have declared parameter as ch but we are passing the already declared myCh hence it doesn't matter which variable u pass the value will be the same.Hope it helps.
nums1 := 5
nums2 := 5
squareOf2 := func(num1, num2 int) int {
return nums1 * nums2
}(nums1, nums2)
fmt.Println(squareOf2)
Try this for example
Better watch the video again.
@@susangeorge1318 Thanks, I was also getting confused in this but now it is clear.
You are correct, it works as mentioned in the above comments but he should have used ch. And that is also the reason he didn't get syntax highlight when he tried to close the receive only channel (he admits that around 17:20)
What is the use case of a channel, I mean why do we want our go routines to talk while executing
I think so that they can synchronize shared storages effectively
Sir 1 ishu task app process debug ManiMan fast how to solve please reply me