News for hackers. Stuff that matters.
Re:2016 will be the year of concurrency on the web by jgh on Tuesday December 29, 2015 @03:09PM (#10808766)
I honestly really hate it when "concurrency is hard" is trotted out as a reason for not using it when using it would very obviously make life better for the end-user.

Is it as straightforward as non-concurrent code? No, obviously it isn't. Is it so mind-bendingly difficult that we need to be paralyzed by fear at the mere mention of concurrency? No, it isn't that either.

There are things you can do to make concurrency easier. Dispatch queues for one eliminate a lot of bugs. Being thoughtful about when and how we use concurrency is another. Race condition bugs are sometimes difficult to track down and cure, but if you understand the basic concepts around concurrency and controls around that they're generally fairly easy to avoid.

The biggest problem I've run into with people is they don't even understand what mutexes, semaphores, condition variables, or atomic variables are or when you'd use each. People don't know what joining a thread is. I ran into a bug at a previous job where they were spawning and destroying threads very quickly (which is a problem, but not their main problem) and instead of using a join to block until a thread's completion they were using sleep(1). Switching to a join sped up their code immensely and improved a data processing operation that previously took months to now taking days.

tl;dr people need to a) read up on how to do concurrency and b) be more thoughtful about the code they're writing when doing it. It's not so scary we should just avoid it altogether, especially when the user experience can be greatly improved by using it. Concurrency is another tool in the toolbag, even if it's a chainsaw without a cover.

Re:2016 will be the year of concurrency on the web by sotojuan on Tuesday December 29, 2015 @04:48PM (#10809304)
Concurrency is even easier when you use something like Erlang or Elixir, or apply their principles to other languages.
Re:2016 will be the year of concurrency on the web by sorenbs on Tuesday December 29, 2015 @03:45PM (#10808946)
It seems to me you don't have a good understanding of the amount and kind of people doing web development.

Either that or your comment is not in regard to web development at all?

Re:2016 will be the year of concurrency on the web by jgh on Tuesday December 29, 2015 @04:00PM (#10809041)
I'm not really involved in web development much, my comment was more general though. It's surprising the number of people in an environment where threading is a real option that don't really understand it very well.
Re:2016 will be the year of concurrency on the web by theseatoms on Tuesday December 29, 2015 @04:04PM (#10809055)
Is there not a wide range of web developer talent available in the marketplace?

Certainly some teams are more sophisticated than others and can achieve a higher level of site design.

Re:2016 will be the year of concurrency on the web by PopsiclePete on Tuesday December 29, 2015 @06:09PM (#10809667)
The "web" for a long time was Perl/Python/PHP/Ruby. I had never done real concurrency work until I started doing C#/Java. But most web devs I've worked with, especially the ones with an interpreted language background, have no idea or even interest to do any kind of concurrency. NodeJS isn't making things better either.

AFAIK, the only "easy" and pleasant language to do concurrency in is Go and maybe Clojure if you can get past the LISP. C# is nice but is (for now) still too MS-centric, and Java is ...well...Java.

Until we move away from the intercepted languages and frameworks of the 1990's, this won't get any better anytime soon.

Re:2016 will be the year of concurrency on the web by sotojuan on Tuesday December 29, 2015 @08:39PM (#10810246)
> AFAIK, the only "easy" and pleasant language to do concurrency in is Go and maybe Clojure if you can get past the LISP.

Have you looked into Elixir? It's a language that compiles to Erlang's VM and thus has the same concurrency model as Erlang's, which is one of the simplest ones.

Re:2016 will be the year of concurrency on the web by techdragon on Wednesday December 30, 2015 @01:40AM (#10811068)
Pulsar is also a great Actor Model Concurrency library for Python. It gives you Erlang/Elixir style actor concurrency in Python!
Re:2016 will be the year of concurrency on the web by krat0sprakhar on Tuesday December 29, 2015 @06:48PM (#10809856)
> a) read up on how to do concurrency

Can you suggest a few resources to further this cause? I'd love to write more concurrent code but outside of an OS class, I don't have much experience.

Thanks!

Re:2016 will be the year of concurrency on the web by optimusclimb on Tuesday December 29, 2015 @07:02PM (#10809926)
You could probably read this decade old book:

http://www.amazon.com/Java-Concurrency-Practice-Brian-Goetz/...

and it'd be a good start. It's in "boring" old Java, but it goes over a lot of the meat and potatoes concepts.

Re:2016 will be the year of concurrency on the web by fapjacks on Tuesday December 29, 2015 @09:05PM (#10810317)
I can recommend this book as well. I don't write a lot of Java, but this is great for the general topic.
Re:2016 will be the year of concurrency on the web by frozenport on Tuesday December 29, 2015 @09:45PM (#10810422)
Go write a producer-consumer queue

Also understand this code: http://en.cppreference.com/w/cpp/thread/condition_variable