3 ms·
Gotta love the downvotes. So, it’s offensive to suggest that there are alternatives to threading on a post about WHY threading IS a bad idea??? Actor model wi
by Roboprog 8y ago
Gotta love the downvotes. So, it’s offensive to suggest that there are alternatives to threading on a post about WHY threading IS a bad idea???
Actor model with messages (events) sent between potentially isolated processes, perhaps?
If you truly need to run a compute intensive task in the background, the effort to [de]serialize a “command object” to and from another process should not be much overhead, vs sharing almost all memory by default.
Once you reach the point where you are starting a thread pool at start up, rather than spawning threads on demand, why not just have a process pool?
Shared memory blocks can also be used to explicitly share data too large to effectively serialize as a message / event.
If you truly have something that pumps huge amounts of data between compute intensive tasks, then threads make sense. Proceed with extreme caution, and try to encapsulate the trick bits.