![]() U1 and U2 have separate locks and as far as I can tell, thread1 just locks U1 and thread2 locks U2 since the _move method just uses self._lock and doesn't touch acc_to._lock. I do not see how there is a deadlock in that case. Th = threading.Thread(target=acc_from._move, args=(acc_to, amount)) ![]() ![]() elements of programming interviews in python pdf free download provides two extensive example quizzes at the end. elements of programming interviews pdf is also a useful toolkit for people who want to brush up on their programming skills or just improve their current ability. Return transfer(acc_from, acc_to, amount): This book is an interview preparation book for folks looking to get into the software development world in America. Since each transfer takes place in a separate thread its possible for the first thread to lock U1 and then the second to lock U2" class Account: PDF Room is a search engine where you can find and download free PDF books. This question from elements of programming interviews claims there is a deadlock in the following code in the scenario where "U1 initiates a transfer to U2 and immediately afterwards U2 initiates a transfer to U1.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |