Learn Java Programming - Introduction to Multithreading Tutorial

Publicado em: 18 Dezembro 2015
no canal de: 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.


Nesta página do site você pode assistir ao vídeo on-line Learn Java Programming - Introduction to Multithreading Tutorial duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário Daniel Ross 18 Dezembro 2015, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 1,540 vezes e gostou 18 espectadores. Boa visualização!