Introduction
In modern parallel processing systems, ensuring efficient, safe and secure access to shared data is a fundamental requirement to protect the data from corruption or inconsistency.
This is a particular challenge in real-time radar processing systems with in-memory databases if a high throughput of data is needed. Modern high-specification servers typically have increased numbers of processor cores rather than increased speeds of individual cores and thus applications must be designed specifically to harness the power of these systems with parallel processing techniques.
One common programming architecture involves multiple processing threads that all need to synchronise their accesses to protect the integrity of the data, whereas an alternative architecture entails multiple threads that need concurrent read-only access to the data with only a single writer thread that performs updates.
A hybrid architecture arises in some situations where multiple threads need read-only data access for the majority of their work, with occasional write-access for a brief time.
There are many examples of these requirements in radar processing systems, especially in Cambridge Pixel’s SPx software family of products, where data such as a live track database must be accessed concurrently by multiple threads.
This may be a single-producer, multiple-consumer paradigm (e.g. a single radar target tracker such as SPx Server that creates and updates the database in a main thread, with other threads pulling information from that database for display, network distribution and so on), or it may be a multi-producer paradigm (e.g. SPx Fusion, a multi-sensor fusion system in which the database can be updated with new information from one of many sources of data).
Simple Synchronisation
A common strategy for managing concurrency in systems with multiple threads accessing the same data is to use mutex lock primitives (so called because they provide mutually exclusive access by locking the resource for a single thread at a time).
On Windows-based systems, this would typically make use of the CRITICAL_SECTION object, whereas on Linux-based systems it would use the pthread_mutex_t object.
Whilst these are well-understood and provide a high level of protection, they tend to provide all-or-nothing access to the shared resources. Only one thread at a time can access the data and all other threads must wait in turn for access, effectively turning a parallel system into a sequential system, meaning that some processor cores may be idle for prolonged periods of time.

Despite having multiple cores, only one is able to access the data at any one time.
This simplicity may be appropriate for some classes of problem (e.g. the first programming architecture described in the introduction where all threads need full access to the data), but can be inefficient in others such as the hybrid architecture where threads only require read-only access to the data for the majority of the time.
The Need for Reader-Writer Locks
In systems with multiple readers and a single writer, the primary goal is to protect shared data from corruption while allowing for as much concurrency as possible. Typically, the workload in such systems consists of a large number of read operations compared to write operations. This is common in applications like databases, caches, or file systems, where data is frequently queried but updated less often.
In these systems, data consistency and integrity must be guaranteed despite concurrent access. The issue arises when a thread is reading the data while another thread is modifying it. Without proper synchronization, this can result in reading stale or inconsistent data....
Subscribe to continue reading this article, it's free.
Free access to Engineering Insights, authored by our industry leading experts.
You will also receive the Cambridge Pixel newsletter which includes the latest Engineering Insights releases.
Fill in the form below and you will be sent an Instant Access link.