Questions tagged [synchronization]

Maintaining several related processes, threads, objects or data in a consistent state. Not to be confused with replication.

Filter by
Sorted by
Tagged with
1 vote
2 answers
121 views

Synchronous vs Asynchronous Event Driven Architecture

I have been searching extensively about the difference between synchronous and asynchronous patterns and how this relates to event driven architecture. On its face it is quite obvious, I simply ...
user avatar
  • 119
1 vote
2 answers
90 views

Ensuring run-once behavior in a multi-threaded environment via volatile lambdas?

I'm coding an enum strategy pattern where one of the strategies makes use of an ScheduledExecutor: class ControllerImpl { //... boolean applyStrat(StratParam param) { getStrat().apply(...
user avatar
  • 345
4 votes
1 answer
138 views

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

I have a classical one producer - multiple consumers queue, each item can be processed independently. On rare occasions (<1%) there can be multiple queue items related to the same object the ...
user avatar
0 votes
1 answer
58 views

Right way to combine data between Mongo and DynamoDB

I am looking for a way of dealing with the following situation: 1- Have an items collection in MongoDB 2- Have a users collection in DynamoDB 3- Each document in the items collection has a "...
user avatar
  • 3
0 votes
0 answers
26 views

Sync image files from network with mariadb-Database

i have as a mechanical engineering student in my practice semester to create a database that includes about 100k+ paths to images in our network. Every, lets say week, i have to synchronize all ...
user avatar
4 votes
4 answers
705 views

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

I'm an experienced Software Engineer but very weak in concurrency because of no prior experience in that. I've been interviewing with several companies in which I was asked similar kind of questions ...
user avatar
-1 votes
1 answer
111 views

Design pattern to sync local databases with the cloud [closed]

I would like to find the best way to solve the following problem: I need a database for a software. The software needs to use the data to populate the UI and allow the user to interact with them (edit,...
user avatar
  • 101
1 vote
1 answer
204 views

Full, 2-way table synchronization

I need to synchronize tables of data between two different systems. This is a multi-master setup; data can get changed in either system. After a synchronization runs I'd like the data in each table to ...
user avatar
  • 151
-2 votes
1 answer
121 views

How to sync async and await Tasks?

With threads you could use Semaphore, mutex, ManualResetEvent, etc... to sync a shared data, how do you accomplish the same thing with tasks? Essentially, if I have shared data between different ...
user avatar
1 vote
0 answers
37 views

How to support text editing when the text has to be synchronized with fixed audio?

In my application, we record audio of people speaking, send this to a speech-to-text (STT) service, and present the text to the user for editing. Simplifying a bit, the STT service returns results in ...
user avatar
0 votes
1 answer
48 views

Sync customers between shop and CRM-system (two-way)

I have a shop system that is based on a MySQL database and over which I have full control. On this system runs my synchronization plugin. And then there is an external CRM system with a fixed API. ...
user avatar
  • 111
0 votes
0 answers
91 views

Fill Docker Container from existing remote database

I do have n nodes managed by Kubernetes, all of them running several containers. A container may contain a database alongside with an application. As containers should be stateless, all data within ...
user avatar
  • 101
2 votes
0 answers
24 views

Breadth first event synchronization based on a frequency or time series

I have an interesting and problem I'm facing. I'm trying to maintain a set of metrics independently based off of a time frequency. Note: This is a simplification of the problem I've omitted pieces of ...
user avatar
  • 335
1 vote
1 answer
110 views

Synchronizing Multiple Local SQL databases with Server

I'm trying to understand what general mechanisms and/or concepts are available in SQL database last to synchronize local. Here are my inputs and requirements. Multiple clients have a full copy of the ...
user avatar
  • 369
1 vote
2 answers
110 views

Calling an API and synchronising database

I am calling a payments API to send a payment. At the same time, I need to mark the payment as sent in my database. If I call the API first, then the database crashes, the payment will be sent twice. ...
user avatar
  • 121
0 votes
0 answers
39 views

What is best approach to designing a local-to-cloud cloud-to-local Infrastructure?

I plan to have a cloud web application(CWA) and several local web application(LWA), let's assume 3 LWAs and 1 CWA. CWA === LWA. This web application would consist of a database server, file storage ...
user avatar
-1 votes
3 answers
266 views

Is it possible to solve this synchronization problem using mutex and conditional variables?

I am trying to solve this synchronization problem in C to practice for my lectures of Operating Systems where we use POSIX and Linux. I've been trying for days to find an approach to this problem with ...
user avatar
4 votes
2 answers
453 views

Hexagonal/Clean Architecture - threads, locks, synchronization

All the examples across the internet try to pretend that every application is run on a single thread. There is no problem with synchronization, multithreading etc. Uncle Bob, in his "Clean ...
user avatar
2 votes
3 answers
2k views

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

in read-write locks, why do we need read locks since processes can read a file at the same time? Would only a write lock suffice? Thanks.
user avatar
  • 5,271
1 vote
1 answer
44 views

Poll based database operations with a load balanced application

I have a .NET Core application that is hosted as multiple load balanced instances (separate servers, obviously pointing to the same database). I have written a service within the application that ...
user avatar
  • 329
3 votes
3 answers
390 views

Do critical section and atomicity imply each other?

Is it correct that In concurrent programming, a critical section is a sequence of statements which can't be executed by more than one processes/threads at the same time. Atomicity (as "A" ...
user avatar
  • 5,271
1 vote
1 answer
626 views

Why does a condition variable's wait() release the associated mutex before blocking and reacquire it before returning?

Stallings' Operating System book says about condition variable in Solaris, A condition variable is used to wait until a particular condition is true. Condition variables must be used in ...
user avatar
  • 5,271
-2 votes
2 answers
177 views

How to syncronize one object from two sources

I want to synchronize one variable (Node.Value) to two separate sources. Both sources can read or write to their internalValue variable. How do I keep track of the newest value and update ...
user avatar
  • 107
-4 votes
3 answers
306 views

What is "it is possible for one process to lock a binary semaphore and for another to unlock it" useful for?

Here are some discussions about mutex (lock) and binary semaphore from two OS books. Stalling's Operating Systems book says A concept related to the binary semaphore is the mutex . A key ...
user avatar
  • 5,271
0 votes
1 answer
353 views

Is a mutex lock always implemented as spin waiting?

Is a mutex lock always implemented as spin waiting? Can a mutex lock be implemented as block waiting? (Operating System Concepts section 5.4 only mentions the implementation by spin waiting. See below....
user avatar
  • 5,271
1 vote
2 answers
964 views

Why is it that "the process that locks the mutex must be the one to unlock it "?

Here are some discussions about mutex (lock) and binary semaphore from two OS books. Stalling's Operating Systems book says A concept related to the binary semaphore is the mutex . A key ...
user avatar
  • 5,271
1 vote
1 answer
635 views

Is there still busy waiting in the process-blocking implementation of a semaphore?

Operating System Concepts discusses two implementations of a semaphore, by busy waiting in Section 5.5 and by blocking the current process in Section 5.6: Section 5.5 A semaphore S is an integer ...
user avatar
  • 5,271
1 vote
1 answer
311 views

Does a safe state not lead to a starvation state?

In Operating System Concepts: 7.5.1 Safe State A state is safe if the system can allocate resources to each process (up to its maximum) in some order and still avoid a deadlock. More formally, a ...
user avatar
  • 5,271
-1 votes
1 answer
157 views

Why does "producers and consumers check availability before getting the mutex" avoid deadlock?

In Little Book of Semaphores: 4.1.6 Finite buffer producer-consumer solution Finite buffer consumer solution 1 items.wait () 2 mutex.wait () 3 event = buffer .get () 4 mutex. signal () 5 spaces . ...
user avatar
  • 5,271
25 votes
5 answers
4k views

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

Operating System Concepts says 7.4.4 Circular Wait The fourth and final condition for deadlocks is the circular-wait condition. One way to ensure that this condition never holds is to impose a total ...
user avatar
  • 5,271
4 votes
4 answers
659 views

How to understand the first and second readers-writers problems?

Computer Systems: a Programmer's Perspective says The readers-writers problem has several variations, each based on the priorities of readers and writers. The first readers-writers problem, which ...
user avatar
  • 5,271
-1 votes
1 answer
59 views

Efficiently keep different data structures synchronised - tree, list of objects

Problem description I have a pet project to translate TEI XML to standoff JSON and back: https://github.com/standoff-nlp/standoffconverter and I am currently thinking about a rewrite/restructuring. ...
user avatar
2 votes
3 answers
179 views

When does a *fixed delay* make sense?

Every now and then I see someone delaying an action by a certain number of milliseconds to ensure it is working. Something like: doSomethingInHtml(); timer.schedule(100); // delay for 100 milliseconds ...
user avatar
  • 281
-4 votes
1 answer
115 views

Difference between inter-thread and inter-process sharing and synchronization

A) I know that threads of a process share logical address space . Therefore they share data by default. B) But if two threads of different processes want to share data ...then there are two options ...
user avatar
  • 1
1 vote
1 answer
126 views

Is it a standard practice to have a single application/controller writing to database

I've been interviewed by some experienced engineer, when he strongly disagreed with some statements I said: Assuming full control over your applications, It's a standard practice to make writes-to-...
user avatar
  • 121
-1 votes
1 answer
55 views

Design solution for updating different lists with common items

I needed some design suggestions for a tricky workflow we have to implement in our system: At a basic level the application allows users to work on a "list" of "items" she cares about To work on any ...
user avatar
1 vote
1 answer
489 views

How do ISRs and user threads synchronize and share data?

My question is more of educational than an actual coding problem. I tried searching the web, but got little help. I am trying to learn how to write ISR and understand how they interact with user ...
user avatar
-3 votes
2 answers
86 views

How to scale an application where every read results in a write?

So I am trying to design a simple URL shortener application where every time a URL is queried, it is going to update the number of times it has been queried. I'm thinking of using MongoDB and I am ...
user avatar
  • 291
3 votes
1 answer
96 views

Synchronizing video playback in LAN over UDP (no master, same HW & SW)

I have devices thay play video files from their local disk basing on a pre-defined playlist (every device plays exactly the same movie in the same order, every device knows in advance what videos will ...
user avatar
0 votes
1 answer
161 views

Need to test for equality on vector clocks

I've heard about vector clocks and how to test if a message was sent before another message. E.g. Message A was sent before message B if every element of the vector of message A is smaller or equal ...
user avatar
  • 111
0 votes
2 answers
2k views

Race condition in Distributed Systems

We have a set of micro-services that are functionally dependent and have intertwined validation logic. e.g. consider 'Credit-Card' service and 'Loan' service. When user has a credit card then loan ...
user avatar
  • 133
1 vote
1 answer
581 views

Does the producer-consumer problem appear in both shared memory and distributed memory architectures?

I saw some books on operating system concepts mention the producer-consumer problem in the context of synchronizing concurrent accesses to shared resources. All seem to be in shared memory ...
user avatar
  • 5,271
-5 votes
1 answer
84 views

As a developer who runs a small business , can i integrate Quickbooks POS with Shopify

I am a senior developer with C# knowledge, and i have developed many console applications and web applications which integrate with external systems using APIs. now i run my small business and i have ...
user avatar
  • 101
0 votes
3 answers
66 views

Offline Synchronisation with Changing Access Rights

We got a distributed application where a client syncs certain data portions to its offline storage and performs modifications on it. The data is structured in container entities "Container" and ...
user avatar
0 votes
1 answer
222 views

Launch threads continuously with predefined interval between threads

I'm currently using a third-party API to fetch results, using a REST client (Retrofit). The problem is that the amount of requests per second that I can do to the API is limited with interval: I can'...
user avatar
  • 137
1 vote
2 answers
70 views

Data Synchronization: How can I keep a parent record updated with its child totals efficiently?

I have an application that returns projects. A Project has many Tasks each Task has a field called hours. A project returns the total hours for all the Tasks that belong to it. My application ...
user avatar
  • 287
-2 votes
1 answer
147 views

Map synchronization algorithm

Say I have two Map instances in JavaScript (or HashMap in Java, or Dictionary in C#), A and B. I want to synchronize B to A, so that B is a copy of A. I can't copy the reference and I don't want to ...
user avatar
  • 432
14 votes
3 answers
18k views

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

Since the inception of .NET Core, console apps, function apps, ASP.NET etc. are not using synchronization context in async methods (so they're synchronizing straight to Thread Pool). This means that ...
user avatar
  • 249
0 votes
0 answers
131 views

How to generate object Ids for both local and online storage?

My application has both offline (SQLite) and online (iCloud) storage. See: Offline First: How Do I Fetch Data? Now, as stated in my past question above, the application is offline first, and I'm ...
user avatar
  • 121
1 vote
1 answer
146 views

Offline First: How Do I Fetch Data?

I'm new to this community, I'm glad I found this and so I can ask questions like this one (as per https://meta.stackexchange.com/questions/68384/whats-the-difference-between-stack-overflow-and-...
user avatar
  • 121