If you are not careful, you can cause a processor to come to an immediate and full stop while it waits for data to move around in memory. That is probably not the performance boost you were looking for.
There is more to working with multithreading than locking code and avoiding deadlocks. You also need to know how to synchronize activities. It is not so hard once you understand.
The design decisions you make affect not only how well you can maintain your code but also how well others can use your code. Multithreading adds a new dimension to your designs and I will give you some of my thoughts in this episode.
Deadlocks are another common problem with multithreading. I will explain how you can get into this situation and how to change your code to avoid the problem.
Anytime a thread tries to access some memory or resource that another thread can change, you have a race condition. There is no winner for this kind of race. The whole application will lose.
There are several ways to make better use of the capabilities of your computer. Multiple threads allow your application to perform multiple things at the same time. With this power comes a lot of responsibility and you should also realize that it is not the answer to everything.
11 min
About Take Up Code
From the publisher's feed
Take Up Code is a podcast that explains computer programming topics through fun and engaging examples that you can relate to. The guided format allows you to gain valuable understanding of topics that…
will reinforce your studies, allow you to train new skills that you can apply on your job, and change your thinking about what it takes to become a professional programmer. The episodes are as short as possible so you can squeeze them into your daily routine.