Top "Locking" questions

Locking allows different types of resources to be used exclusively by one process at a time.

Java Concurrency: CAS vs Locking

I'm reading the Book Java Concurrency in Practice. In chapter 15, they are talking about the nonblocking algorithms and the compare-and-swap (…

java concurrency locking compare-and-swap
Is it ok to read a shared boolean flag without locking it when another thread may set it (at most once)?

I would like my thread to shut down more gracefully so I am trying to implement a simple signalling mechanism. …

c++ multithreading locking boolean monitor
Java blocking issue: Why would JVM block threads in many different classes/methods?

Update: This looks like a memory issue. A 3.8 Gb Hprof file indicated that the JVM was dumping-its-heap when this "blocking" …

java garbage-collection locking blocking concurrent-programming
Is there a "try to lock, skip if timed out" operation in C#?

I need to try to lock on an object, and if its already locked just continue (after time out, or …

c# multithreading locking
Reference for proper handling of PID file on Unix

Where can I find a well-respected reference that details the proper handling of PID files on Unix? On Unix operating …

locking daemon unix
How to use tcp_keepalives settings in Postgresql?

Postgresql has 3 keepalive settings for managing dropped connections (in postgresql.conf): tcp_keepalives_count tcp_keepalives_idle tcp_keepalives_interval …

postgresql locking keep-alive
Static versus non-static lock object in synchronized block

Trying to visualize and understand synchronization. What are the differences between using a static lock object (code A)

java static synchronization locking synchronized
Forcing closed an open file by C#

I found a similar question here but it was closed/accepted with an answer of "don't do that". I'm in …

c# file-io locking move
Re-assign/override hotkey (Win + L) to lock windows

Is it possible to re-assign the Win+L hotkey to another executable/shortcut? Use-case - I would like to switch …

windows locking keyboard-shortcuts monitor energy
Why is volatile used in double checked locking

From Head First design patterns book, the singleton pattern with double checked locking has been implemented as below: public class …

java design-patterns locking singleton double-checked-locking