White Paper On ConCurrency For PCMS Application Architecture

March 1, 2010

Dated: 19th July 2009
Version: 1.0
By:Shahzad Sarwar
To: Related Project Managers/Consultants
Development Team

What is Concurrency/Locking?

Locking is a method used to protect records that will be accessed by multiple users so that concurrency errors do not occur (when multiple users change records near simultaneously resulting in inconsistencies).
“Locking” refers to preventing access in some way to the file in order to protect it while a user is making an update.

Types of Concurrency
There are 2 types of locking / Concurrency
• Pessimistic Concurrency
• Optimistic Concurrency
Difference between Pessimistic Concurrency and Optimistic Concurrency
In Pessimistic concurrency the server acquires locks to block access to data that another process is using. Pessimistic concurrency avoids conflicts by acquiring locks on data that is being read, so no other process can modify that data, it also acquires locks on data being modified so no other processes can access that data for either reading or modifying. Readers block writers and writers block readers.

In Optimistic Concurrency the server uses row versioning to allow data readers to see the state of the data before the modifications occur. Older versions of data rows are saved so a process reading data can see the data as it was when the process started reading and not be affected by any changes being made to that data. A process that modifies data is unaffected by processes reading the data because the readier is accessing a saved version of the data rows, readers do not block writers and writers do not block readers.

A LINQ Presentation to Palmchip / TRG

October 11, 2009

LINQ-2-SQL Presentation to Palmchip and TRG, Technology Resource Group