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
0 votes
0 answers
35 views

Synchranization issue in async jobs created and finished before main thread ends

Main execution thread creates asynchronous job (started and executed by different process) that works on same data that the main thread. For example we create some database entries, that we want to ...
Taavi Ilves's user avatar
0 votes
2 answers
104 views

How do I guarantee ordered processing of occurring events in concurrent environment?

I have a Kafka topic providing events of the following type: id(hash):[ADD|REMOVE]. These events may be generated at a high rate and are idempotent, i.e. getting 123:ADD one time and ten times in a ...
svz's user avatar
  • 307
0 votes
0 answers
38 views

Conditional mutex locking

Suppose I have 2 microservices that update some user entities: One that allows users to interact with their own entities, lets call it service A, and another that iterates through all user entities, ...
string_loginUsername's user avatar
3 votes
3 answers
199 views

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

I need to compare and synchronize two tree data structures. I have Tree A (the "Reference Tree") and Tree B (the "Target Tree"). I need to bring the Target Tree into compliance ...
Deane's user avatar
  • 171
1 vote
1 answer
84 views

How best to keep Excel Workbook field in sync across class instances

I know almost nothing about threads, synchronization, ... That being said, I am working on a record handler, that hits Excel sheet to pull/push data. There exist, in my code base, a BaseRecordHandler, ...
Mike Warren's user avatar
0 votes
1 answer
80 views

Data backup/slave node with replicated data, to be writeable while master is offline

I'm developing and designing a system which runs mostly on intranet of client companies. The system consists of one main database which is MariDB, for now one web-application as system management and ...
TomCrow's user avatar
  • 11
1 vote
0 answers
149 views

If you run a function in a different thread, but you wait for it to finish in your main thread, is that function asynchronous?

Backstory Probably a stupid question, but I just have a sneaking suspicion that "asynchronous" is the wrong terminology to us for naming my template function here: template <class T> ...
Anon's user avatar
  • 3,575
3 votes
3 answers
3k 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 ...
Frankster's user avatar
  • 159
1 vote
2 answers
124 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(...
walen's user avatar
  • 355
4 votes
1 answer
417 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 ...
Dmitry Streblechenko's user avatar
0 votes
1 answer
98 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 "...
alvm's user avatar
  • 3
0 votes
0 answers
34 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 ...
Prodigy's user avatar
4 votes
4 answers
2k 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 ...
KhiladiBhaiyya's user avatar
-1 votes
1 answer
342 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,...
Phrixus's user avatar
  • 101
1 vote
1 answer
562 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 ...
ccleve's user avatar
  • 171
-2 votes
1 answer
287 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 ...
user15639575's user avatar
1 vote
0 answers
42 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 ...
Joshua Frank's user avatar
0 votes
1 answer
91 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. ...
root66's user avatar
  • 111
0 votes
0 answers
117 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 ...
Bin4ry's user avatar
  • 101
2 votes
0 answers
32 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 ...
johnny 5's user avatar
  • 335
1 vote
1 answer
449 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 ...
GisMofx's user avatar
  • 379
1 vote
2 answers
677 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. ...
Lucien's user avatar
  • 121
0 votes
0 answers
46 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 ...
Olamide226's user avatar
-1 votes
3 answers
391 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 ...
78dtat78da's user avatar
4 votes
2 answers
825 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 ...
user2146414's user avatar
6 votes
5 answers
5k 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.
Tim's user avatar
  • 5,415
1 vote
1 answer
51 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 ...
Jessica's user avatar
  • 349
4 votes
3 answers
919 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" ...
Tim's user avatar
  • 5,415
2 votes
1 answer
2k 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 ...
Tim's user avatar
  • 5,415
-2 votes
2 answers
199 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 ...
rosi97's user avatar
  • 135
-4 votes
3 answers
532 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 ...
Tim's user avatar
  • 5,415
0 votes
1 answer
811 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....
Tim's user avatar
  • 5,415
1 vote
2 answers
1k 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 ...
Tim's user avatar
  • 5,415
1 vote
1 answer
964 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 ...
Tim's user avatar
  • 5,415
1 vote
1 answer
400 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 ...
Tim's user avatar
  • 5,415
-1 votes
1 answer
212 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 . ...
Tim's user avatar
  • 5,415
27 votes
5 answers
6k 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 ...
Tim's user avatar
  • 5,415
4 votes
4 answers
2k 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 ...
Tim's user avatar
  • 5,415
-1 votes
1 answer
66 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. ...
Milla Well's user avatar
2 votes
3 answers
189 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 ...
Adelin's user avatar
  • 281
-4 votes
1 answer
199 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 ...
Urooj's user avatar
  • 101
1 vote
1 answer
147 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-...
Samha''s user avatar
  • 121
-1 votes
1 answer
61 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 ...
user642770's user avatar
1 vote
1 answer
893 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 ...
S_pt1132's user avatar
-3 votes
2 answers
88 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 ...
Auro's user avatar
  • 291
3 votes
1 answer
182 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 ...
hazelnutek's user avatar
0 votes
1 answer
224 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 ...
dan1st's user avatar
  • 111
0 votes
2 answers
3k 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 ...
Sekar's user avatar
  • 133
1 vote
1 answer
730 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 ...
Tim's user avatar
  • 5,415
0 votes
3 answers
76 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 ...
ampramp's user avatar