Thread pools: How do I use them?
41–48 of 48 posts
Re: Thread pools: How do I use them?
#42Java/Scala streams look like they would solve most of the problems in the post on their own.
e.g. Java streams
http://radar.oreilly.com/2015/02/java-8-streams-api-and-para...
private void runParallel() {
trades
.stream()
.parallel().forEach(t->doSomething(t) );
}
Java/Scala has a hierarchy of concurrency abstractions, from high level to low level:Streams, Parallel collections, Futures, Actors, Fork/Join, ExecutionContext/ExecutorService, Threadpools, Threads, synchronized, Barriers, Atomic values and many more.
Re: Thread pools: How do I use them?
#43As is sometimes the case, people start with the wrong abstraction (thread pool) and then optimize it. Java/Scala streams look like they would solve most of the problems in the post on their own. e.g. Java streams http://radar.oreilly.com/2015/02/java-8-streams-api-and-para... private void runParallel() { trades .stream() .parallel().forEach(t->doSomething(t) ); } Java/Scala has a hierarchy of concurrency abstractions…
Re: Thread pools: How do I use them?
#44Earlier quoted context omitted.
It's not that, it's just that experts tend to contribute to threads where they can share their expertise. So while it appears that everyone here is amazing; that isn't the case: we just tend to have something that we're very good at and comment on it. The good thing is that you can learn a lot here as long as you don't get sidelined by some of the inane arguments and fighting :)
Also, an awful lot of people who sound like infallible "experts" in tech are just people who are dealing poorly with imposter syndrome.
Re: Thread pools: How do I use them?
#45Earlier quoted context omitted.
Also, an awful lot of people who sound like infallible "experts" in tech are just people who are dealing poorly with imposter syndrome.
Hang on; Imposter Syndrome would mean that you would come across as a fallible, non-expert, since you believe yourself to really be an imposter. Do you really mean something like the Dunning-Kruger effect, which is sort of the opposite of Imposter Syndrome, people with little knowledge believing themselves to be infallible experts?
Re: Thread pools: How do I use them?
#46Earlier quoted context omitted.
Hang on; Imposter Syndrome would mean that you would come across as a fallible, non-expert, since you believe yourself to really be an imposter. Do you really mean something like the Dunning-Kruger effect, which is sort of the opposite of Imposter Syndrome, people with little knowledge believing themselves to be infallible experts?
Impostor syndrome means that the person thinks of themselves as a fraud, not that other people do. So someone dealing poorly with impostor syndrome might well only chime in when they are exceedingly confident, or only when they do research and can be certain that the information/position they are providing is correct. If you keep your mouth shut except when you're 100% certain, you'll likely look like an "infallible…
Re: Thread pools: How do I use them?
#47I like the style of writing in this post. Its fresh in the programming world where everyone seems to know it all for someone to admit something is hard or confusing.
Re: Thread pools: How do I use them?
#48In the spirit of brainstorming:
1) Abstract out the I/O step so that you can pass around a bunch of lightweight and lazy "I'll get the lines for you when you ask" objects. Then you can safely queue up a large number of them.
2) Choose to break the "job" apart into two parts, and submit the "get lines from filename" jobs into a different, smaller pool, with the results flowing into the larger (CPU-core-limited) pool.