3 ms·
Yes, I suppose you can make multi-threading sound easy if you list all of the really easy problems. Mutexes, queues, and semaphores (or condition variables, if
by klodolph 10y ago
Yes, I suppose you can make multi-threading sound easy if you list all of the really easy problems. Mutexes, queues, and semaphores (or condition variables, if you have a modern code base) are all the easiest parts of multithreading.
But the "so long as you are sensible" advice is terribly, terribly wrong. You have to rethink how parts of your code are isolated from one another, and you have to avoid entirely new classes of errors—such as deadlocks, which can appear when you combine two well-tested and correct multithreaded components. And the number of threads has nothing to do with it.
- taeric 10y agoThis is just as applicable to any of the other tools to master multithreaded programming. Actors, as an example, are great so long as you are sensible and don't push your problems into your protocol too heavily. Unless, of course, you like complicated protocols.