Java Threads Tutorial 1 - Introduction to Java Threads

preview_player
Показать описание
In this Video I am going to give an Introduction to Java Threads. I will discuss, What is a Thread in Java. Then I will provide the Java Threads Overview. Threads is an Individual and separate unit of execution that is part of a process. multiple threads can work together to accomplish a common goal.Threads allow the program to run tasks in parallel. In many cases threads need to be synchronized,
that is, be kept not to handle the same data in memory concurrently. There are cases in which a thread needs to wait for another thread before proceeding

★★★Top Online Courses From ProgrammingKnowledge ★★★

★★★ Online Courses to learn ★★★

★★★ Follow ★★★

DISCLAIMER: This video and description contains affiliate links, which means that if you click on one of the product links, I’ll receive a small commission. This help support the channel and allows us to continue to make videos like this. Thank you for the support!
Рекомендации по теме
Комментарии
Автор

Way more depth than I was expecting. Thanks for the solid explanation.

dukkhan
Автор

Thank you so much. they way you speak is slow and each words is so clear to understand. otherwise other tutorial "even paid" speak so fast that it is hard to understand

reemasharma
Автор

nice sir, keep going on for more tutorials 👍

SmartProgramming
Автор

Thank you great video! Other videos and tutorials were discussing threads like they were talking to pro programmers.

mazedesign
Автор

Well explained, thank you from the US :)

prim
Автор

wow I am really pleased with this material you have done a good job out there

brunofilgueiras
Автор

well thawt was a pretty good tutorial on Java Threads. I just wish that you offered more than just 2 parts of it.

steveburrus
Автор

Wow, this was what I had been looking for... thanks for sharing this useful knowledge.

kokeba
Автор

nice speaking voice! most channels like this are really hard to understand and have bad audio

pffree
Автор

Thank you for helping me understand this. Great video!!

Mumma
Автор

Thanks a lot.you have explained it so clearly.

Satyarth
Автор

You are Awesome. Thanks for nice explanation.

satyamgadadas
Автор

thanks brother. This is a wonderful explanation

mohamedhassan
Автор

Really good Stuff, can you please make and upload more videos on advanced java.

nagarajutharigoppula
Автор

can we use both extending and runnable interface read and write the same data from some

central/universal location?

arkoprotoghosh
Автор

can you please upload more videos on advanced java?

MarijanaCirkovicserbia
Автор

at 9:40 you said the main method is defined by the thread,
but text says the main method defines the thread.
which is true?

thinkingaloud
Автор

Problem with the Code
There is a serious issue with the code: the count variable is not synchronized, which means that due to the race condition between the threads, the result will not be accurate. The count++ operation is not atomic, so it is possible that both threads try to increment the variable simultaneously, leading to an incorrect result. public class EclipseBeallit {
private static int count = 0;
private static final Object lock = new Object();

public static void main(String[] args) {
Thread t1 = new Thread(new Runnable() {
@Override
public void run() {
for (int i = 0; i <= 10000; i++) {
synchronized (lock) {
count++;
}
}
}
});

Thread t2 = new Thread(new Runnable() {
@Override
public void run() {
for (int i = 0; i <= 10000; i++) {
synchronized (lock) {
count++;
}
}
}
});

t1.start();
t2.start();

try {
t1.join();
t2.join();
} catch (InterruptedException e) {
e.printStackTrace();
}

System.out.println("Value -> érték: " + count);
}
}

jozseftoth
Автор

Chrome built on V8 how it will run as a multi threading.

BharathiFromSouth
Автор

He doesn't know what he is talking about, he is seriously wrong and extremely confident in his speech

harshsaxenait