Live data from Hacker News

Ask HN: How to learn concurrency?

news.ycombinator.com

11–20 of 22 posts

Re: Ask HN: How to learn concurrency?

#11

That's a huge topic but I would say implement a hobby project and learn by doing. Pick something you're interested in and start writing code to exercise the theoretical concepts. A small piece of advice is to make sure you're motivated before diving in. Debugging a race condition, just as an example, can be quite involved and consume a lot of your time and energy to even reproduce.

But what is a good hobby project with a strong focus on concurrency that will not swamp a beginner to this topic?

I started by writing a user interface that handled they keyboard events in a thread and communicated to the main thread using a message queue. IMO that's a good easy first step :)

Re: Ask HN: How to learn concurrency?

#13
1) Foundations of Multithreaded, Parallel, and Distributed Programming by Gregory Andrews - https://www2.cs.arizona.edu/~greg/mpdbook/ This will give you a solid foundation in all aspects of concurrency.

2) The Art of Multiprocessor Programming by Herlihy, Shavit et al. - https://shop.elsevier.com/books/the-art-of-multiprocessor-pr... The classic must-study book.

Both the above are not language specific but do have examples in Java.

Re: Ask HN: How to learn concurrency?

#14
Once you've gone through the learning resources others shared, LeetCode has a dedicated concurrency section for hands-on practice: https://leetcode.com/problemset/concurrency/

(I actually authored a few of those problems - they cover the classic scenarios like producer-consumer, dining philosophers, etc.)

Re: Ask HN: How to learn concurrency?

#16
Docs of java.util.concurrent would be my suggestion. And go straight into the wild and try to build a system that solves the billion rows challenge. You might want to truncate the input and start with a million row challenge first.

The cool stuff in concurrency is not having to deal with it imoand recognizing when its not essential. Also I hope you mean concurrency not parallelism. The second one is a bit more manageable.

Re: Ask HN: How to learn concurrency?

#17

[flagged]

Or an LLM... Curious how this stackoverflow-first-grader question isn't flagged to death.

People in the comments wish to provide assistance and share their experience, clearly missing the fact that the person asking didn't even bother to do a simple search first.

Re: Ask HN: How to learn concurrency?

#19
If you don’t mind learning another language. I have found Learn Concurrent Programming with Go by James Cutajar to be a very practical book. It includes memory sharing and message passing approaches with plenty of examples. It also explains concepts like mutual exclusion, deadlock-free and starvation-free properties and others. For Java, you can try The Art of Multiprocessor Programming Second Edition. It includes examples in Java but it is more theoretical and it includes a lot of proofs, specially the first half. The second half is more approachable.

Re: Ask HN: How to learn concurrency?

#20

That's a huge topic but I would say implement a hobby project and learn by doing. Pick something you're interested in and start writing code to exercise the theoretical concepts. A small piece of advice is to make sure you're motivated before diving in. Debugging a race condition, just as an example, can be quite involved and consume a lot of your time and energy to even reproduce.

But what is a good hobby project with a strong focus on concurrency that will not swamp a beginner to this topic?

Try making a trading order book system. Maybe in Go where they have made concurrency easier than other languages.
Post reply on HN