The Observer Design Pattern in Java

The Observer design pattern establishes a one-to-many dependency between objects, ensuring that when a subject changes state, all its registered dependents are automatically notified and updated. This behavioral pattern decouples the publisher from its subscribers, enabling flexible system architectures where components can react to external ev ...

Posted on Tue, 04 Aug 2026 16:24:25 +0000 by GreenCore

Java Thread Fundamentals

Thread Safety: Single-threaded operations, no concurrency, typically found in older API versions. StringBuffer Vector HashTable Non-thread-safe: Multi-threaded concurrent operations, generally newer versions that improve performance but introduce concurrency issues. StringBuilder ArrayList HashMap The execution order of threads primarily depend ...

Posted on Mon, 13 Jul 2026 16:28:33 +0000 by yarnold

Understanding Java's Synchronized Mechanism: From Bytecode to Monitor Objects

Java Object Structure In the JVM, objects are organized into three memory regions: Object Header Mark Word: Stores object hash code, generation age, and lock status flags. This field is dynamically reused based on the object's state. Klass Pointer: A reference to the class metadata, enabling the JVM to determine the object's class. Instan ...

Posted on Wed, 24 Jun 2026 18:30:14 +0000 by gmcalp

Using Strings as Synchronization Locks in Java

Using Strings as Synchronization Locks in Java In Java, the String class possesses unique characteristics due to its implementation of the string constant pool. Although the implementation details changed in JDK 1.8 and later versions, the fundamental behavior remains consistent. This distinctive feature allows us to utilize String objects as s ...

Posted on Thu, 18 Jun 2026 18:00:08 +0000 by Leppy

Fundamentals of Concurrent Programming

Root Causes of Concurrency Issues Visibility Visibility refers to the ability of a thread to immediately observe changes made to shared variables by other threads. The fundamental problem stems from CPU cache architectures. // Thread A executes int counter = 0; counter = 42; // Thread B executes int result = counter; When Thread A executes c ...

Posted on Sun, 31 May 2026 23:21:42 +0000 by fris

Multithreaded C Implementation with Regex and File I/O for Extracting Numeric Data

This article demonstrates a C program that reads a source file line by line, extracts numeric segments from each line using regular expressions, and writes the results to a target file. The implementation uses two threads that alternate execution, with a mutex protecting shared data. The gather thread is responsible for reading lines from the s ...

Posted on Tue, 26 May 2026 18:04:04 +0000 by ionik

Cross-Clock Domain Handshake Mechanisms

When transferring data between different clock domains, handshake synchronization mechanisms provide a reliable solution. These mechanisms are categorized into half-handshake and full-handshake approachse. The half-handshake method is suitable for transferring data from a lower frequency clock domain to a higher frequency domain, as the receive ...

Posted on Wed, 20 May 2026 05:53:58 +0000 by doremi

Python Threading: Concurrency, GIL, and Synchronization

Background Knowledge Processes In operating systems, a program cannot run independently. Only when a program is loaded into memory and the system allocates resources to it can it execute. This executing program is called a process. The difference between a program and a process is that a program is a static collection of instructions, while a ...

Posted on Mon, 18 May 2026 00:26:51 +0000 by ThEMakeR

Common Lock Strategies and Synchronized Implementation

Common Lock Strategies Detailed Lock Strategies 1. Pessimistic Lock vs. Optimistic Lock Criteria: When locking, predict whether the probability of lock contention is high or low. If the probability is predicted to be high, more work is required, and locking overhead (time, system resources) is larger → Pessimistic Lock If the probability is pr ...

Posted on Sat, 16 May 2026 00:15:43 +0000 by elenev

Configuring Rsync for Automated Remote File Synchronization

Setting up an Rsync daemon on a server enables efficient and secure file mirroring to remote clients. This guide walks through deploying a sync service on 192.168.18.211 to replicate /root/rsync-server/ to a client's /root/rsync-local directory, leveraging CentOS 6.5's built-in rsync capabilities. Verification and Installation Confirm rsync is ...

Posted on Fri, 15 May 2026 21:00:30 +0000 by phpyoungdeveloper