Learn Java Programming - Introduction to Multithreading Tutorial

Veröffentlicht am: 18 Dezember 2015
auf dem Kanal: Daniel Ross
1,540
18

Every time you invoke a class containing the main() method you are running your compiled bytecode on a single thread called the main thread. When it comes to threads, the main thread is super important. Java gives us the ability to create and spawn child threads from the main thread. Why on earth would we want to create additional threads? The answer to that question is only learned through experience ... the kind of experience that makes your program appear to be hung up in an endless loop! Let me give you a couple of examples.
...
At the top of the thread hierarchy is a class named Thread and an interface named Runnable. Every thread has a life cycle. The life cycle of a thread is well defined into a total of six states:

NEW - A thread has been declared, but has not yet started is in this state.
RUNNABLE - In this state a thread is executing in the JVM.
BLOCKED - In this state a thread is blocked waiting for a monitor lock or intrinsic lock. I'll explain in later down the road.
WAITING - A thread that is waiting indefinitely for another thread to perform a particular action is in this state.
TIMED WAITING - A thread that is waiting for another thread to perform an action for up to a specified waiting time is in this state.
TERMINATED - A thread that has exited is in this state.


Auf dieser Seite können Sie das Online-Video Learn Java Programming - Introduction to Multithreading Tutorial mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Daniel Ross 18 Dezember 2015 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 1,540 Mal angesehen und es wurde von 18 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!