Kotlin Coroutines: Explore what are coroutines in kotlin. Threads vs. Coroutines

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

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

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

    00:00 Welcome
    00:27 Threads vs. Coroutines
    04:13 Coroutines Intro
    05:22 Coroutines Properties
    06:39 Implement Coroutines
    19:02 delay function
    24:25 suspend function
    25:29 runBlocking lambda
    30:19 Custom suspending function
    31:29 Summary
    32:42 What's next?

    • @RupeshKumar-eo1mi
      @RupeshKumar-eo1mi 3 ปีที่แล้ว

      Your Explanation is good but in some point you skiping that point like you explain suspending function is a function with suspend modifier but you sir what is suspend modifier?

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

    MAN! i look 1000 videos, READ 100000 books, i made 1000000 steps in this way, to anderstand about coroutines - BUT only your video HELPS ME!!!! THANK YOU VERY VERY MUCH from RUSSIA!!!!! you the BEST!!!!

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

    i am with you from 9 years. I am a senior developer right now just becouse of you . thank you for your lessons.

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

    Awesome Explanation Thanks for explaning in such an easy manner , Waiting for next video.

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

    the best Channel and the best teacher on TH-cam, thanks
    could you please do more deep Kotlin tutorials
    thank you for your hard work

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

    This is the best coroutines tutorial I have found, thank you so much!

  • @AmanSharma-cv3rn
    @AmanSharma-cv3rn 3 ปีที่แล้ว +3

    this can't be explained in much simpler way, Thanks Man❤️

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

    I love your explanation...simple and straight forward. Thanks a lot. Am waiting for another series like this on another android concept...

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

    Thank you!! This was helpful, clear, concise and made simple to understand

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

    This is the best coroutine explanation so far.

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

    Loved the way you introduced coroutines in devfest 2021 and now following your playlist ✌️

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

    You are the best teacher i have ever seen, i am not beginner in android , i know java, i come here to get something about kotlin. but you are really good at teaching. thank you. you should do it everytime

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

      Thanks buddy

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

    Hi, thanks for the video. Good work on showing examples with code.
    I have a some concerns with some parts though -
    1. Coroutines are NOT threads, they are not even LIKE threads. If anything, there are similar to a generator function in python or javascript - simply a function that can be paused and resumed. If you define them in main thread, they will run on main thread, if you define them on background thread, they will run there, that is all.
    2. There is a big difference between "parallel" and "concurrent" - Threads can run in parallel, independent of each other. Co-routines must run concurrently, more than one cannot be run at the same time (on same thread). As an example of difference between the two - Say there are 2 threads A and B each requiring 2 seconds of execution time. Running in parallel, they both will complete in 2 seconds total. Now, consider 2 co-routines A and B again requiring 2 seconds each. At best, they will take 4 seconds to complete, even running concurrently (1s A -> 1s B -> 1s A -> 1s B).
    3. As a direct consequence of number 2, the reason you cannot call a "suspend" on co-routine outside of it is because nothing else is running while the co-routine is executing.
    My 2 cents. Again, thanks for the content.

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

    Your way of teaching... just awesome....❤️
    Please keep continue of making tutorial on Kotlin.

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

      Thanks you very much

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

    Why haven't i found this channel previously ...Such great explanation!!Thanks 🙌

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

    Amazing explaination. I really thankful to you because you made this topic easy to understand by taking baby steps though your explanation.

  • @Explore-world-
    @Explore-world- 2 ปีที่แล้ว

    From college days to senior developer, I'm following you!

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

    Thank you so much. Most an awesome part of kotlin, please make videos about kotlin generics.

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

    I learned android with java from your Pluralsight Courses and i believe you are the best instructor! but few months later i switch to the flutter and i hope see your new videos with flutter. Thanks for everything.

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

      Just curious why did you switch to flutter?

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

    I am just wondering how much patience and plans it took to make this video. It was helpful. Thanks.

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

    Thank you for making my android life easier. Finally found one good channel for android 🤝

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

    Such a clear explanation 🙏🏿

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

    Great video to understand Coroutines, delay and suspend. Thank you !!

  • @ashishkumar-ql8rr
    @ashishkumar-ql8rr 2 ปีที่แล้ว

    Simplest explanation that I came across.
    Thanks man.

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

    Thank you a lot for a good tutorial , i have never seen such kind of good tutorial. Your manner of teaching awesome☺

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

    It is simply the best corutines tutorial. Thanks for sharing

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

    The best thing is they don't have ads in between videos, so that I don't skip their ads at beginning.

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

    Thank you very much.
    The easiest explanation of this topic

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

    Great content ! thanks for this great effort !!

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

    Best Coroutines tutorial, Love it

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

    Dude, what a video. Wonderful way of explaining. Thanks!

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

    Very clear explanation, Thank you

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

    What an explanation 🙏🙏 , loving your videos ♥️

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

    Very nice explanation. I read some topics but still got some clarity. Thanks.

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

    Thanks a lot...Your videos are really helpful

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

    Thank you so much for this great tutorial!

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

    Thank you. Your explanation very easy to understand.

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

    Thankyou, awaiting for another part

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

      On the way

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

    You had convinced me to subscribe your channel in just first 10000 mili seconds. Great job sir 👌 Thank you ❤️

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

    Amazing sir g, i have watched all your videos. Love from Pakistan

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

    Superb explanation!

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

    Great explanation in simple manner... Please keep it up... 👍

  • @ArjunVerma-lq4cf
    @ArjunVerma-lq4cf 3 ปีที่แล้ว

    great video and always explain this much don't think of video time length

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

    Please sir you have covered a lot of things in Kotlin in an awsome way but some topics is still untouched by you like covariance and contravariance which is also very important to know if we learn kotlin for the android app development. Without covariance and contravariance it feels like we are missing very important topics. So I kindly request you to pls make some videos on them.

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

    Excellent explanation.

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

      Glad it was helpful!

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

    thanks brother, please make more these kinds of videos. nice explained, so easy to understand

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

      See links in description for more Coroutine videos

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

      @@smartherd thanks brother. i am watching

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

    Good one, thanks for the upload

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

    This was very helpful...It helped me clear my concepts.Thanks

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

    Very very helpful thanks

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

    Great.... starting from scratch thank you

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

    Cool video bro. Clear explanation.... Loved it

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

    Clear explanation, thank you.

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

    Huh waiting is over!! Please keep doing videos

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

    Thank you, Pls create a playlist on scoped storage. No good content available on internet.

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

    Great video thanks

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

    Explanation was Awesome in simple manner. Good Work. Please do more videos on rxjava and react native. Thank you🙂

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

    Thanks a lot for this, Really Helpfull !!

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

    Great Explanation!

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

    Best series ever i've seen. take love from #BD❤️

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

    Best explanation keep it up

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

    Great tutorial. Thanks Sriyank

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

    Thank you:) Best basic information

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

    amazing video...waiting for next videos in series

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

    Well taught, thanks!

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

    Best tutorial. Take love from bangladesh

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

    Thank you sir

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

    very well explained. Thank you.

  • @AswiniParakala
    @AswiniParakala 10 หลายเดือนก่อน

    Thank you

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

    nice explanation

  • @NehaSharma-ji3pi
    @NehaSharma-ji3pi 2 ปีที่แล้ว

    nice way to teach

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

      Thanks and welcome

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

    very good explanation ... keep it going. Thanks.

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

    Please make video on covariance, contravariance in kotlin

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

    thanks

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

    your are just awesome

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

    My Dear, top explainer!!!

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

    hello! please tell me what is the difference between a delay(5000) function and a real function that takes 5 seconds to complete?

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

    Kindly provide a video series on flow (coroutines)
    As soon as possible

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

    very good explanation sriyank

  • @1983murugesh
    @1983murugesh 3 ปีที่แล้ว

    Thank you , It's great tutorials :)

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

    thank you very much!

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

    8:25 In kotlin 1.6.21, the `jcenter()` in `build.gradle` is not necessary.

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

    Hi sir you always make me happy with your tutorials. Are you also on udemy?

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

    Super,super,please do video on Kotli Flow coroutine sir

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

      Sure, in progress

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

      @@smartherd how to handler errors,i wrote but its getting repeated , globally without rewriting error code everytime in activity or fragement sir,ca n you please tell me sir..

  • @ajayking-nd2bk
    @ajayking-nd2bk 3 ปีที่แล้ว

    well Explanation

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

    Great. Siddharth. :)

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

    Please put a video on running coroutines parallel.

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

      On the way

  • @2412Anand
    @2412Anand 2 ปีที่แล้ว

    can you make detailed video series over android unit testing from scratch?

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

    IS mathematical operations comes under the main thread ?? i mean complex mathematical problems

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

    Waiting for next video

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

    Great video. Cleared many confusions for me. At 6:25 you say coroutines are light weight threads but they are also not threads. Isn't this contradicting statement?

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

      they are considered to be 'light-weight" but behaves like real threads. Which means, they aren't actually threads.

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

    how much time coroutines tack , how to decide by delay outside coroutines?

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

    You said that Multiple coroutines can run on same thread. In that case how can we guarantee mutual exclusion in coroutines. Can we use "synchronised" keyword here too just like we do in normal threads?

  • @AsifKhan-qj2rw
    @AsifKhan-qj2rw 3 ปีที่แล้ว

    Sir, please upload next video on coroutine

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

      Kindly check description for next video

    • @AsifKhan-qj2rw
      @AsifKhan-qj2rw 3 ปีที่แล้ว

      @@smartherd I mean 6th video

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

    sir please do a video on safe api call with coroutines and error handler globally sir

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

    So, can't we do loadsharing by creating coroutines on Main thread as well as on background thread? And it they are lightweight, why not to create them on MainThread only?

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

    if we create multiple coroutines on a single thread, will it not block that single thread again?

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

    Sir plz make more videos on flutter

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

      Not right now but soon

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

    Seriously dude, why aren't you one of the staff in Google's Android training team?
    You would make our lives so much easier...

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

      I am flattered

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

    where have you been all my life

  • @NehaSharma-ji3pi
    @NehaSharma-ji3pi 2 ปีที่แล้ว

    👍