Lockless algorithms for mere mortals
Lockless algorithms for mere mortals
Posted Jul 29, 2020 0:30 UTC (Wed) by Cyberax (✭ supporter ✭, #52523)In reply to: Lockless algorithms for mere mortals by ras
Parent article: Lockless algorithms for mere mortals
That's not quite true in distributed systems. There's a class of data structures that achieve a consensus without strict ordering: https://en.wikipedia.org/wiki/Conflict-free_replicated_da...
      Posted Jul 29, 2020 1:09 UTC (Wed)
                               by ras (subscriber, #33059)
                              [Link] (6 responses)
       
In contrast, if they independently observe A caused B they don't need to be in contact to know they agree on the ordering.  They can be certain the other one saw A caused B without every meeting to agree on it. 
The example the wikipedia article you linked to is an excellent example.  The database they must agree on is a single bit.  The update performed is to set the bit to 1 if an event occurs, but since it is a distributed system that event may not be seen by some databases, so some "observe" 0, and some observe a 1.  Clearly that is different.  To agree they observers must meet and then follow the logic "since it is never reset to 0, and since one participant saw the event happen it must have happened, ergo after meeting we can all agree on 1". 
     
    
      Posted Jul 29, 2020 17:58 UTC (Wed)
                               by NYKevin (subscriber, #129325)
                              [Link] (5 responses)
       
There's also the Spanner approach (put atomic clocks in all of your datacenters, get them all nice and synchronized, and then everyone can agree that A happens-before B because A and B are both timestamped and you know the resolution of your clocks is finer than the difference between those timestamps). But that requires hardware support, because regular clocks are insufficiently precise for timestamping to be useful in most realistic applications. Also, this is clearly useless for something like multicore concurrency within a single machine (you're not sticking an atomic clock on each core, that would be ridiculous). 
     
    
      Posted Jul 29, 2020 19:40 UTC (Wed)
                               by Wol (subscriber, #4433)
                              [Link] (2 responses)
       
Except that then you know that the 1st floor has time moving at a different speed to the ground floor, and probably the front wall is moving at a different speed to the back ... 
Cheers, 
     
    
      Posted Jul 29, 2020 21:53 UTC (Wed)
                               by NYKevin (subscriber, #129325)
                              [Link] 
       
(Disclaimer: I work for Google. I do *not* get paid to promote Spanner or any other Google product.) 
     
      Posted Aug 1, 2020 16:35 UTC (Sat)
                               by anton (subscriber, #25547)
                              [Link] 
       
     
      Posted Jul 30, 2020 13:05 UTC (Thu)
                               by sriram_srinivasan (guest, #140506)
                              [Link] (1 responses)
       
     
    
      Posted Jul 30, 2020 15:15 UTC (Thu)
                               by NYKevin (subscriber, #129325)
                              [Link] 
       
     
    Lockless algorithms for mere mortals
      
Lockless algorithms for mere mortals
      
Lockless algorithms for mere mortals
      
Wol
Lockless algorithms for mere mortals
      
      All the data centers are at rest wrt each other, and wrt to the events they observe (Earth rotation may be an issue, but not at the ms resolution they work with).  Differences in the gravity field are miniscule, but even if they were significant, they would only change the time scale, not the order of events; and scale can be corrected by scaling the measured time to correct for this effect.
      
          Lockless algorithms for mere mortals
      Lockless algorithms for mere mortals
      
Lockless algorithms for mere mortals
      
           