Questions tagged [locks]
Locks are a synchronization mechanism for enforcing limits on access to a resource.
80 questions
1
vote
4
answers
273
views
A passive LRU cache with locks
Context
I'm working on a client-server-agent application, where server distributes tasks supplied by clients over agents. Server is passive, all communications are initiated by clients and agents.
...
1
vote
1
answer
345
views
Protecting garbage collection data structure with reader-writer lock might not be appropriate?
I'm thinking about implementing garbage collection efficiently by protecting the structure that tracks allocations using reader-writer lock. However, I'm worried memory semantic may invalidate the ...
1
vote
2
answers
356
views
Maintaining locks across abstraction
Over and over I am faced with a similar problem: I have to perform two actions that are mostly unrelated, except that they need to share a mutex lock, at least for a moment. For example:
void action() ...
5
votes
2
answers
2k
views
C#: Refactoring an oversized try/catch/finally
Recently I've come to discover that I've inherited one of the internal auxilliary programs used. I've made a few minor fixes and features to improve it in the past, but now I've been given a major ...
-1
votes
1
answer
416
views
Building a function call tree at runtime
Edit #1
I believe that I misrepresented my intent when writing this question by focusing too much on the issues that have arisen from our misuse/misunderstanding of locks. I am making this edit to try ...
4
votes
4
answers
4k
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 ...
-1
votes
1
answer
2k
views
Locking a DB table and waiting for writing/reading it from a web application
I'm working on a web application using Spring (Java and JPA + Hibernate) and I was wondering if there is a way of locking a MYSQL table and then when another web service (or even another thread from ...
2
votes
0
answers
315
views
Automatically extended database-based mutex lock - is it a good idea?
Since I am working in a multi-instance microservice environment, I came accross a problem with making some operations being performed at most by one of the running instances at once. The solution ...
1
vote
2
answers
319
views
Locking (reserve) related Aggregate Roots
Problem
In my application a user can lock a set of related aggregate roots to work exclusively on them and to avoid the usage of an invalid set of objects later in the process (by other employees). ...
1
vote
2
answers
1k
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.
...
1
vote
2
answers
357
views
Alternatives to pessimistic locking in the DBMS for load balancing
A simplified version of my problem looks like this:
the database contains two tables:
one contains account balances (Accounts)
the other contains account withdrawal and deposit requests (Requests)
...
7
votes
3
answers
739
views
How to replace a file to its latest version in server that is being constantly fetched by a REST API
We have a REST API Get request which downloads a file from the server. This file needs to be updated whenever there is a latest version. Currently this is done by deleting the existing file and moving ...
7
votes
5
answers
9k
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.
0
votes
2
answers
376
views
My aproach to lockless concurrency
this is a highly theoretical question about my parallelization approach.
First of all, I want to inform everybody that I do not claim that I am the 'inventor' of that approach but I couldn't find any ...
-3
votes
1
answer
91
views
Will this time duration measurement in two threads give correct result?
A program I'm developing has two threads running similar but different task:
thread1:
timer1.start()
writeToExternalDB1(consumedData)
timer1.end()
thread2:
timer2.start()
writeToExternalDB2(...