Java Threading and Concurrency Introduction

Multi Threading is one of the most interesting subjects when developing applications, be them in Java or any other Language: The ability to have ones software performing multiple tasks at the same time, maybe handling multiple requests from users, parallel processing things… wicked stuff really!

On the other hand… when things go wrong with multi threading, they go wrong really fast, they go wrong all over the place, it is hard to debug (specially if threads “share” stuff) and you get the usual comment: “I just don’t get it why this is doing this”. Multi Threading is not without challenges!

In this Tutorial we’ll be going through a bit of theory regarding threads and the Java memory model, but I’ll try to make it as interesting as I can with examples and demonstration of concepts. We’ll see how stuff can go wrong, how to avoid those situations, and we’ll play with threads just to see them working! A more advanced tutorial will follow(at some point) in which I’ll discuss more advanced parts of Threads and Concurrency.

Read more of this post