Thursday, July 4, 2024

Multitasking vs Concurrent vs Thread-safe vs Coherence

On a Uni-processor:
All computers multitask.
Multitasking is concurrent. Multitasking permits many processes to run on one core processor.
Processes that are concurrent must self-protect their data.
These processes are thread-safe.
The data race is resolved by serializing updates through one (cache) location.
 
On a Multiprocessor:
Thread-safe self-protection enables software to execute on a multiprocessor without a data race.
Coherence enables hardware to deliver the correct value on a multiprocessor.
They serve the same function, coherence solves the hardware data race. 
Coherence is required when updates occur in many caches instead of at one location.

Thread-safe Computers:
Thread-safe hardware implements the thread-safe algorithm to eliminate coherence.
Thread-safe hardware enables a processor to self-protect shared data without a data race.
Coherence's data race algorithm imposes a processor limit. 
But the thread-safe algorithm has no limit; software has no limit on the number of tasks.

Obvious Benefit:
Thread-safe hardware places data into two caches. 
One cache is private and does not require coherence.
This is faster than the current system which requires coherence on ALL data.
Simply implementing a private cache reduces the coherence that limits core processors.

Definitions:

Software Issue:
Thread safety - "Thread safety is the avoidance of data races—situations in which data are set to either correct or incorrect values, depending upon the order in which multiple threads access and modify the data."

Hardware Issue:
Cache Coherence - "In computer architecture, cache coherence is the uniformity of shared resource data that ends up stored in multiple local caches. When clients in a system maintain caches of a common memory resource, problems may arise with incoherent data, which is particularly the case with CPUs in a multiprocessing system."

Concurrency:
Concurrency - "In computing, multitasking is the concurrent execution of multiple tasks (also known as processes) over a certain period of time."
 

No comments:

Post a Comment

Thread Safe Computers

  The invention redefines thread safe.  For comparison, two current definitions are shown below. Due to blog incompatibility current version...