Caches in multiprocessing environment introduce the cache coherence problem. It is a cache inconsistency problem.
In a multiprocessor system, data inconsistency may occur among adjacent levels or within the same level of the memory hierarchy.For example the cache and the main memory may have the inconsistent copies of same object.
When multiple processor maintain locally cached copies of a unique shared memory location , any local modification of the location can result in a globally inconsistent view of memory(multiple processor operates independently and asynchronously).
INCONSISTENCY IN DATA SHARING
INCONSISTENCY IN PROCESS MIGRATION
In the first stage, cache of P1 has data element x whereas P2 does nto have anything. A process on P2 first writes on X and migrates to P1.Now the process P1 starts to read data element X, but as the processor P1 has outdated data the process cannot read it thus a process on P1 writes the data element X and then migrates to P2. After migration a process on P2 starts reading the data element X but finds its outdated version of X in the memory.
INCONSISTENCY IN I/O ACTIVITY
As illustrated in the figure, an I/O device is added to the bus in a two processor multiprocessor architecture. In the beginning, both the caches contain the data element X. When the I/O device receives a new element X, it stores the new element directly in the main memory. Now when
either P1 or P2 tries to read element X it gets outdated copy. So they write to element X. Now if I/O tries to transmit X it gets outdated copy.
One way to avoid I/O inconsistency is by attahching I/O processes directly to the private caches.
In a multiprocessor system, data inconsistency may occur among adjacent levels or within the same level of the memory hierarchy.For example the cache and the main memory may have the inconsistent copies of same object.
When multiple processor maintain locally cached copies of a unique shared memory location , any local modification of the location can result in a globally inconsistent view of memory(multiple processor operates independently and asynchronously).
In general, there are three sources of inconsistency problem −
- Sharing of writable data
- Process migration
- I/O activity
INCONSISTENCY IN DATA SHARING
Let X be an element of shared data which has been referenced by two processors, P1 and P2. In the beginning, three copies of X are consistent. If the processor P1 writes a new data X1 into the cache, by using write-through policy, the same copy will be written immediately into the shared memory. In this case, inconsistency occurs between the P2's cache memory and the main memory. When a write-back policy is used, the main memory will be updated when the modified data in the cache is replaced or invalidated.
In the first stage, cache of P1 has data element x whereas P2 does nto have anything. A process on P2 first writes on X and migrates to P1.Now the process P1 starts to read data element X, but as the processor P1 has outdated data the process cannot read it thus a process on P1 writes the data element X and then migrates to P2. After migration a process on P2 starts reading the data element X but finds its outdated version of X in the memory.
INCONSISTENCY IN I/O ACTIVITY
As illustrated in the figure, an I/O device is added to the bus in a two processor multiprocessor architecture. In the beginning, both the caches contain the data element X. When the I/O device receives a new element X, it stores the new element directly in the main memory. Now when
either P1 or P2 tries to read element X it gets outdated copy. So they write to element X. Now if I/O tries to transmit X it gets outdated copy.
One way to avoid I/O inconsistency is by attahching I/O processes directly to the private caches.
😇
ReplyDelete