#86 Multiple Threads in Java

Поделиться
HTML-код
  • Опубликовано: 9 фев 2025
  • Check out our courses:
    Java Full Stack and Spring AI - go.telusko.com...
    Coupon: TELUSKO10 (10% Discount)
    DevOps with AWS: From Basics to Mastery : go.telusko.com...
    Coupon: TELUSKO10 (10% Discount)
    Master Java Spring Development : go.telusko.com...
    Coupon: TELUSKO20 (20% Discount)
    For More Queries WhatsApp or Call on : +919008963671
    Udemy Courses:
    Spring: go.telusko.com...
    Java:- go.telusko.com...
    Java Spring:- go.telusko.com...
    Java For Programmers:- go.telusko.com...
    Python : go.telusko.com...
    Git : go.telusko.com...
    Docker : go.telusko.com...
    website : courses.telusk...
    In this lecture we will learn:
    Multiple Threads in Java
    How to create a thread?
    How we can do parallel programming?
    start() and run() methods in multithreading
    Time-sharing between multiple threads
    #1
    When you build an application, we use certain frameworks and behind the scene, these frameworks will create threads.
    Every statement runs in a sequence in the main method.
    If you want to execute two behaviours to execute at the same time, then we can use threads.
    We can not execute normal objects in multiple threads or normal objects can not be executed simultaneously.
    #2
    Java provides a Thread class to achieve thread programming. The thread class provides constructors and methods to create and perform operations on a thread.
    A thread can be created by extending the thread class. The thread class can be extended through the Thread keyword.
    By using the Thread keyword with class, it will not create a new thread.
    #3
    We have to use the start() method in the main to start the execution of a new thread.
    start() is a method that is present inside the thread class. start() method only calls the run method.
    Start() invokes the run() method on the Thread object.
    run method should be present inside every thread to start a new thread.
    run() method is used to do an action for a thread.
    #4
    All threads cannot run at the same time, so threads go for the time sharing.
    -In this time-sharing Operating system, many processes are allocated with computer resources in respective time slots.
    Scheduler is responsible to allow which thread to execute at what time.
    Github repo : github.com/nav...
    Java:- bit.ly/JavaUde...
    Spring:- bit.ly/SpringU...
    More Learning :
    Java :- bit.ly/3x6rr0N
    Python :- bit.ly/3GRc7JX
    Django :- bit.ly/3MmoJK6
    JavaScript :- bit.ly/3tiAlHo
    Node JS :- bit.ly/3GT4liq
    Rest Api :-bit.ly/3MjhZwt
    Servlet :- bit.ly/3Q7eA7k
    Spring Framework :- bit.ly/3xi7buh
    Design Patterns in Java :- bit.ly/3MocXiq
    Docker :- bit.ly/3xjWzLA
    Blockchain Tutorial :- bit.ly/3NSbOkc
    Corda Tutorial:- bit.ly/3thbUKa
    Hyperledger Fabric :- bit.ly/38RZCRB
    NoSQL Tutorial :- bit.ly/3aJpRuc
    Mysql Tutorial :- bit.ly/3thpr4L
    Data Structures using Java :- bit.ly/3MuJa7S
    Git Tutorial :- bit.ly/3NXyCPu
    Donation:
    PayPal Id : navinreddy20
    www.telusko.com

Комментарии • 48

  • @dhanvanthnarayanan7604
    @dhanvanthnarayanan7604 9 месяцев назад +16

    The analogy you gave for the two functions - start() and run() is something I would tell even if you were to wake me up and ask in the middle of my sleep
    holy smokes man , such a good explanation
    keep up your good work sensei
    arigato !!!

  • @Mona-3
    @Mona-3 Год назад +108

    Every one searching thread app and I am searching thread in java😢😢

  • @sathishbabu7824
    @sathishbabu7824 11 месяцев назад +3

    No one can explain better than this. True masterclass.

  • @krishnamoorthysridhar8536
    @krishnamoorthysridhar8536 Год назад +10

    Sir, Excellent Explanation.. The way of explaining the concept is so clear. Thanks a lot..

  • @roshansreevastavroshansree6542
    @roshansreevastavroshansree6542 7 месяцев назад +7

    00:03 Threads are often automatically created by frameworks in applications.
    01:31 Two classes with different names and methods are created and objects are created to call the methods
    02:52 Execution of show method causes a hold on the main method until it is done executing
    04:19 Executing multiple behaviors simultaneously using threads.
    05:54 Creating two new threads in Java
    07:18 In Java, when using threads, the start method does not directly call the run method.
    08:46 Parallel execution of code using multiple threads
    10:13 Time-sharing scheduler allows executing multiple threads on a CPU with limited cores.

  • @gilberthg3868
    @gilberthg3868 Год назад +2

    So cool man, you explained the concept of the thread working in computer, while the other course don't. Really appreciate it! Thanks!

  • @abishekathangaselvam6673
    @abishekathangaselvam6673 Год назад

    Excellent sir,u r really great many u tubes simply waste peoples time ,the time become precious or investment if spending on watching ur tutorials,no college tutors taught as how u r teaching hands up sir ❤❤❤

  • @LV-ni2zu
    @LV-ni2zu Год назад +4

    Sir does all the misunderstandings and mistakes inside the tutorial so we don't need to do it and scratch our heads🙌🙌

  • @nachiketnijap6990
    @nachiketnijap6990 Год назад

    Man what the way of explaining ❤

  • @jagadeeshranganath6518
    @jagadeeshranganath6518 5 дней назад

    very well explained

  • @snehapanchbhai3549
    @snehapanchbhai3549 2 месяца назад

    good video...very clear in concept

  • @taha7shaikh
    @taha7shaikh Год назад

    Thank you very very much, your way of explanation is really amazing

  • @vaishali5.r
    @vaishali5.r Год назад

    Excellently explained. Thank you so much

  • @sahanagowda9123
    @sahanagowda9123 Год назад +1

    Superb👏

  • @likevideo00
    @likevideo00 5 месяцев назад

    thanks a lot Navinji

  • @TheNikhil8597
    @TheNikhil8597 Год назад

    waahh....brilliantly told

  • @sasmita9179
    @sasmita9179 6 месяцев назад

    Use while loop to execute

  • @jayant6155
    @jayant6155 Год назад

    One of the best thumbs in youtube

  • @sayankarmakar13
    @sayankarmakar13 Год назад +1

    What a video ❤

  • @AdityaSoni-ss9cq
    @AdityaSoni-ss9cq 5 месяцев назад

    Good video 👍

  • @maleeshasandakalum6213
    @maleeshasandakalum6213 Год назад

    Thank you sir❤❤

  • @saqibullah7286
    @saqibullah7286 Год назад +6

    Love from Pakistan 🇵🇰🇮🇳

  • @ChadRao
    @ChadRao 6 месяцев назад

    Sir can you please say about the singleton design patterns and creational patterns and behavioural and structural patterns sir you teaching so understandable please sir for me it's being so tuff to learn

  • @morukurthianitha3751
    @morukurthianitha3751 4 месяца назад

    Super 🎉

  • @ragulparajuli214
    @ragulparajuli214 Год назад +1

    How do you get to see all the class details in vs code. Do we need to do something to see like that

  • @91-ritikjain36
    @91-ritikjain36 2 года назад +7

    please sir make the new video of Servlet and JSP tooo

  • @m.rediter9693
    @m.rediter9693 19 дней назад

    2:59 haaa

  • @numeric_code
    @numeric_code Год назад

    ❤❤❤

  • @pain2866
    @pain2866 11 дней назад

    6:30

  • @nagarajukolar2121
    @nagarajukolar2121 5 месяцев назад

    what happens when we call run() method instead of start() will it give same output

    • @karankaira
      @karankaira 5 месяцев назад

      it will not create a thread, output will be 100 hi , and then 100 hello

  • @_HanuSaiR
    @_HanuSaiR Год назад

    Sir I have one dout..if I learn only core Java ..is ok for my placements

    • @vaibhavgupta973
      @vaibhavgupta973 Год назад

      -> for on campus placements core java is enough for normal SDE role, but for java role core java is not enough you need to learn atleast springboot,
      -> for off campus placements core java only it is not enough, need to learn spring, spring boot, must have projects on java.

  • @Grow_with_Tech1
    @Grow_with_Tech1 2 года назад +3

    Anna channel name telugu lo telusko ani pettaru explaination kooda telugulo chesthey chaalamandhi ki help idhi anna.............already pevious playlist english loney chesaaru.... ardhamcheskoni telugulo explaination isthaarani anukuntunnaam..... Exams kooda jaruguthunnaay kabatti chaala help avthundhi...Thank you

    • @vinny4161
      @vinny4161 2 года назад +1

      English lo chepthe chala mandiki use avuthundi bro terms kuda gurthuntai

    • @saichaitanya8488
      @saichaitanya8488 2 года назад

      Software industry loki vachaka English tappa vere dari undadhu bro...i think content is at its best

  • @manthanmoudgalya5271
    @manthanmoudgalya5271 11 месяцев назад

    how is he able to get documentation of java in vs code

    • @saivamsy2275
      @saivamsy2275 11 месяцев назад

      Hold the ctrl key and click.

  • @letnaturespeak6155
    @letnaturespeak6155 Год назад

    If producer endpoint is slow itself then will threads benefits improving performance of consumer application?

  • @Everything_at_one_platform
    @Everything_at_one_platform 2 года назад +1

    println ke andar x: ye kya hai

    • @Telusko
      @Telusko  2 года назад +4

      Given by vs code to show the variable name.
      Not part of the code

  • @jackfrost8969
    @jackfrost8969 6 месяцев назад

    2365 threads? Are you sure about that?