Data Integrity and Concurrency Control in Threaded Applications
Sorting, threading and data integrity can all be quite confusing when explaining the processes and how one might function with another; or if there can or will be complications with the implementation.
“A sorting algorithm is an algorithm that puts elements of a list in a certain order. The most-used orders are numerical order and lexicographical order (Sorting)”. When implementing sorting and the combining that with concurrency there can be issues involved.
“To understand how to implement concurrency control within your system you must start by understanding the basics of collisions – you can either avoid them or detect and then resolve them (Wambler, N.d.)”. After the basic understanding of concurrency control one must also understand the “locking” mechanism and its purpose.
There are two type of locking processes. One is “Pessimistic and the other is Optimistic” (Wambler, N.d.). These locking techniques were best explained in the article called Introduction to Database Concurrency Control which stated “modern software development projects that concurrency control and transactions are not simply the domain of databases, instead they are issues that are potentially pertinent to all of your architectural tiers (N.d.)”.
There were many suggestion on the proper “locking strategies” that one might use. If the volume of the transactions are high the first choice would be the “optimistic locking”; low volume, first choice “pessimistic locking”.
There can be many issues with data integrity especially when the system being used is “shared by a large organization and we both change the data, and then we both try to write our new versions back to the database. Whose changes should be saved? Yours? Mine? Neither? A combination? Similarly, if we both work with the same Customer object stored in a shared object cache and try to make changes to it, what should happen (Wambler, N.d.)”?
To avoid this type of “collision” it was suggested to “mark the source with a unique identifier and then retain a copy of the original” (Wambler, N.d.).
To be concise and organized while implementing a locking strategy it should be noted with all users of what may occur. Many can see this type of collision or not at all but it should be planned and prepared for in an event.