2 Replies - 1105 Views - Last Post: 02 October 2012 - 04:46 PM

Concurrent Programming and Race Conditions

Posted 02 October 2012 - 08:11 AM

So I had a general question about race conditions in concurrent programming. I am not working on a program right now I am just a little confused on how these two relate to one another. I know what they are separately I just don't know how they work together or what would happen in cases of errors. Any explanation would be great Thanks in advance.

Concurrent Programming - Multiple things executing at the same time, such as threads or separate programs.

---

Here's the fun part, attempting to get concurrent processes on a distributed environment with multiple sources of mutable data.

You're looking into Semaphores, Mutex, Message Passing, and Monitoring. Read up on those and it will make more sense.

Some classic problems to look into:

> The Dining Philosophers
> Producers and Consumers
> The Smokers

There are quite a few ways to go about this one, and this is actually what I'm writing a fairly lengthy paper on for my OS class. I chose to go about it a different way. I chose to go with a far more functional paradigm.

While elimination of mutable data is danged near impossible, you can do a lot to add immutability and functional purity to tasks to ensure that you mitigate the risk of collisions and botched data as much as possible.

Functional purity is the concept that if you put the same thing in a black box, you always get the same resultant out. This means that there can be no modification of the sender.

It's an interesting subject to look into, but trippy for those of us straight off the boat from OO land.