Hacker News new | comments | show | ask | jobs | submit login

I'm a web developer interested in diving into graphics programming sometime in the next year, but this made me stop and wonder:

> If you aren’t deeply frightened about all the additional issues raised by concurrency, you aren’t thinking about it hard enough.

Why exactly is that?

The error conditions that cause bugs in concurrent code are difficult to replicate since concurrent code can have so many additional states of operation. It's also harder to program, especially in languages / environments that don't explicitly encourage it right from the beginning.

It's important to remember that some of the possible states arise from the memory model rather than what your code intentionally does. Say a producer thread fills a buffer and queues work, and a consumer thread receives the queue entry and reads the buffer. Does the consumer read any or all of what the producer intended? It depends on whether they were scheduled in different cores, and how full their caches were, and whether there was a memory barrier that's global (which is slow and not always needed) or only applies to the queue itself. Good platforms trade away just enough performance to guarantee correctness here.

Concurrency is complex. You have to sync between threads/processes/actors, and the sequence of a function doesn't include everything happening to the data in use. That makes it harder to predict and debug the program.

Applications are open for YC Summer 2018

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact