Concurrency in Go

แชร์
ฝัง
  • เผยแพร่เมื่อ 20 พ.ย. 2024

ความคิดเห็น • 508

  • @sujoyan
    @sujoyan 9 หลายเดือนก่อน +24

    The throughput of knowledge transfer in this video is insane! You are able to cover so much in just 15 minutes. That's amazing.

    • @ashish3354
      @ashish3354 8 หลายเดือนก่อน +1

      yeah it's crazy, you even get a taste of what the halting problem is, completely unsolicited

  • @akhil_sai
    @akhil_sai 3 ปีที่แล้ว +241

    04:18 WaitGroup
    06:13 Channel
    08:36 Deadlock and Channel closing
    10:08 Non blocking buffered Channel
    11:25 Select statement
    13:23 Worker pool pattern

  • @naikrovek
    @naikrovek ปีที่แล้ว +3

    this is the best overview of goroutines and channels that i have ever seen. well done.

  • @BernhardHofmann
    @BernhardHofmann 5 ปีที่แล้ว +52

    I've watched two of your Go videos now and I'm amazed at how quickly you can convey the lessons. I wish I'd had this pace and style of teaching for all the other languages I've learnt in my 35 year career. Please keep them coming. 💚

  • @faqs-answered
    @faqs-answered ปีที่แล้ว +2

    Extremely easy way to convey the concepts. No wonder why TH-cam shows up at the top, despite its small size.

  • @romanmunar
    @romanmunar 4 ปีที่แล้ว +18

    For those whose having a hard time understanding the concepts covered, i highly recommend the book 'Concurrency in Go' by Cox Buday, however if you're just starting to learn the language, 'Go in action' by Kennedy and Martin, is more suited then, follow it up with buday's book.

  • @sujay4237
    @sujay4237 10 หลายเดือนก่อน +1

    Currently taking a distributed systems course in college that recommends implementation in go so I did quite a bit of searching to crash course go.
    After watching this and the 12 minute video, i feel like I can just jump in and immediately excel in that course. Concurrency is just done SO well in go.

  • @igustingurahokaprinarjaya7482
    @igustingurahokaprinarjaya7482 3 ปีที่แล้ว +2

    This is the best best best best best best Go's Concurrency explanation!
    Recommended for all beginner learning Go's Concurrency.
    Very clear, simple, and details! The best!
    Thank You Jake

  • @pronoe
    @pronoe 3 ปีที่แล้ว +59

    Extremely easy to follow and understand. Great video. The way you deconstructed this by showing really simple examples and each step adding more logic and/or syntactic sugar is the way I learn myself so this video suited me perfectly.

  • @gnanakumar1992
    @gnanakumar1992 3 ปีที่แล้ว +1

    No one explained this simple for go lang in any TH-cam channels. Thanks for the great work.

  • @hoale9689
    @hoale9689 ปีที่แล้ว +1

    The illustration at 8:13 is the clearest explanation that I've ever seen

  • @Pharoah2
    @Pharoah2 4 ปีที่แล้ว +27

    This is by far the best channel I’ve found for programming. Perfectly paced for those of us with experience in other languages who need to pick up a new one quickly for a project. Thanks friend

  • @darrensapalo
    @darrensapalo 4 ปีที่แล้ว +184

    1:35 "And then I'm gonna sleep for half a second"
    Me at night

    • @AndrewRusinas
      @AndrewRusinas 3 ปีที่แล้ว

      hahahahahaha

    • @zuggrr
      @zuggrr 3 ปีที่แล้ว +3

      2:05 "So it will just do that until I kill it"
      Dwight Schrute with his chickens

    • @abhijithota6454
      @abhijithota6454 2 ปีที่แล้ว

      Bro I was going to comment "Every college student ever" on the same thing.

  • @amin32031
    @amin32031 2 ปีที่แล้ว +1

    This video is too great. not only shows how to work with goroutines, but also write a clean and optimized code using golang too. thanks a lot man

  • @thebahrimedia
    @thebahrimedia ปีที่แล้ว +2

    It's impressive that I watched your html in 12 minutes video a decade ago and it's the video that made me fall in love with coding at the time. Now that I'm learning go I'm also watching your video. I guess the student never outgrows the teacher.

  • @Someone-uo8jc
    @Someone-uo8jc 2 ปีที่แล้ว +1

    Perfect explanation of concurrency in Go. The best I've found on TH-cam 👍

  • @DieguitoJohnson
    @DieguitoJohnson 5 ปีที่แล้ว +99

    This is an amazing lesson. please do more Go videos.

  • @rohitbhanot7809
    @rohitbhanot7809 5 ปีที่แล้ว +39

    This is short, and crisp but damn at point. Good job mate !!

  • @cookiebinary
    @cookiebinary 3 หลายเดือนก่อน

    Great video. Finally someone explained it properly in depth, but still very straightforward, simple and understandable. Thank you.

  • @deathdogg0
    @deathdogg0 2 ปีที่แล้ว +1

    Some of the absolute best Go content on youtube. Thank you!

  • @Andrei_Bush
    @Andrei_Bush 4 หลายเดือนก่อน

    At first, I didn't understand it at all, but after a one repetetion, it become crystal clear! Thank you, Jake.

  • @afz902k
    @afz902k 4 ปีที่แล้ว +11

    After completing the golang tour, I was still not completely sure about the details of channels, goroutines, and select. I had read slightly about wait groups separately but this really brings it all together neatly and succintly. Great video and one I will probably be coming back to.

  • @burkaypehlivan5428
    @burkaypehlivan5428 5 ปีที่แล้ว +7

    this is by far the best tutorial about concurrency in go. thanks man, keep up the good work!

  • @TheR971
    @TheR971 6 ปีที่แล้ว +52

    Not gaing to lie, this video really makes me want to write a few cpp libraries to emulate this behaviour. It's gorgeous!

    • @VishalAnand24
      @VishalAnand24 6 ปีที่แล้ว +9

      I did the same in C# when I first saw it

    • @Peshyy
      @Peshyy 5 ปีที่แล้ว +5

      @@VishalAnand24 I'm interested in the performance differences between Go and your C# library. Could you please share your results? Also how many lines of code were needed for you to write it in C#?

    • @Qrzychu92
      @Qrzychu92 5 ปีที่แล้ว +9

      @@Peshyy making those channels is very easy, since you already have ConcurrentQueue which wrapper nicely would do exactly that. But to be honest I didn't have the same reaction - I just use observables to do similar things, and they can be "converted" to tasks to nicely wait for them to finish. This isn't as magick as you think :P

    • @nandhannatarajan2127
      @nandhannatarajan2127 4 ปีที่แล้ว +6

      or just use go lol

    • @tanieltari4539
      @tanieltari4539 4 ปีที่แล้ว +4

      @@SimonWoodburyForget I dont agree with you. Go is meant to be compiled to machine code and GC is just another lib linked into the executable. Meanwhile C# compiles to IL and machine code is produced on runtime, GC resides in the dotnet runtime. Sure JITing is fast, but it still has some overhead. On the other hand I do like C# syntax more, but thats just personal taste...

  • @everdrone97
    @everdrone97 2 ปีที่แล้ว +2

    By far the best practical explanation of go routines, love it

  • @stevekamga5977
    @stevekamga5977 3 ปีที่แล้ว +1

    By far the best tutorial about Go Concurrency, THANK YOU

  • @DavidDealAko
    @DavidDealAko 5 ปีที่แล้ว +4

    Great overview of concurrency in go. The pace of the video was spot on and touched the key points.

  • @GuitarDhyana
    @GuitarDhyana 5 ปีที่แล้ว +1

    This and your other Go video are phenomenal for those who want to tie everything together. Instead of just programming in Go, I can think and understand in Go! Very helpful - thanks.

  • @abhinalech
    @abhinalech 5 ปีที่แล้ว +31

    The best explanation about goroutines and channels. Good job dude. 👍

  • @adsg4692
    @adsg4692 3 ปีที่แล้ว +2

    Thanks Jake! Great explanation delivered at the perfect balance for new-comers wanting to understand Go's concurrency model.
    This is so much better than some of the other YT videos I've seen where the code is literally typed out as if that is enough for the viewer to understand how it is working and all hangs together!

  • @et4493
    @et4493 ปีที่แล้ว

    Absolute champion. Literally one of the best videos about programming I've ever seen. Thank you very, very much

  • @zzzfortezzz
    @zzzfortezzz 5 ปีที่แล้ว +5

    Man, I tried to learn Go in their original tour, and got confused many times in the concurrency section, but you, @
    Jake Wright clear them all.
    Thank you sooo much

  • @sbera87
    @sbera87 8 หลายเดือนก่อน

    This is brilliant.. Haven't ever seen such a packed yet clear video tutorial. Great work buddy

  • @badreddinlabed530
    @badreddinlabed530 4 ปีที่แล้ว

    I didn't fully understand go concurrency until I found this video, thank u soo much.

  • @figloalds
    @figloalds 4 ปีที่แล้ว

    That's a pretty good introduction to go's concurrency, just that, no more, no less, straight to the point, exactly what I was looking for.

  • @kaushikdr
    @kaushikdr 3 ปีที่แล้ว +1

    From what I understand, the `go` keyword puts a function into a task/promise, so that it can be fulfilled asynchronously or in the background.
    I had also (incorrectly) thought that all the calls, asynchronous or synchronous, had to finish before the program ended!

  • @crusader_
    @crusader_ 2 ปีที่แล้ว

    Man answered all the questions I had from watching the other tutorials

  • @GizmosShop
    @GizmosShop 3 ปีที่แล้ว

    Why would anyone thumbs down this video!!!! good job Jake, you are so right

  • @uzdik.student
    @uzdik.student 3 ปีที่แล้ว +1

    For Java developers learning Go :
    05:38 = CountDownLatch
    07:42 = ReentrantClock + Condition
    14:52 = SingleThreadExecutor
    16:07 = FixedThreadPool(4)

    • @philstallone1712
      @philstallone1712 2 ปีที่แล้ว +1

      5:38 or thread join, 7:42 ReentrantLock you mean. Good comparison. Much less code to write in Go it seems.

  • @jhoemarP
    @jhoemarP 3 ปีที่แล้ว

    i should say, your really good at teaching. i can grasp it easily

  • @TANVEER991164
    @TANVEER991164 2 ปีที่แล้ว

    lucidly explained a seemingly complex topic. Thank you

  • @dp-mason
    @dp-mason 5 ปีที่แล้ว

    You are a god send. I would have failed out of university years ago if it wasn't for people like you.

  • @salix_qmeou
    @salix_qmeou 3 ปีที่แล้ว +5

    your videos is amazing! Really clean and precise, it's everything that a programmer want from tutorials

  • @jan5310
    @jan5310 ปีที่แล้ว

    What a great short and to the point introduction to Go concurrency. Great examples. Thanks!

  • @jxiuh.861
    @jxiuh.861 ปีที่แล้ว

    best go concurrency video so far on youtube

  • @Baconator1368
    @Baconator1368 3 ปีที่แล้ว

    Wow pretty cool stuff. I just took an OS class and learned about how complicated concurrency is, and we went over the whole producer/consumer pattern where you need to manage your own conditional variables and mutexes. It seems like channels handle literally all of this for you at runtime!

  • @nikunj204
    @nikunj204 6 ปีที่แล้ว

    I must say this is a short but very concise intro to concurrency in go. I liked it.

  • @darshanshah6525
    @darshanshah6525 3 ปีที่แล้ว

    This is the best explanation I've found till now, thanks!

  • @Lyrik-Klinge
    @Lyrik-Klinge 4 ปีที่แล้ว

    Learning English I have to say that your pronunciation is very clear and soft.

  • @backpropagated
    @backpropagated 3 ปีที่แล้ว

    I wish classes could be like this. Just give me the simplest, fastest explanation, and let me pause/rewind as I need.

  • @geeshta
    @geeshta 4 ปีที่แล้ว

    A few days ago, I started playing Exopunks, a Zachtronics programing game and I really think it illustrates some of these concepts very clearly.

  • @GoddamnAxl
    @GoddamnAxl 5 ปีที่แล้ว +1

    Though most of the example are from gobyexample.com i still think every go beginner should watch this. Jake's explanation is superb.

  • @syw4049
    @syw4049 3 ปีที่แล้ว

    This is the best demonstration Iǘe seen in go channel. Thanks!

  • @anu8928
    @anu8928 2 ปีที่แล้ว

    Finally a video which explains it all in simple understandable words! Thank you!!😃

  • @texaslinux
    @texaslinux 2 ปีที่แล้ว

    This was the best explanation and illustration I've seen yet. Thank you!

  • @clementdato6328
    @clementdato6328 2 ปีที่แล้ว

    Wow. Always heard about how go is good at concurrency. This demo really gives that impression to a has-never-used-go guy like me. And the syntax is neat.

  • @Lorofol
    @Lorofol 4 หลายเดือนก่อน

    The anonymous goroutine wrapper function at 5:10 is exactly the structure my brain was telling me to make, where I already had multiple "complex" synchronous functions that I wanted to simply leave up to the implementor to decide when to make it run in another goroutine.

  • @soulfulman4834
    @soulfulman4834 ปีที่แล้ว

    Man this is awesome 🔥🔥 By watching this video, I got to understand each and every single details about concurrency in go. This is one of the best video on Golang... Thanks buddy 😊... Cheers ✌️

  • @erwinveenhoven7446
    @erwinveenhoven7446 7 หลายเดือนก่อน

    This is honestly such an amazing tutorial. Great job!

  • @ajinkyax
    @ajinkyax 5 ปีที่แล้ว +12

    @3:40 goroutines dont define their own suspensions or reentry point (joint).
    Go follows a model of concurrency called the "fork-join" model.
    These gorutines fork anytime during the execution of program to be run concurrently with its parent.
    The word JOINT refers to the fact that at some point in future these concurrent forks will join back together, its called the joint point.
    Since you dont have a joint point both functions are queued to be executed and then they just never got the chance to run before main goroutine exits.
    ==>
    To fix this we use sync.WaitGroup which added the joint point :)

    • @zerosandones701
      @zerosandones701 5 ปีที่แล้ว +5

      Newbies: this is pretty confusing and irrelevant to the point Jake's making

    • @holzerv5409
      @holzerv5409 4 ปีที่แล้ว

      @@zerosandones701

  • @jukkanikki3395
    @jukkanikki3395 2 ปีที่แล้ว

    Thanks. Well described. I was pleasantly suprised that Go has such a nice and compact syntax for concurrency stuff.

  • @cristianchavez5674
    @cristianchavez5674 3 ปีที่แล้ว

    Best video ever to understand go concurrency.
    Thanks !!

  • @licokr
    @licokr ปีที่แล้ว

    Wow, I got impressed how you explained very easily you got the point really well. Thank you!

  • @jaubaa
    @jaubaa 4 ปีที่แล้ว +5

    Thanks! This was just what I needed to wrap my head around the subject 👌

  • @Timbo101001
    @Timbo101001 9 หลายเดือนก่อน

    Probably the best explanation I've seen yet, nice one 👍

  • @shivanshanand8818
    @shivanshanand8818 3 ปีที่แล้ว

    Holy Shit!!! Go is really amazing. It really makes it easier for you to consume tough concepts like Mutex, Semaphores, and Concurrency which takes a lot of time, knowledge, and understanding when implementing in other languages. Really excited to try it out.

  • @jamescameron8140
    @jamescameron8140 3 ปีที่แล้ว

    Thanks for this video. just started learning Go for work

  • @jeremytweedie1452
    @jeremytweedie1452 3 ปีที่แล้ว +1

    A very good explanation indeed! Will definitely watch all of your other videos

  • @gauravdalvi3504
    @gauravdalvi3504 3 ปีที่แล้ว +1

    I really like the pictorial representation of concepts.

  • @igary
    @igary 5 ปีที่แล้ว +7

    Loved this video, I finally understand this

  • @simbelmyne0216
    @simbelmyne0216 ปีที่แล้ว

    Thank you so much for this video, we are trying to optimize our worker concurrency and this is exactly what I need

  • @bashtinator
    @bashtinator 2 ปีที่แล้ว

    Some people are good teachers! Amazing Job!

  • @mhkubaid
    @mhkubaid 3 ปีที่แล้ว

    Easy explanation with brilliantly organized examples!!

  • @DiegoTerzano
    @DiegoTerzano 3 ปีที่แล้ว +1

    Thanks Jake. Great introduction, all the relevant concepts of concurrency explained in simple terms with illustrative examples. Thank you very much!

  • @a4e69636b
    @a4e69636b 2 ปีที่แล้ว

    I am impressed by how simple go makes concurrency. It is way simpler in Go than in Python.

    • @a4e69636b
      @a4e69636b 2 ปีที่แล้ว

      @3:26 Just for fun here is the Python version of the program:
      import time
      from threading import Thread
      def main():
      Thread(target=count, args=("fish",)).start()
      Thread(target=count, args=("sheep",)).start()
      def count(thing):
      while(True):
      print(thing)
      time.sleep(0.5)
      main()

  • @gurunathaprasad
    @gurunathaprasad 3 ปีที่แล้ว

    This is GOLD.. Thanks a lot Jake

  • @Tuxedo_tux
    @Tuxedo_tux ปีที่แล้ว

    So well explained. After 4 years still on the money.

  • @linus.
    @linus. 3 ปีที่แล้ว

    Wow those channels are awesome. Way better than waiting for promises to resolve in js

  • @mwont
    @mwont ปีที่แล้ว

    The best vid about concurrency in go

  • @mentalview8703
    @mentalview8703 2 ปีที่แล้ว

    He knows his stuff. Thanks, Jake 👏

  • @pabloseren7447
    @pabloseren7447 ปีที่แล้ว +1

    QUESTION:
    hi jake, first of all thank you for the video, very good content.
    In the last script with workers, i'm not quite sure why the results loop wait for the result channel to send info.
    I mean, the main function is executed, and once its get to the last loop, it should go through it regardless the workers finished or not.
    would be understandable if you have a range over the result channel, for outputting the fib numbers
    hope this make sense, i have been thinking a lot. can anybody clarify?
    thanks!!

  • @LB767
    @LB767 6 ปีที่แล้ว +46

    Having never looked at Go, this seems infinitely better than all this async-await nonsense I've had to deal with in other languages...

    • @iliakorvigo7341
      @iliakorvigo7341 5 ปีที่แล้ว +3

      I haven't even worked in Go either, but this looks extremely similar to Python 3.5+ coroutines. Although coroutines add a nice layer of abstraction on top of async/await, you still have to think about thread-safety if you want to achieve true parallelism with them. At least, that's how it goes in Python. And I can't see, how any other impure language can be any different.

    • @alexp-ru
      @alexp-ru 5 ปีที่แล้ว +18

      async await are amazing, what the fuck are you talking about?

    • @ajinkyax
      @ajinkyax 5 ปีที่แล้ว +8

      basically you when you dont know about a programming language you will start bragging about it !

  • @RajiMalik-xh8jg
    @RajiMalik-xh8jg 5 หลายเดือนก่อน

    Thank you for such a short and clear video

  • @rahil_rehan
    @rahil_rehan 4 ปีที่แล้ว

    Best tutorial on concurrency ever.

  • @dmitrydmitriev2554
    @dmitrydmitriev2554 2 ปีที่แล้ว

    Very clear. Really understandable, very consistent explanation. Brilliant, amazing, great, cool, nice and super.
    Thank you.

  • @howardcai1851
    @howardcai1851 3 ปีที่แล้ว

    How is the job and result channel being controlled for access of multiple worker for them? Encapsulated within Chan? Interesting quick intro!

  • @VeneraVarbanova
    @VeneraVarbanova 3 ปีที่แล้ว +1

    Very good video, clear explanations, great examples! Thank you!

  • @zeinfahrozi7828
    @zeinfahrozi7828 3 ปีที่แล้ว

    Best explanation for Beginner

  • @amitauddy5955
    @amitauddy5955 4 ปีที่แล้ว

    Can you create a full course on go (like. Creating a Micro Service in Go from Scratch)? your explanations are very good.

  • @nikoladd
    @nikoladd 4 ปีที่แล้ว +1

    Pretty cool! I have no experience in Go, but the approach is somewhat similar in Rust and both are far clunkier then Erlang when it comes to concurrency constructs. Massive progress though in modern languages. I really like the relative simplicity(for a imperative language) of the tools available in Go. Both Rust and Erlang would be more efficient at actual paralellisation of the execution due to the extra constrains they take to remove side effects, but for most things (and competent planning) Go would be really close.

  • @oliverperssonbogdanovski5763
    @oliverperssonbogdanovski5763 2 ปีที่แล้ว

    Please more videos on Go, this is brilliant!

  • @JannisAdmek
    @JannisAdmek 2 ปีที่แล้ว

    This explanation is so clear and to the point, thank you!

  • @maximilianomonge5852
    @maximilianomonge5852 4 ปีที่แล้ว

    Great stuff!!! Coming from the PHP world! this is awesome! Thanks for this videos explaning everything very well! I watched this one and go in 12 minutes :)

  • @avantegarde9569
    @avantegarde9569 4 ปีที่แล้ว

    Thanks.. It was a wonderful introduction.
    I have a huge database containing multiple tables wherein I would like to execute multiple queries in concurrence.
    I have 3 questions:
    1) Can I execute multiple SQL Statements in concurrence ?
    2) I will be executing the SQL Queries on a popular RDBMS. Now is it necessary for
    the RDBMS to support concurrence. If yes, please answer for Oracle 11G and Mysql.

    In other words I want to know whether concurrency (which is linked to processor cores)can be made use of even if the RDBMS does not support concurrency ?
    3) Assume that I am executing 2 SQL statements in concurrence.
    Assume further that both these SQL Statements populate a common table with their output, how will I ensure that when the results of an SQL Statement is being populated, the 2nd SQL Statement will wait ? In simple words I do not want a 'deadlock' kind of thing. Whether this is possible using go ?

  • @anuragbisht1200
    @anuragbisht1200 2 ปีที่แล้ว

    you have great understanding of the language and thanks for the tuts.

  • @tennhard
    @tennhard 3 ปีที่แล้ว

    This was a great, to the point explanation of concurrency in Go. Very helpful!

  • @jdev_fr
    @jdev_fr 4 ปีที่แล้ว

    Thanks for that prez, was perfect to illustrate the/some strength of GO and get me fired up about it.
    Off to install it and start coding.

  • @chethan4519
    @chethan4519 6 ปีที่แล้ว +31

    Extremely curious about your job search.

    • @tibabalaseo2046
      @tibabalaseo2046 4 ปีที่แล้ว +1

      @Intelligence Injection Concurrency is not basic...

  • @ThisCanNotBTheFuture
    @ThisCanNotBTheFuture 4 ปีที่แล้ว +4

    Fantastic lesson. Question: At one point you mentioned that Go had not yet solved the Halting Problem. Do you think this will be included in the next release? 😉

    • @jeremy21212121
      @jeremy21212121 4 ปีที่แล้ว +1

      I imagine it will take an indeterminate amount of time

  • @HarshaVardhan-jf9sd
    @HarshaVardhan-jf9sd 4 ปีที่แล้ว

    Very sharp and precise explanation