#57 in Computers & technology books
Use arrows to jump to the previous/next product
Reddit mentions of Java Concurrency in Practice
Sentiment score: 26
Reddit mentions: 50
We found 50 Reddit mentions of Java Concurrency in Practice. Here are the top ones.
Buying options
View on Amazon.comor
- Addison-Wesley Professional
Features:
Specs:
Height | 9.2 Inches |
Length | 7 Inches |
Number of items | 1 |
Release date | May 2006 |
Weight | 1.51678036256 Pounds |
Width | 1.2 Inches |
https://www.amazon.com/Java-Concurrency-Practice-Brian-Goetz/dp/0321349601
The resource seems very extensive such that it should suffice you plenty to be a good software engineer. I hope you don't get exhausted from it. I understand that some people can "hack" the technical interview process by memorizing a plethora of computer science and software engineering knowledge, but I hope you pay great attention to the important theoretical topics.
If you want a list of books to read over the summer to build a strong computer science and software engineering foundation, then I recommend to read the following:
The general theme of this list of books is to teach a hierarchy of abstract solutions, techniques, patterns, heuristics, and advice which can be applied to all fields in software engineering to solve a wide variety of problems. I believe a great software engineer should never be blocked by the availability of tools. Tools come and go, so I hope software engineers have strong problem solving skills, trained in computer science theory, to be the person who can create the next big tools to solve their problems. Nonetheless, a software engineer should not reinvent the wheel by recreating solutions to well-solved problems, but I think a great software engineer can be the person to invent the wheel when problems are not well-solved by the industry.
P.S. It's also a lot of fun being able to create the tools everyone uses; I had a lot of fun by implementing Promises and Futures for a programming language or writing my own implementation of Cassandra, a distributed database.
Java Concurrency in Practice by Brian Goetz is a very good book to get started on the concurrency package. I would recommend reading through it atleast once.
The problem is, most books are ground out by publishing mills and have very little value - especially to more experienced developers.
I try to choose books carefully and buy very few because most simple answers are already online.
One recent purchase which I felt was actually worth the money (i.e., the same depth of discussion and information was unavailable free in such as well-presented format) was:
"Java Concurrency in Practice" by Brian Goetz
http://amazon.com/o/asin/0321349601
This is an example of how high the bar needs to be raised to make a book worthwhile.
You missed:
Filthy Rich Clients
http://www.amazon.com/Filthy-Rich-Clients-Developing-Applications/dp/0132413930
Not so relevant now that JavaFx is here, but still a good way to understand how to properly write Swing code that doesn't put Java to shame.
Java Concurrency in Practice
http://www.amazon.com/Java-Concurrency-Practice-Brian-Goetz/dp/0321349601
A must read for anyone writing multicore code on the JVM.
"Java Concurrency In Practice" is the text that I would recommend.
http://www.amazon.com/Java-Concurrency-Practice-Brian-Goetz/dp/0321349601
For concurrency you can't go wrong with Java Concurrency in Practice
http://www.amazon.com/Java-Concurrency-Practice-Brian-Goetz/dp/0321349601
In addition to Code Complete 2, which, while very dense, is a compendium of wonderful coding knowledge... I recommend Clean Code by Robert C. Martin.
One of the best books on concurrency that I've ever read is definitely Java Concurrency In Practice it's (obviously) written with Java in mind, but most of the concepts map rather easily to constructs in other languages as well.
The standard for design patterns is still probably Design Patterns (colloquially "Gang of Four")... but I've heard good things about Head First Design Patterns as well, despite the really stupid cover.
These two are good reference guides despite their age. Lots of good best practice stuff.
Design Patterns by Erich Gamma , Richard Helm , Ralph Johnson , John Vlissides
https://www.amazon.com/Design-Patterns-Elements-Reusable-Object-Oriented/dp/0201633612/ref=sr_1_3?ie=UTF8&qid=1549541116&sr=8-3&keywords=design+patterns
Concurrency in Practice by Brian Goetz
https://www.amazon.com/Java-Concurrency-Practice-Brian-Goetz/dp/0321349601/ref=sr_1_1?ie=UTF8&qid=1549541190&sr=8-1&keywords=concurrency+in+practice
Clean Code by Robert C Martin
https://www.amazon.com/Clean-Code-Handbook-Software-Craftsmanship/dp/0132350882/ref=pd_sim_14_4?_encoding=UTF8&pd_rd_i=0132350882&pd_rd_r=cf3a76e3-2ad0-11e9-91c7-79eddbe046cc&pd_rd_w=RVwGU&pd_rd_wg=ZJ2Iq&pf_rd_p=90485860-83e9-4fd9-b838-b28a9b7fda30&pf_rd_r=4P48EDFQ0VNRGZYAE96S&psc=1&refRID=4P48EDFQ0VNRGZYAE96S
I'd start with this article. Finding newer versions of the books mentioned here is going to get you going on the right path. Here's a few I've picked out that I've personally read over the years.
Java: A Beginners Guide - Doesn't really get much better than this as far as an introduction into Java. Clean examples, pretty easy to follow. Would be a great place to start
Effective Java - This has historically been an excellent reference for Java. It's not entirely beginner friendly, but if you have at least a working knowledge of Java it's an excellent book to have around. Note: The link is for the 3rd edition which is coming out soon, I assume it will be as good as the previous editions, but in any case the information from the previous editions is still worthwhile even if there are newer features in Java 7/8/9 which is covered by the 3rd edition
Java Concurrency in Practice - As you become more advanced this book can help guide you along the ways of concurrent operations in Java and pitfalls/issues you'll run into (and how to avoid them)
We use it at work for asynchronous service calls. We deal with heavy amounts of data sometimes requiring hundreds of separate service queries. If we do them sequentially it takes a solid minute, but if we do them asynchronously we can really shave that time down. As others have said, though, it adds a LOT of complexity. It is also difficult to write unit tests for. If you are genuinely curious I would recommend Java Concurrency in Practice to learn more about it.
I'm not too sure about a general purpose book, but if you are interested in learning about Java's concurrency stuff I'd recommend Java Concurrency In Practice. I'm sure you'll see threading in the corporate world and this book was actually recommended to me by a Google employee who was a guest professor for a semester.
Java Concurrency In Practice is the book you want to read.
If you want a deeper understanding of concurrency, the go-to book is Concurrency in Practice.
For Spring, the go-to book is Spring in Action.
The best book I've read for OOP is Agile Patterns, Practices and Principles for C#. The first 1/3 of the book is Agile stuff, but the rest is a wide variety of topics in OOP. There used to be a Java version of this book, but the newer version is C#. But the C# code is nothing to different than what you would do in Java.
Two Java specific books you should read cover to cover (and keep around as an effective reference) are Effective Java and Java Concurrency in Practice, and you should also seriously consider reading Design Patterns. The examples in it aren't written in Java but they hold for all OO languages.
A good resource is Java Concurrency In Practice. Sounds like you'd be interested in Item 5.3: Blocking Queues and the Producer-consumer Pattern. Unfortunately I can't share it with you as it's copyrighted, but here's the short code snippet from it:
Producer & Consumer:
public class FileCrawler implements Runnable {
private final BlockingQueue<File> fileQueue;
private final FileFilter fileFilter;
private final File root;
...
public void run() {
try {
crawl(root);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
}
private void crawl(File root) throws InterruptedException {
File[] entries = root.listFiles(fileFilter);
if (entries != null) {
for (File entry : entries)
if (entry.isDirectory())
crawl(entry);
else if (!alreadyIndexed(entry))
fileQueue.put(entry);
}
}
}
public class Indexer implements Runnable {
private final BlockingQueue<File> queue;
public Indexer(BlockingQueue<File> queue) {
this.queue = queue;
}
public void run() {
try {
while (true)
indexFile(queue.take());
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
}
}
And startup method:
public static void startIndexing(File[] roots) {
BlockingQueue<File> queue = new LinkedBlockingQueue<File>(BOUND);
FileFilter filter = new FileFilter() {
public boolean accept(File file) { return true; }
};
for (File root : roots)
new Thread(new FileCrawler(queue, filter, root)).start();
for (int i = 0; i < N_CONSUMERS; i++)
new Thread(new Indexer(queue)).start();
}
You probably won't need to do anything until you actually start working, because you don't know what the tech stack of your company looks like yet.
For me, the generic Java-centric books that I think every Java developer should read are the following. They are the only Java books I did not end up burning/shredding:
java.util.concurrent
API that was introduced in Java 5, which makes writing concurrent code easier depending on your use cases.Beyond either of those, though, I really wouldn't care about any other dead tree Java book. You'll probably spend significantly more time learning internal libraries and 3rd party stuff like Spring or Guice or Apache Commons or whatever your company uses.
The absolute definitive book on multithreading in Java is the fantastic Java Concurrency in Practice. Just read it straight through.
It sounds like you have some more basic issues with understanding what threads even are though. Some of the other operating system focused resources might be a better place to start.
Did you go to college? I'm really surprised you're a programmer and you don't even know what a stack is.
> Oh boy, I know nothing about either of those things.
Get this book pronto. It's essential.
If you are using concurrency a lot then it might be worth it to take a look at: Java Concurrency in Practice (I believe that's the book I've seen recommended before.)
It's a little old but still mostly valid.
Read, in this order:
Those three books should get you wherever you need to be, without getting more specific books (e.g. framework books).
Head First Java
Thinking in Java
Effective Java
Java Concurrency in Practice
Best $150 you'll ever spend. Read in order listed.
I highly recommend Java Concurrency in Practice if you don't mind buying a book. http://smile.amazon.com/Java-Concurrency-Practice-Brian-Goetz/dp/0321349601
It really demystified threading for me and I felt more comfortable with when something should be synchronized.
If you've worked with Java before this is a great book
I think Java Performance and Java Concurrency In Practice are two of the main ones. Especially JCIP is the reference for concurrent programming.
i've been looking for comprehensive guide on clj concurrency
today i got https://www.amazon.com/Java-Concurrency-Practice-Brian-Goetz/dp/0321349601
thank you for this
I type too much so I needed a second post
---
> And lastly, do you have any sources that you used to read up on multithreading?
I recommend doing the following:
If you know Java and want to see all the ways you can strangle yourself, this book has a lot of great things in it. It's quite readable and will likely scare you (for good reason...) into how dangerous multithreading can be. The book is hefty and requires Java, but the information is very practical.
If you want CSC369 notes from a really good textbook, the following chapters are relevant:
http://pages.cs.wisc.edu/~remzi/OSTEP/threads-intro.pdf
http://pages.cs.wisc.edu/~remzi/OSTEP/threads-api.pdf
http://pages.cs.wisc.edu/~remzi/OSTEP/threads-locks.pdf
http://pages.cs.wisc.edu/~remzi/OSTEP/threads-locks-usage.pdf
http://pages.cs.wisc.edu/~remzi/OSTEP/threads-sema.pdf
http://pages.cs.wisc.edu/~remzi/OSTEP/threads-cv.pdf
http://pages.cs.wisc.edu/~remzi/OSTEP/threads-bugs.pdf
http://pages.cs.wisc.edu/~remzi/OSTEP/threads-events.pdf
You can casually read the above. You don't need to actively code or anything... and the style is very laid back and enjoyable to consume. Each chapter should take you ~40-60 minutes to do, so you can do one a day over the summer and be done in a week.
If you want the 369 notes, these are relevant lectures which cover the above chapters:
http://www.teach.cs.toronto.edu/~csc369h/winter/lectures/w3/L3-Synch.pdf
http://www.teach.cs.toronto.edu/~csc369h/winter/lectures/w4/L4-Synch.pdf
The above may be a good refresher after you've done the textbook spam I posted above.
All of these links are from the CSC369 webpage here: http://www.teach.cs.toronto.edu/~csc369h/winter/lectures.html
LASTLY make sure to read up on the language you plan to use and explore its concurrency library.
Now that you have the knowledge, go write something that does this. Find a cool topic where you have tasks that could use multiple threads to go faster and make some cool stuff.
=============================================
Some final notes because this took a while to type up and I have to go have lunch:
I didn't proof read anything so enjoy the typos, spent too much time writing posts
EDIT (I lied): Don't forget that luck plays a large factor in the interview, you can have everything and you could be asked some stupid question. Therefore it's not worth killing yourself over since you could grind like mad and have luck just not be on your side (and this is why you should apply to as many companies with interesting jobs as possible)
I personally always use an IDE, because you will soon discover that there are dozens of libraries used by real world projects, and you cannot possibly know everything about them. However, IDEs have options to turn off autocomplete, incremental compilation and syntax highlighting, if you are a masochist... Google is your friend.
I read Algorithims in C++ by Sedgewick, and it was great, but not important for learning to code. You need to know the basic concepts of: the Java standard library, especially collections, looping constructs, etc. Any good tutorial should cover these. General CS knowledge is great and you will be quizzed about it in interviews. However, not necessary when starting out.
Eventually you will need to know about the Java memory model, concurrency and thread safety this was the Bible back in the day, maybe there more up-to-date options.
Math is an interesting topic; in college, you have to learn calculus, which is where many of us decide that we don't like math. This is a pity, since programming is applied math. Also, math gets more interesting, but often weird, when you start studying upper division topics.
Most data structures are based on set theory and relations, which are taught in Discrete Math. To understand what a function is, you need to know about Set Theory and/or Category Theory. Category Theory is fascinating, and particularly important for understanding functional programming. This is a great resource. To understand graphics, you need to know about Geometry and Linear Algebra.
It also helps to understand the basics of Probability, Combinatorics and Abstract Algebra. All of this math is advanced stuff however, most programmers don't need to know any of that...
A lot of doing java programming right is understanding how things are commonly (effectively) done in Java (and in languages with similar set of features).
Regardless of anyone's opinions, a lot of that has to do with learning common design patterns, mainly the ones on the Design Patterns book (gang of four; http://www.amazon.com/Design-Patterns-Elements-Reusable-Object-Oriented/dp/0201633612/). Although the patterns in the book are just the starting point, it seems to be pretty good in terms of getting you up to speed with what some people tried (and are trying) to do with the design patterns movement, although there is significant disagreement.
There is also concurrency. This is a big thing in Java. A lot of the design of libraries and frameworks in Java are about dealing with concurrency issues. Server applications have to inherently deal with it, and this is where Java is mostly used. Although it's also a language independent subject, it's worth studying it applied to Java. A commonly recommended book is this one: http://www.amazon.com/Java-Concurrency-Practice-Brian-Goetz/dp/0321349601/.
The issue with all of this is that what I'm basically telling you is that "a large part of learning how to program in Java is to learn how to program", which isn't very helpful on its own. However, it's something I believe a lot of people miss. The focus on the language can be (it isn't necessarily) a symptom of that.
This is the book you want to read:
http://www.amazon.com/Java-Concurrency-Practice-Brian-Goetz/dp/0321349601
This seems to have been recommended quite a few times on Java related subreddits: http://www.amazon.com/Java-Concurrency-Practice-Brian-Goetz/dp/0321349601
Depending on how skilled you are at Java:
Then for Android specifically:
Do you have anything specific you want to improve on?
Here's a few that I liked that are specific to Java:
This book https://www.amazon.com/Java-Concurrency-Practice-Brian-Goetz/dp/0321349601 is really helpful.
If you want to program in Java, I would also suggest IntelliJ Idea. Community edition^[1] is free. Oracle docs are fine^[2], javadocs^[3] are great and the source is free for OpenJDK and if you want to go pro I highly recommend Effective Java^[4] by Joshua Bloch. There is also Findbugs^[5] which is cool for static analysis and most of the popular IDEs have plugins for it. You should also check Concurrency In Practice^[6] for multithreaded programming. If you are into web programming, I highly suggest Head First Servlets and JSP^[7]. There are also very good libraries such as Google Guava, Apache Commons etc.
In short, unless you spend all of your time writing boring, vanilla business logic, you will spend a lot of time with your fact in this book "Java Concurrency in practice" by Brian Goetz, which is a good book, but at some point you may wonder just what the hell you are doing with your life and if programming with thread has to be so complicated.
Pretty sure Rich already did this and we can learn from his journey.
Yeah! Great book! Currently discounted on Amazon.
Highly recommend learning it right the first time by reading Java Concurrency in Practice.
I started programming in Java few months ago to develop Android applications. These are the resources I used:
All of these books except for the first are near 400 pages each. However, most of them do not require you to read all of it. It would be great to read them entirely, but you can still make do by reading the sections you need the most. A lot of the books listed as classics are books I found that a lot of universities use as I was browsing some curricula. This list focuses upon general programming as I believe mobile development and web development are just learning how to use frameworks which I consider trivial to learn generally since a lot of people say that if they work a place that uses framework X, their workplace gives them some time to brush up or get up-to-speed with the framework and how to use it over a few days unless you require a niche or complex solution to a problem.
If you are not a huge fan of books, searching these titles will probably provide online tutorials or videos. The Amazon links can provide great reviews and suggestions. I like the books even if they are a bit long because of their professionalism, review, and rigor associated with the publication process of these textbooks that inhibits the rise of bad habits which might be introduced by online sources.
I do not know your background with these topics, so you may already know the, but these are the resources I think which really helps people transition from just knowing syntax as "knowing a language" which they translate to "I'm proficient in X because I can write a program which allows you to save text to a file" to knowing a language regarding software engineering concepts which helps you work properly on projects medium to large projects you would find in a workplace as an intern maybe entry-level employee (but more formal education might be required).
However, I'm pretty much like a high school student (took a year off before starting college to recover from an illness), so take my advice with a lot of salt, but these books which I couldn't apply 100% helped me make a small-medium sized Android application: https://github.com/jparkie/Aizoban which was designed enough to allow me to manage refractoring to introduce new features or fix issues which I believe would have been impossible if I hacked my way through to write around 35,000 lines of code.
http://www.amazon.com/Trading-Systems-Development-Portfolio-Optimisation/dp/1905641796
and the elements of statistical learning in the sidebar
C++ for dummies
Java for dummies
http://www.amazon.ca/Java-Concurrency-Practice-Brian-Goetz/dp/0321349601
Java Concurrency In Practice
https://www.amazon.com/Functional-Programming-Java-Harnessing-Expressions/dp/1937785467
https://www.amazon.com/Java-Concurrency-Practice-Brian-Goetz/dp/0321349601
First book deals with Functional Programming in Java, which is another way of doing things compared to the Object-Oriented Paradigm.
Second book deals with Concurrency, which is a really important topic imo.
> But it is still a lot more complicated that just letting the computer handle multithreading for you like you would in Java, C#, python
Not at all. Java Concurrency In Practice is 384 pages long for a reason. The way Node does concurrency is way simpler than using threads with manual synchronization.
http://www.amazon.com/Java-Concurrency-Practice-Brian-Goetz/dp/0321349601
I only skimmed your code, because there's a lot of code there.
In general, there are two ways that threads communicate with each other:
In fact, most concurrency constructs involve both. For example, a
Semaphore
class depends on all threads being able to see the number of available permits and, if no permits are available at the time thatacquire
is called, depends on being signaled when a permit is made available.Concurrency is hard to get right, even for developers with a lot of experience. It's easy to write code that appears to work, but which has a hidden concurrency bug. I'd posit that the mental model that most developers have about memory visibility in Java isn't quite accurate.
For your case, probably the easiest approach is to use something like a
BlockingQueue
(perhaps in the form of aLinkedBlockingQueue
or, if you know you can process messages faster than they arrive or are OK with dropping messages, anArrayBlockingQueue
). Have threads communicate by sending messages to each other through these queues, and otherwise share as little state as possible. Make sure that each thread does periodically check its queue for more messages. This is the model adopted by other programming languages that emphasize concurrency, like Erlang and Go.For more information, the book Java Concurrency in Practice is excellent. I highly recommend it.
If you know Java, check out Java Concurrency in Practice by Brian Goetz, Tim Peierls, Joshua Bloch, Joseph Bowbeer, David Holmes, and Doug Lea.
Buy this book: http://www.amazon.com/Java-Concurrency-Practice-Brian-Goetz/dp/0321349601 read chapters 1-5. Then read chapters 1-5 again.
Edit: it'll be the best $35 you'll ever spend on a Java book. When I interview people for position on my (Android dev) team, I specifically ask them concurrency questions. Knowing and understanding Java concurrency is an absolute must for professional Android development.
If you think you know Java, then read Effective Java.
Once you're through reading that, and you think that now you really know Java, read Java Concurrency in Practice.
There may be something more than these that's worth reading, but I haven't found it yet.