DEV Community

[Comment from a deleted post]
Collapse
 
awwsmm profile image
Andrew (he/him)

Concurrent programming is a rapidly-evolving field in applied computer science. Every language seems to do things differently and there are different avenues through which programs can be "parallelised" -- using raw threads, an Akka-like actor model, etc. This stands in contast to theoretical computer science, which has had a theory of concurrent computation for decades.

Pure functional programming, where objects have no state, avoids concurrency issues entirely when all you're interested in is fast calculation. What you're describing sounds like it would be well-suited for a functional approach, provided user interaction and message-passing aren't integral to your solution. If they are, maybe you could use an actor model.

Like you say, different situations require different solutions. This is an area I'm starting to learn more about and would be interested in what others have to add to the conversation.

Collapse
 
ajanibilby profile image
Ajani James Bilby

Obviously avoiding shared memory via functional programming stops race conditions. However not every application can do that.

If you have a web server, every request could go to a different threads' schedule to quickly enable parallelism, however if you have any sessions that need to be accessed or updated as part of this request you will need to use shared memory.

I was trying to ask about methods for controlling shared memory, I guess I didn't word it very well.