Concurrency and false sharing

I have just read an article in The Code Project by Nicholas Butler on concurrency and the false sharing effect. The article is explained using C# and an array as a data structure but can really be applied to any language and many a data structure, an object with a status that depends on other properties comes to mind.

Concurrency is probably one of the area where it is the easiest to shoot yourself in the foot and where there are plenty of possible effects that one might not be aware of. This is one of those case and it definitely would not have been my first thought if one of my program did run slowly.

As it is quickly explained in the commentary, synchronisation is probably the first thought of anyone writing a concurrent access algorithm and yet it is the worst choice possible. The other main choices are the non blocking data structures (wait-free, lock-free and if really pertinent obstruction-free) and immutability. Each technique has of course its drawbacks that one must be aware of. The only thing is it might be easier and safer to verge on the side of being too cautious and apply synchronisation than trying to use something else and miss an issue that will possibly leads up to a deadlocked software on the customer’s machine. Knowing the different solutions is actually not that hard but very often finding where the problem lies is the real issue…

This entry was posted in Concurrency, Development and tagged , , , , , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s