Questions tagged [locks]

A lock generally refers to something that prevents another process from starting or accessing the same information until the lock is released. Use with an appropriate language tag. Do not use for physical locks.

433 questions
-1
votes
1 answer

Using synchronized block to protect against infinite loops

I'm currently developing an app that in some test cases, goes on a infinite loop, but if I redo the same tests, it goes on well. To prevent it, I'm using a secondary thread to monitor the time passed since the start of a task, but I'm currently not…
João Esteves
  • 89
  • 1
  • 1
  • 3
-1
votes
2 answers

Optimize select Query performance that is having join with various other tables in MS SQL

I have a select query that retrieve huge amount of data based upon some joins with other tables and all the tables are being used by other processes(Some of them are writing data to these tables and some other are retrieving from). The simultaneous…
error_handler
  • 1,191
  • 11
  • 19
-1
votes
2 answers

Make All Keys Expire By Default In Redis

I'm using MSETNX (http://redis.io/commands/msetnx) as a locking system, whereby all keys are locked only if no locks already exist. If a machine holding a lock dies, that lock will be stuck locked - this is a problem. My ideal answer would be that…
Adrian Seeley
  • 2,262
  • 2
  • 29
  • 37
-1
votes
2 answers

Locking threads in java doesnt work

I have a simple problem with multithreading that I just cant figure out. I tried synchronizing methods and using locks but none of these worked so I hope someone here could help me. public void startThreads(ArrayList> pLista) { …
user2740217
  • 155
  • 1
  • 1
  • 8
-1
votes
1 answer

Lock a file for reading even from Operating System except a single process

I have a encrypted zip with a file inside it. I want to decrypt said file, and use the path of the decrypted file as a input to a new java program. I don't want anyone to read my decrypted file, nor do anything else with it. The best solution I've…
Silva
  • 270
  • 4
  • 16
-1
votes
1 answer

Semaphore locks solution in C

How can i solve the following problem implementing semaphore synchronization... For the purposes of this problem we will model the intersection as shown above, dividing it into quarters and identifying each quarter with which lane enters the…
don great
  • 53
  • 1
  • 11
-2
votes
1 answer

Sync more threads with atomic variable

I'm right now working on a school projection and i have some problems with sync'ing 3 threads (2 threads + mian thread). The description says that i have to print 100x "ping" then 100x"pong" and 100x"\n", BUT in this order : PingPong\n and so on...…
-2
votes
2 answers

Core Java , Shared Counter in Multithreading env

I got the java counter problem: two threads share a common counter and increment it in turns. Now can someone please show code examples of it using synchronization, Locks and AtomicIntegers means using different approach. I am not getting any good…
pooja
  • 23
  • 2
  • 6
-2
votes
2 answers

Deadlock for a system with N threads

Suppose I have a system with N processes. Each process needs max K resources (K << N). To prevent collisions a process needs to lock each resource before accessing it. Is a deadlock possible and if yes, what is the maximum N for which the system is…
Ebtic Bobo
  • 79
  • 8
-3
votes
1 answer

Java lock's condition implementation

Need help with code at below link as it should run indefinitely likewise with any typical producer/consumer problem but somehow it is getting stuck on call of condition.signal(). What am I doing wrong here? In main method, I have created two thread,…
Anuraag
  • 33
  • 4
-3
votes
1 answer

Multiple SQL Server- monitoring tool

We have around 20 Different physical servers in which SQL Server has been installed and configured( various versions MS SQL servers) Need to monitor the complete SQL servers using one tool Which includes Database Performance, wait time, expensive…
Karl
  • 41
  • 1
  • 7
-3
votes
1 answer

How to acquire a lock in C++?

Can any one helps me to understand how to lock variables in c++ in the most simple example, pretending I need to lock 2 variables in a function or a thread
Arwa196
  • 133
  • 1
  • 10
-3
votes
1 answer

Multithreading, Locks

Let us consider a system with multiple locks. Let us say that process A wants to acquire a lock. The traditional method is to contend for the lock and ultimately get it. Instead of this, can we do something different? Can we give the task that needs…
1 2 3
28
29