13.5 MultiThreading join and isAlive method in Java

preview_player
Показать описание
In computer science, a thread of execution is the smallest sequence of programmed instructions that can be managed independently by a scheduler, which is typically a part of the operating system.
Multithreading in java is a process of executing multiple activities can proceed concurrently in the same program.
Thread is basically a lightweight sub-process, a smallest unit of processing.
In multithreading threads share a common memory area.
They don't allocate separate memory area so saves memory, and context-switching between the threads takes less time than process.

Multiple threads can exist within the same process and share resources such as memory, while different processes do not share these resources.
Using two different task at the same time means multi-tasking. Thread is unit of a process.

Follow on Facebook:

Subscribe to our other channel:
Telusko Hindi :

Subscribe to the channel and learn Programming in easy way.

Рекомендации по теме
Комментарии
Автор

I am from Bangladesh..Nothing to say..But you are awesome

mywebsite
Автор

Either t1.join() or t2.join() is sufficient. The thread from which join is called (ie. the main thread in this example), will exclude itself from executing until the other threads complete and joins them at the end.

shashankmarri
Автор

t1.Alive() and t2.Alive is called in the main thread,

So the correct explanation is the main thread will wait for both t1 and t2 thread to complete its execution only after which it will print "bye".

likithr.n
Автор

So the meaning of "join" is t1 and t2 will join back main thread after they finish their own thread. So main thread has to wait for their join.

小江-ji
Автор

Awesome video!! I never understood till watching this :)

ferfykins
Автор

sir i inspired on u very good tutorials i learned new day by day thank u ...

zeeshanalamgir
Автор

Hey very nice video. I'm big fan of you now. keep up the good work

pallavi
Автор

Great Great Tutorial!
Please can you Number/ Identify your videos sequentially. Like = "MULTI-THREADING PART 1", "MULTI-THREADING PART 2", "MULTI-THREADING PART 3" and so on... So we can follow your lesson properly and not jump. THanks

calebolojo
Автор

I think only one join() either in Thread1 or Thread2 is enough to join other thread.
Correct me if I am wrong.

satyaprakashtiwari
Автор

Please make a video on Atomic operations for Multithreading! Thanks

avegeta
Автор

Helli sir i have a problem in this example join and isalive method not working and not taking the output is same as example please answer

mukhtarali
Автор

Hi Sir, here we have throws exception .but not handled with try catch.since it is runtime exception we can do so?

Please reply

surendars
Автор

It does not work with THREAD CLASS by implementation of run method why ? I wrote same code using Thread class it is not executing why ??

damanpreetsingh
Автор

why we are using throws exception with join()
And what kind of exception will be?

anikeatbansal
Автор

sir what will be happen if t1 is not called join but t2 is called join..

javascriptwar
Автор

Thread t1= new Thread(()->

Thread(()->
When we write "()->" whats this?

Is it same as -
new Thread(new Runnable(){
});

techie
Автор

What if we simply print Bye after ending the scope of thread

AdmirableShift
Автор

Hey quick question, can you describe .join is this a blocking/non-blocking in regards to the UI thread? Great video thank you :)

VictorNolochemical
Автор

instead of join(), why can't we use finally keyword there?

sambittarai
Автор

You haven't written extend thread

omprakashkatre