60 votes

No central database

Plenty of sensitive information gets stored in databases. In fact, a central database is probably the most secure way to store this data. Large enterprise databases have tons of functionality to do ...
Justin Cave's user avatar
  • 12.7k
41 votes

Is "releases mutexes in reverse order" required to make this deadlock-prevention method work?

For a deadlock (more specifically, a circular wait) to occur, there needs to be a circular chain of n ≥ 2 mutexes (or other exclusively lockable resources) R1, R2, …, Rn such that, for each k from 1 ...
Ilmari Karonen's user avatar
38 votes

No central database

You need to back up a couple steps and, in consultation with your client, work out a threat model. (Yes, that's a link to a 600-page book; yes, I am seriously recommending you read the entire thing.) ...
zwol's user avatar
  • 2,576
24 votes

How to justify using await instead of .Result() or .Wait() in .NET Core?

You have missed the point of async/await It wasn't created to frustrate developers with deadlocks. It was created to free up Processing power while we wait for a non CPU based task to complete. The ...
Ewan's user avatar
  • 70.9k
16 votes

Best way to synchronize data between two different databases

This is pretty much what I have been doing or a living the past few years, and my gut instinct is that the time to read 500,000 items from the source database and sync in the destination will not take ...
Thomas Carlisle's user avatar
14 votes

Why do we need read locks in read-write locks?

A read lock allows multiple concurrent readers of some data, but it prevents readers from accessing the data while a writer is in the middle of changing it. That ensures that a reader will never see a ...
Bart van Ingen Schenau's user avatar
13 votes

Is "releases mutexes in reverse order" required to make this deadlock-prevention method work?

For a deadlock to occur a system has to have several properties simultaneously. Wikipedia has some more details on this but for short: Mutual Exclusion Incremental Acquisition No preemption Circular ...
Kain0_0's user avatar
  • 15.9k
12 votes

What are some approaches used in financial applications to prevent deposit/withdrawal sync problems?

Transactions A transaction wraps all of the required steps for a particular business operation and guarantees that either all of the steps succeed or they all rollback to the original state in the ...
Robert Harvey's user avatar
11 votes

Is "releases mutexes in reverse order" required to make this deadlock-prevention method work?

Let's have a look at the simplest form of deadlock: the kiss of death of two processes trying to acquire 2 mutexes: (1) | (2) Lock mutex A (success) | Lock mutex ...
Christophe's user avatar
  • 74.7k
9 votes
Accepted

Data from devices with unreliable clocks

There's actually quite a bit you can do to recover something close to the actual time of most of your events. Android gives you a few useful tools to work with, notably broadcast intents sent when ...
Blrfl's user avatar
  • 20.3k
8 votes

No central database

One option to do the synchronization would be to do it peer-to-peer. This will still require a central server, but that server won't handle any of the data. When a device goes online, a central ...
Philipp's user avatar
  • 23.2k
8 votes

Do critical section and atomicity imply each other?

Atomicity should be understood to mean that the thing it refers to (a transaction, an operation, etc.) is all-or-nothing. There is no defined mechanism to observe partial results. For a database ...
Bart van Ingen Schenau's user avatar
7 votes

Why do we need read locks in read-write locks?

An update lock is an exclusive lock, that is, only one lock can be held at a time. It is used to prevent concurrent updates. A read lock is a shared lock, multiple readers can held a read lock ...
Lie Ryan's user avatar
  • 12.3k
7 votes

What will you do if multiple users access your application at the same time?

This is a really broad question, since concurrency issues are handled in a variety of ways in complex system. For example a synchronized block in Java is only locked for other threads in the same ...
JacquesB's user avatar
  • 57.4k
6 votes
Accepted

How to resolve data-binding efficiently

This is either fundamentally meaningless or you've left out an important detail. Your diagrams give each node 3 states: ● Unchanged, don't propagate ◌ Just now changed and in need of propagation ○ ...
candied_orange's user avatar
6 votes

What are the existing theories or methodologies around synchronizing tree structures?

The main challenge/consideration when doing this is determining what you consider a difference to be. This can be more tricky than you might think. The experience I had that lead me to that ...
JimmyJames's user avatar
  • 25.1k
5 votes

No central database

Make it somebody else's problem. Store the data locally in each app, then give users the option to enable synchronization using their own account with a third-party service (Dropbox, Google Drive, ...
James Mason's user avatar
5 votes

A simple approach for data synchronisation

Syncing between multiple clients is a very complext task. Let's not call it syncing, let's call it bash transaction processing. Let's get rid of "last server update timestamp", let's just every ...
Tulains Córdova's user avatar
5 votes

Non-synchronized method that calls synchronized methods only

That depends. Could there be problems if something happens between the calls to A and B? If so, then C should be synchronized. public class SomeClass{ private int i; public synchronized void ...
8bittree's user avatar
  • 5,637
5 votes

Bi-directional sync of 2 different APIs

Welcome to the world of integration. The hardest thing about it is how poorly most vendors understand what you need and the resulting gaps in their interfaces. In this case you seem to have a really ...
JimmyJames's user avatar
  • 25.1k
5 votes
Accepted

Best practices for app-cloud synchronization of database representation

You are trying to create a distributed eventually-consistent system. Those are inherently complicated. It's understandable that you are having difficulty coming up with a good solution because there ...
amon's user avatar
  • 133k
5 votes

When does a *fixed delay* make sense?

Yes. To delay to give time for completion prior to checking. Yes. To animate, because humans see in the order of ~80hz. Yes. To throttle, running at 100% isn't always the right option. No. There is ...
Kain0_0's user avatar
  • 15.9k
5 votes

Why do we need read locks in read-write locks?

Presuming a write cannot be done atomically: Only one thread at a time can safely write data without corruption. No reads can happen during a write without getting corrupt data. Multiple reads can ...
Craig Tullis's user avatar
  • 1,965
5 votes

Hexagonal/Clean Architecture - threads, locks, synchronization

Generally the best place to put all the multithreading stuff is "as far away from you as possible". That's a joke, but also a very serious point - it's hard to get right, so most architects ...
pjc50's user avatar
  • 10.7k
5 votes
Accepted

One producer - multiple consumers queue, best way to guard against rare duplicates?

[As discussed in comments: OP is moving towards an actual queue implementation - a genuine single-producer multiple-consumer pattern.] Here's one approach based on a queue: Have a map from underlying ...
davidbak's user avatar
  • 712
4 votes

Conflict resolution for two-way sync

I guess there is no standard way to do it, each system uses their own policies for the conflict resolution. I made some simulations using two devices, computer and phone, and Google Spreadsheet to ...
Allan Veloso's user avatar
4 votes

What's the best implementation for offline mobile app synchronization?

If you're going to sync against your master SQL database you will always have the same problem: how do you resolve conflicting changes? CouchDB doesn't help you there. It explicitly does not handle ...
Joeri Sebrechts's user avatar
4 votes
Accepted

Threads - When to use barrier?

Barriers are used to make multiple threads within the same program do something in a synchronized fashion. The real-world analog would be the starting gate at a horse race. Ten horses in a race won'...
Blrfl's user avatar
  • 20.3k
4 votes

Sync one thousand vector3 across network with minimal bytes?

Standard compression algorithms are pretty efficient even at the fastest setting. As a quick test I filled a text file with 34k bytes. Compressing with 7-zip on fastest setting gave me a file of 1k. ...
Esben Skov Pedersen's user avatar
4 votes

Are there any techniques for detecting redundancies a stream of changes to a filesystem?

All you have to do is buffer your structured events such that you can look them up by affected path (source and destination, probably). The actual mechanism for combining any given pair of events ...
Useless's user avatar
  • 12.4k

Only top scored, non community-wiki answers of a minimum length are eligible