Questions tagged [synchronization]
The synchronization tag has no usage guidance.
172
questions
3
votes
2answers
174 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 ...
0
votes
3answers
392 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.
1
vote
1answer
37 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 ...
1
vote
2answers
87 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" ...
0
votes
1answer
73 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 ...
0
votes
0answers
86 views
Does a memory transaction have ACID properties?
In Operating System Concepts
The concept of transactional memory
originated in database theory, for example, yet it provides a strategy for process
synchronization. A memory transaction is a sequence ...
-2
votes
2answers
168 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 ...
-4
votes
3answers
122 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 ...
0
votes
1answer
112 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....
1
vote
2answers
228 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 ...
0
votes
1answer
108 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 ...
1
vote
1answer
128 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 ...
0
votes
1answer
88 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 . ...
22
votes
5answers
3k 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 ...
4
votes
4answers
146 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 ...
0
votes
0answers
31 views
Offline app with syncing features with React Native
I am currently building an ordering application where users can send orders for available items. It must have the functionality to work offline as well. After user is online, the user has the sync ...
-1
votes
1answer
50 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.
...
2
votes
3answers
167 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 ...
-4
votes
1answer
40 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 ...
0
votes
1answer
113 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-...
0
votes
1answer
50 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 ...
1
vote
1answer
115 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 ...
-3
votes
2answers
77 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 ...
3
votes
1answer
71 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 ...
0
votes
1answer
94 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 ...
0
votes
2answers
777 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 ...
0
votes
1answer
259 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 ...
-5
votes
1answer
69 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 ...
0
votes
3answers
47 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 ...
0
votes
1answer
80 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'...
1
vote
2answers
64 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 ...
-2
votes
1answer
121 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 ...
8
votes
3answers
7k 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 ...
0
votes
0answers
44 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 ...
1
vote
1answer
99 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-...
0
votes
1answer
78 views
Are there pitfalls to using only a remote database for a mobile app?
My research indicates that the ideal database design is:
Mobile App -> Local Database -> Syncing -> Remote Database
using something like PouchDB to do the data replication/syncing.
But ...
0
votes
0answers
31 views
How to arrange synchronicity reporting in an eventually consistent, distributed system?
Context: A typical corporate landscape with many systems located in different data centers, with firewalls, without uniformised interfacing.
Some data X is being replicated for availability and ...
0
votes
1answer
76 views
Reliable data synchronisation between several systems
We have several systems that hold the same data in different databases. The requirement is to keep the data synced in as much reliable way as possible. Performance isn't a concern because we don't ...
5
votes
2answers
2k views
Synchronization of data across microservices
We have 2 to 3 dozen microservices that serve our customers.
These services are deployed in a Kubernetes cluster, and they're only accessible to the outside world through 3 or 4 API gateways.
We ...
2
votes
1answer
143 views
Generic way to describe data synchronization between systems?
Is there a generic way (useful formalisms) to think about data synchronization between two systems, especially in the case of slightly asymmetric roles (eg, one system contain master data, another one ...
1
vote
3answers
512 views
What are criteria for enterprise to have multiple databases (for new project)?
We are working on new enterprise project (multiple activities - online ordering, offline ordering, b2b ordering, accounting processing, secure payment processing, analysis and dynamic pricing and so ...
1
vote
2answers
179 views
Synchronize multiples REST api, centralized into 1 web application
I am developing a web application for a client, connected to 4 differents sources :
E-commerce website
CRM
Emailing platform
Surveys platform
All the sources have REST Api's.
The web application ...
1
vote
1answer
99 views
How state updates to existing instances/sessions are generally done?
This is a very broad question, but maybe someone has a worthwhile response.
There is a general synchronization issue that often has to be solved, but always seems to be difficult. Here's an example:
...
-1
votes
1answer
226 views
Synchronization method vs private final object for locking in java
Can anyone tell me which one is better approach between synchronization method and private final object in java and why ??
public class kclass {
private final Object myObject = new Object();
...
1
vote
0answers
42 views
Client synchronization of authentication tokens in parallel connections
In my app server's authentication implementation, an authentication token is generated for every user that has logged in. According to some highly recommended security tips (Implementing Secure User ...
2
votes
1answer
736 views
Best practices for app-cloud synchronization of database representation
I'm planning a cookbook-like Android app that would let users store/add/edit their e-juice recipes, keep track of the ingredients, etc. Internally, I'll be storing the data in a database on the user's ...
2
votes
1answer
193 views
Race conditions in client synchronization
I have a web app whose server creates a Client for each websocket connection. A Client acts as an intermediary between the websocket connection and a single instance of a Hub. The Hub maintains a set ...
0
votes
2answers
168 views
Keep channels online, even though underlying systems are offline?
We have six very old systems where the newest one is built 1995. All these systems have batch jobs running from midnight to 6 AM every night, and these systems are offline. On top of these six systems ...
1
vote
2answers
643 views
How to implement online/offline data synchronisation?
I want to create a desktop application.
The application must be able to accept database transactions even if internet connection is lost, but as soon as internet connection is available the ...
0
votes
1answer
131 views
How to resolve data-binding efficiently
Following this question, the solution to resolve data binding is to use DFS and Topological Sorting. I am not really sure exactly what that means. Here is an animation that roughly demonstrates what I ...