9 ms·
Can you recommend any other book about the same subject but different programming language? Thanks!!!
by raphar 2y ago
Can you recommend any other book about the same subject but different programming language? Thanks!!!
- imron 2y agoThis book! There’s Rust specific parts but the knowledge you gain will transfer across languages.
- raphar 2y agoI'm reading this at the moment! but I also want to compare how well each language helps you develop concurrency solutions.
- npalli 2y ago"C++ Concurrency in Action" by Anthony Williams is solid. Make sure you get the second edition, it is updated for C++17. https://www.amazon.com/C-Concurrency-Action-Anthony-Williams-dp-1617294691/dp/1617294691/ https://www.amazon.com/C-Concurrency-Action-Anthony-Williams...
- deleted 2y ago[deleted]
- fanf2 2y agoI have used Rust a little, but this book was most useful to me when I was working on a concurrent data structure for an old C program. It’s a very good book for anyone writing low-level multi-threaded code in C or C++ as well as Rust, because they have basically the same primitives. The only places I know where it isn’t applicable are the Linux kernel and Java, because their memory models and concurrency primitives predate and significantly differ from the Rust/C++/C models. For the Linux memory model, there is Paul McKenney’s free book, “is parallel programming hard, and if so, what can you do about it?” https://cdn.kernel.org/pub/linux/kernel/people/paulmck/perfbook/perfbook.html https://cdn.kernel.org/pub/linux/kernel/people/paulmck/perfb...
- tialaramex 2y agoI guess there must be at least one book about the Java Memory Model, which is very different but fascinating? I don't know of any specific books to recommend. For many languages there is nothing resembling this, they tend to not get into the details Mara covers, if you get a mutex and maybe atomic arithmetic then they're done. If you wondered about C or C++, this book is the same content as for those languages but with Rust's syntax. The discrepancy between Rust's memory model and the memory model adopted in C++ 11 and subsequently C is mostly about a feature that's not available in your C or C++ compiler and (which is why Rust doesn't have it) probably won't ever be. C++ x.store(r1, std::memory_order_relaxed); is literally the same thing as Rust x.store(r1, std::sync::atomic::Ordering::Relaxed); The biggest syntax difference is that C++ x.store(r1) compiles, and in Rust it doesn't. But, chances are after reading Mara's book you will think it's weird not to specify the Ordering needed and never use this uh, convenience.
- freddierest 2y agoThe classic for Java is "Java Concurrency in Practice", a great book for more than just Java. Java's happens-before memory model is similar to C++'s. I'll prob get this book, if only for the memory model chapter.
- ibraheemdev 2y agoJava atomics are actually sequentially consistent. C# relaxes this to acquire/release. Though the general concept of happens-before is still immensely useful for learning atomics as sequential consistency is a superset of acquire/release.
- freddierest 2y agoThanks for correction/clarification. Much as C# has a weaker memory model than Java, my mental model for memory models is weaker than I thought. Where do Rust and C++ lie wrt C# and Java?
- jcranmer 2y ago
- chc4 2y ago"Is Parallel Programming Hard, And, If So, What Can You Do About It?" is one of the best books about atomics and concurrency, and my #2 recommendation. https://mirrors.edge.kernel.org/pub/linux/kernel/people/paulmck/perfbook/perfbook.html https://mirrors.edge.kernel.org/pub/linux/kernel/people/paul... My #1 actually isn't a book at all, but the two "atomic Weapons" talks by Herb Sutter, which are extremely good. https://youtu.be/A8eCGOqgvH4 https://youtu.be/A8eCGOqgvH4 https://youtu.be/KeLBd2EJLOU https://youtu.be/KeLBd2EJLOU
- bonzini 2y agoIn the not-a-book section I'm going to plug my series of six articles on LWN.net: https://lwn.net/Articles/844224/ https://lwn.net/Articles/844224/ Most of the content is not too specific to Linux, much like this book is not too specific to Rust.
- iso8859-1 2y agoParallel and Concurrent Programming in Haskell https://simonmar.github.io/pages/pcph.html https://simonmar.github.io/pages/pcph.html
- self_awareness 2y agoThe book was already mentioned elswhere in this thread, but also a good, skimmable source of information is simply in javadoc: https://docs.oracle.com/javase%2F8%2Fdocs%2Fapi%2F%2F/java/util/concurrent/package-summary.html https://docs.oracle.com/javase%2F8%2Fdocs%2Fapi%2F%2F/java/u...
- miljanm 2y agoShared-Memory Synchronization by Michael L. Scott https://link.springer.com/book/10.1007/978-3-031-38684-8 https://link.springer.com/book/10.1007/978-3-031-38684-8
- 62951413 2y agoAnyone with a Java background will mention JCiP. But there's another book going deeper - "Art of Multiprocessor Programming" (https://www.amazon.com/Art-Multiprocessor-Programming-Maurice-Herlihy/dp/0123705916 https://www.amazon.com/Art-Multiprocessor-Programming-Mauric...).
- bonzini 2y agoThe book is good but it has a couple important drawbacks: * while it tells you how to do lock-free programming but doesn't teach you why, nor whether you should it. * it has a relatively narrow focus on linearizability, but the truth is memory is neither linearizable nor sequentially consistent. These days it is agreed that Lamport's "happens before" relationship and acquire-release are a better way to reason on multithreaded code.