Struggled with this in college, and you just saved my exam! Thank you. No need to have a lecturer when we have you.
@JakobJenkov2 жыл бұрын
Wonderful :-D Great to hear I have helped you! :-)
@mahesh958 Жыл бұрын
Followed this tutorial to build my application for the power plant I work at in Chernobyl. Hope nothing goes wrong. Thanks, Jakob.
@JakobJenkov Жыл бұрын
Well, the terms of service for Java actually says they do not recommend Java for use in nuclear reactors ;-)
@matimozg Жыл бұрын
What a nice and smart code, you're really professional coder, it's pleasure and challenge learning from you
@JakobJenkov Жыл бұрын
Thank you - glad you are getting something out of my videos :-)
@มักโชคดี Жыл бұрын
Solution 1 : UML analysis. Solution 2 : a registerar object, registering every lock by thread and delivering authorisation at locktime and/or release orders.
@JakobJenkov Жыл бұрын
There are many smarter algorithms out there than what I present in this video... here I mostly just present the main ideas !
@มักโชคดี Жыл бұрын
@@JakobJenkov Thanks for your Videos they are of great Help 👍
@vinitamaloo107 Жыл бұрын
Thank you for the great documentation on your website. I love the content.
@JakobJenkov Жыл бұрын
Thank you :-)
@shelendrasharma96803 жыл бұрын
Hi Jakob. Nice explanation. you are a mastermind in java.
@JakobJenkov3 жыл бұрын
Thank you ! :-)
@-boiadeiro-3 жыл бұрын
nice topic just about the time (learning threads and all that stuff from your site) thanks by the way! very handful and clear explanation
@JakobJenkov3 жыл бұрын
Great to hear ! :-) ... I am updating my Java concurrency tutorials at the moment, by the way. Not huge changes, but some clarifications here and there.
@DeepakLalchandaniProfile3 жыл бұрын
Hi, is the twitter handle active ???
@JakobJenkov3 жыл бұрын
Not yet - but they are working on it inside Twitter - it got hacked - they are working on returning it to me!
@DeepakLalchandaniProfile3 жыл бұрын
@@JakobJenkov yes I know, get it fixed. 😭😭😭😭
@krzmaciek60103 жыл бұрын
5:20 Hmm... I think that amount of time must be random to acutally help. 5:25: "The amount of time is random" :D
@JakobJenkov3 жыл бұрын
Yes, each thread should wait a slightly different amount of time to avoid a deadlock ! :-)
@amajor5460 Жыл бұрын
With the deadlock detection example, would you not allow a thread from acquiring a lock if you can predict using the graph that it would result in a deadlock state? Perhaps it can try to acquire the lock again after some time.
@JakobJenkov Жыл бұрын
You could do various variations of intelligent deadlock detection. Like you suggest, instead of simply detecting when a deadlock has happened - it could also predict that a deadlock _would_ happen if a thread acquired a given lock, and then deny that lock to the thread.
@DeepakPatel-xl3tr Жыл бұрын
Great💥
@JakobJenkov Жыл бұрын
Thanks 😊
@senwang86702 жыл бұрын
Thank you for these great videos Jakob. I am new to multithreading, and have a question after viewing your graph at 15:00 min. So why does a thread have to lock another lock first and then release the lock it has already locked? can a thread release its lock first, and then try to lock another lock? if yes, wouldn't this reduce the chances of getting into deadlock?
@JakobJenkov2 жыл бұрын
Hi Sen, I am glad you liked my videos :-) In some cases a thread can unlock the first lock before locking the second. However, in some cases a thread really need to hold 2 locks before it is thread safe to execute the code of some critical section. It all depends on your code and design. My example simply shows how it can happen. It is then up to you to change your design to avoid it happening ;-)
@quantumlexa3 жыл бұрын
I'm sorry, but that's lol. 07:28. Math.random returns you a double within the range [0.0 - 1.0]. by casting it to long you effectively don't sleep at all, cause it will almost always return zero. please see line 26
@JakobJenkov3 жыл бұрын
Ah - true ! The cast is in the wrong place! Nice catch! It should be: (long) (100.0 * Math.random()) This is one of the mistakes that sometimes sneak into these video examples. Quite often such mistakes would be caught via a unit test in a real project ... there you could have caught that the sleep time is somehow always zero :-)
@ffatheranderson3 жыл бұрын
I was typing in live chat.... Though you saw it... I did not know what is "premier", I thought you were "Live". 😥
@JakobJenkov3 жыл бұрын
Ah, sorry, I normally watch my Premiere's live with the audience - but most of the time there are no questions in the chat :-D ... anyways, the chance is higher of me seeing your comments in these comments below here. By the way, since this is a recorded video, you can just go back to the beginning yourself. You can actually also do that with "live streams". If I get into a live stream after it has started, I often go back to the beginning of the live stream and watch from there. Then, sometimes, I set the playback speed to more than 1.0 - so that I will eventually catch up with the live stream :-)
@rydmerlin Жыл бұрын
The lock example would be easier to follow if you just relied on the parameter order to the runnable to switch the order.