This article explains Java deadlocks with synchronized and Lock examples, outlines the four necessary conditions, introduces detection tools such as jstack, jconsole, jvisualvm and jmc, and presents practical solutions including sequential locking and polling lock techniques with optimizations to avoid loops and starvation.
This article provides a comprehensive overview of Node.js’s architecture, including its composition, code structure, startup process, event loop phases, process and thread management, core modules such as Cluster, libuv thread pool, signal handling, file operations, and networking protocols, illustrating how the runtime integrates V8 and operating‑system features.
This article explains why the Thread.stop and Thread.suspend methods were deprecated in modern Java, demonstrates the problems they cause with concrete code examples, and presents two safe alternatives—using a shared flag and the interrupt mechanism—to gracefully terminate threads without risking deadlocks or resource leaks.
This article explains why the historically used Thread.stop and Thread.suspend methods were deprecated in Java, illustrates their unsafe behavior with code examples, and demonstrates safer alternatives such as flag-controlled loops and the interrupt mechanism for graceful thread termination.
This article explains Java thread states, their lifecycle transitions, and provides practical code examples demonstrating NEW, RUNNABLE, BLOCKED, WAITING, TIMED_WAITING, and TERMINATED states, along with insights on synchronization, spurious wakeups, and best practices for using wait() within loops.
This article explains core operating‑system concepts such as processes, threads, their control blocks and contexts, details how CPU, process, and thread context switches and system calls work on Linux, and shows how to analyze them with vmstat, pidstat, and sysbench for performance tuning.
This article explains the concepts of processes and threads, compares their characteristics, outlines their respective advantages and disadvantages, and provides practical guidelines for choosing between multithreading and multiprocessing in software design.
This article explains the fundamental concepts of processes and threads in operating systems, compares their characteristics, outlines their respective advantages and disadvantages, and provides practical guidelines for choosing between multi‑process and multi‑thread designs in real‑world applications.
This article analyzes why MySQL connections remain in a KILLED state after a KILL command, detailing the internal execution flow, thread‑state handling, signal‑based wake‑ups, and reproducing cases that expose rollback, lock‑wait, and concurrency issues that delay connection termination.
This article presents twelve fundamental Java concurrency interview questions, covering thread creation methods, their pros and cons, thread states, lifecycle, start vs run, termination, thread safety, differences between threads and processes, communication, yield vs sleep, and provides concise answers to help candidates demonstrate solid multithreading knowledge.
Through a whimsical first‑person narrative, the article explains three Java thread‑creation techniques—extending Thread, implementing Runnable (including anonymous and lambda forms), and using Callable with FutureTask—to illustrate their syntax, usage, and the ability to retrieve thread results.
This article explains the concepts of processes and threads, their differences, interactions, state transitions, concurrency models, synchronous vs asynchronous execution, and the use of process pools to improve resource management and performance.
This article explains the concepts of processes and threads, their differences, interaction methods, the three execution states of a task, synchronous and asynchronous communication, and the design and benefits of using a process pool to manage resources efficiently.
This article explains the concepts of processes and threads, their differences, interaction methods, the relationship between them, the three execution states of a task, the distinctions among parallel, concurrent, and serial execution, and the purpose and operation of process pools in operating systems.
This article explains the fundamental concepts of processes and threads in operating systems, compares their characteristics, advantages, and disadvantages, and provides practical guidelines on when to use processes, threads, or a combination of both for concurrent execution.
This comprehensive guide covers the fundamentals of processes and threads, their definitions, relationships, creation, lifecycle, scheduling strategies, context switching, inter‑process communication methods, and practical C/C++ examples, providing a deep dive into operating‑system concepts for developers and interview preparation.
This article explains how Android drives applications through a message‑driven model by detailing the roles of Message, MessageQueue, Looper, Handler, and ThreadLocal, and walks through the native implementation of ActivityThread's main loop, including prepareMainLooper, MessageQueue initialization, epoll integration, and the polling mechanisms that power the message processing cycle.
This article explains why a non‑volatile boolean flag cannot reliably break a Java thread’s infinite loop, details the visibility and reordering issues that volatile solves, and presents correct solutions such as using volatile or AtomicBoolean for safe loop termination.
This article explains the internal state management, waiting queue, and node states of Java's AbstractQueuedSynchronizer (AQS), demonstrates how to create a custom reentrant lock by extending AQS, and walks through the lock acquisition and release process with detailed code examples.
A whimsical story depicts a GoLang envoy introducing the concept of coroutines to the proud Java empire, contrasting thread blocking, asynchronous callbacks, and cooperative scheduling, and explores how execution contexts can be saved, switched, and resumed without OS intervention.
This article explains Java's thread lifecycle, detailing its six states—New, Runnable, Blocked, Waiting, Timed_waiting, and Terminated—and describes eleven commonly used thread APIs such as join(), wait(), notify(), yield(), sleep(), currentThread(), getName(), getId(), getPriority(), setPriority() and stop().
This article explains core operating system concepts—CPU as a factory, the static nature of programs versus dynamic processes, how threads act as workers on production lines, and synchronization mechanisms like mutexes and semaphores, using clear analogies and diagrams.
This article explains the distinction between Java's RUNNABLE thread state and the operating‑system concepts of ready, running, and waiting, covering JVM‑level definitions, I/O blocking behavior, time‑slice scheduling, and includes concrete code examples to illustrate how blocked I/O still appears as RUNNABLE.
Understanding Java's thread lifecycle—from creation (NEW) through runnable execution, waiting states, blocking, and termination—is essential for multithreaded development, and this guide breaks down each state, transitions, and relevant code examples to help you master concurrency concepts.
This article explains the operating‑system concepts of processes, threads, and coroutines, compares their performance with Python code examples, discusses the impact of the GIL and DMA, and provides clear guidelines for choosing the right concurrency model based on CPU‑bound, I/O‑bound, or mixed workloads.
A real‑world incident showed that a 0% CPU idle rate can mask severe disk IO wait, leading to thread exhaustion in a SpringBoot order service, and the article explains how IO, DMA, Java thread states, and various Linux network IO models interact while offering practical mitigation tactics.
Android captures uncaught Java exceptions using Thread.UncaughtExceptionHandler, first logging details with a system LoggingHandler then terminating the app via KillApplicationHandler, converting the Throwable into an ApplicationErrorReport sent to ActivityManagerService and stored in /data/system/dropbox, while developers can view the same FATAL EXCEPTION stack trace in logcat to diagnose and fix the root cause.
This article explains the core concepts of Java's AbstractQueuedSynchronizer (AQS), its internal FIFO double‑linked list structure, key code snippets, how threads acquire and release resources in exclusive and shared modes, and provides practical insights for mastering Java concurrency.
The article anthropomorphizes several JVM internal threads—FinalizerThread, AppClassLoader, ReferenceHandler, and VMThread—detailing how they handle object finalization, class loading, special reference queues, and VM operations, providing a whimsical yet informative overview of JVM internals.
This article provides a detailed analysis of JDK 1.8’s FutureTask implementation, explaining its purpose, usage examples, internal structure, state transitions, key methods such as run, get, cancel, and the concurrency mechanisms like volatile fields, CAS operations, and thread‑waiting queues.
This article provides a comprehensive guide to Java's thread lifecycle, detailing each of the six thread states, their meanings, how they are triggered, and practical code examples that demonstrate state transitions and logging output.
This article introduces the fundamentals of Java multithreading and concurrency, covering the differences between processes and threads, the relationship between Thread and Runnable, start vs run, thread creation methods, handling return values, thread states, sleep vs wait, notify vs notifyAll, yield, interrupt, and the use of thread pools with executors.
This article explains Java's lock mechanisms, comparing synchronized and the Lock interface, detailing their usage, implementation via AQS, system‑level primitives, and providing code examples to help developers choose the appropriate synchronization tool.
This article explains operating system fundamentals such as process and thread definitions, time‑slice preemptive scheduling, process features and lifecycle, thread characteristics, priority handling, multi‑core execution models, and synchronization mechanisms like mutexes and semaphores.
This article introduces Java Lambda expressions, explains the functional interface requirements, demonstrates basic and simplified syntax, and provides numerous practical examples such as method references, constructor references, thread creation, collection iteration, element removal, sorting, and closure behavior.
This article explains the three primary techniques for creating threads in Java—subclassing Thread, implementing the Runnable interface, and using Callable with Future—provides complete code examples for each method, and compares their advantages and disadvantages for practical multithreading development.
This article explains Java's thread synchronization mechanisms by comparing synchronized blocks with the Lock interface, detailing thread basics, lifecycle methods, lock types, code demonstrations, fairness settings, and underlying JVM implementations, helping readers understand when and how to use each construct effectively.
This article explains Java thread lifecycle, compares OS generic thread states with Java’s six states, shows how to query thread state via getState(), and introduces debugging tools like jstack and Arthas, helping developers master state transitions and write robust concurrent code.
This article explains what a RunLoop is, why it exists, its internal structure and modes, how it interacts with threads, and common iOS development techniques such as keeping threads alive, image loading, timer handling, and performance monitoring.
This article explains how to properly stop a Java thread, compares deprecated Thread.stop() with interruption techniques, demonstrates checking a thread's interrupted state, shows how to use exceptions and return statements for graceful termination, and warns about the dangers of forceful stops and lock release.
This article explains the fundamentals of Java's AbstractQueuedSynchronizer (AQS), covering its basic concepts, core components, lock and unlock mechanisms, condition objects, and provides a pseudo‑code example for building a custom AQS implementation.
The article demonstrates that Kotlin coroutines on the JVM are merely a convenient API layered on traditional Java threads rather than true lightweight coroutines, contrasting them with Go’s M:N goroutine scheduling, and discusses experimental Kotlin‑Native and OpenJDK Loom projects that aim to provide genuine coroutine support.
This article examines why Java applications experience high CPU usage, covering infinite loops, frequent Young GC, thread count and state, user‑space versus kernel‑space metrics, and provides a step‑by‑step troubleshooting guide illustrated with a real incident.
This article explains Node.js's internal concurrency model, covering the distinction between processes and threads, debunking the single‑thread myth, and detailing how the event loop, child processes, cluster mode, and worker_threads enable high‑performance, multi‑core execution.
This article explores five advanced Java thread techniques—custom thread names, priority management, ThreadLocal storage, user versus daemon threads, and processor affinity—showing how to apply them for better debugging, performance tuning, and reliable concurrent applications.
This article provides a comprehensive guide to common Java multithreading interview questions, covering thread ordering with join, lock vs synchronized, read‑write locks, wait vs sleep, blocking queues, producer‑consumer patterns, deadlock detection, thread dumps, thread states, and immutable objects, all illustrated with runnable code samples.
This article explains the various ways to terminate a running Java thread—including using exit flags, the deprecated stop() method, interrupt(), and exception handling—illustrates each approach with code samples, compares Thread.interrupted() and isInterrupted(), and discusses the dangers of forceful termination and lock release.
The article uses a vivid fruit‑store story to illustrate core Java concurrency concepts such as threads, lock objects, critical sections, thread states, synchronization queues, wait/notify mechanisms, and volatile variables, helping readers grasp multithreading fundamentals through relatable scenarios.
This article explains the Java RUNNABLE thread state, how it differs from traditional OS ready and running states, the impact of time‑slicing and I/O blocking, and demonstrates with code that even blocked I/O operations keep a Java thread in the RUNNABLE state.
This article explains the concepts of processes and threads in Python, compares multi‑process, multi‑thread, and combined approaches, shows how to use fork, the multiprocessing module, process pools, subprocesses, and inter‑process communication with queues, and provides complete code examples with results.
This article explains three Java thread‑creation techniques—extending the Thread class, implementing the Runnable interface, and implementing the Callable interface—provides complete code examples for each, compares their advantages and disadvantages, and recommends the best practice for concurrent programming.
This article explains the Java RUNNABLE thread state, how it differs from traditional OS ready/running states, its relationship with time‑slicing, blocking I/O, and why the JVM reports many blocked operations as RUNNABLE, illustrated with code examples and diagrams.
This guide explains how to use Java's Runtime API within a UiAutomator test to start, filter, and safely terminate an adb logcat process, including a complete Logcat thread implementation and tips for preventing oversized log files.
This article introduces C# multithreading concepts, covering thread creation, memory isolation, data sharing, thread safety with locks, and the use of Join and Sleep methods, while providing clear code examples and explanations of how threads are scheduled and interact with the CPU.
This article introduces C# multithreading concepts, demonstrates thread creation, memory isolation, data sharing, thread safety with locks, and explains the use of Join and Sleep methods, providing practical code examples and best‑practice guidance for concurrent programming.
This article explains how infinite loops, frequent Young GC, thread count, and thread states affect CPU utilization in Java, describes the relationship between CPU, processes, and threads, and shares practical troubleshooting steps and real‑world cases for diagnosing high CPU usage.
This article explores why Java applications experience high CPU usage, examines common misconceptions about loops, GC, thread counts, and blocked states, explains how CPU usage is calculated, and provides practical troubleshooting steps with real‑world examples and monitoring tips.
This article shares WeChat's engineering experience in detecting and preventing various Android memory leaks—including Activity, Bitmap, native, and thread leaks—by building custom tools, refining monitoring pipelines, and applying fallback protection to keep the app stable at scale.
This article explains Java's six thread states—NEW, RUNNABLE, BLOCKED, WAITING, TIMED_WAITING, and TERMINATED—detailing their meanings, transitions, related waiting and synchronization queues, and comparing key thread-control methods such as sleep, yield, join, wait, and notify.
This comprehensive guide walks experienced front‑end developers through the browser's multi‑process model, internal threading, rendering pipeline, JavaScript single‑threaded execution, event loop mechanics, Web Workers, and performance‑related concepts like macrotasks, microtasks, and hardware‑accelerated compositing.
This article explains Linux process fundamentals—including creation, the PCB, scheduling, and the emergence of zombie processes—details their causes and removal methods, and then compares processes with threads, covering multithreading implementation, issues, classifications, priorities, and synchronization techniques.
This article explains Linux process fundamentals, scheduling, the creation of zombie processes, their causes, and practical methods to avoid them, while also comparing processes and threads and discussing multithreading concepts and synchronization techniques.
This article explains the internal mechanisms of Java's AbstractQueuedSynchronizer, detailing how the CLH synchronization queue, the shouldParkAfterFailedAcquire method, and the LockSupport utility work together to decide when a thread should spin, block, or be unblocked, with full code examples and step‑by‑step analysis.
This article provides a comprehensive introduction to Java multithreading, covering its historical background, thread lifecycle states, two ways to create threads, code examples for shared and non‑shared data, synchronization with the synchronized keyword, thread control methods such as interrupt, sleep, suspend, yield, priority settings, and daemon threads, concluding with key takeaways.
This article explains Java multithreading fundamentals, covering thread states, synchronization mechanisms such as synchronized, wait/notify, volatile, and advanced utilities like ThreadLocal, atomic classes, locks, blocking queues, and thread pools, with practical code examples for each concept.
This article provides a comprehensive overview of Java concurrency, covering thread creation methods, thread pools, thread models, the Future and Fork/Join frameworks, volatile and CAS mechanisms, AQS, synchronized locks, and various concurrent queue implementations, with practical code examples and references for deeper study.
This article provides a high‑level summary of Java concurrency, covering thread creation methods, thread models, thread pools, Future and CompletableFuture, the Fork/Join framework, volatile, CAS, AQS, synchronized locks, and concurrent queue implementations, with code examples and reference links for deeper study.
This article explains how to achieve thread communication and coordination in Java using Thread.join(), Object.wait()/notify(), CountDownLatch, CyclicBarrier, and the Callable/FutureTask pair, providing complete code examples and execution results for each technique.
This article explains essential Java concurrency concepts—including synchronous vs. asynchronous execution, concurrency vs. parallelism, critical sections, blocking and non‑blocking operations—covers thread states, creation methods, priorities, common thread APIs, and the Java Memory Model’s guarantees on atomicity, visibility, and ordering.
This article explains the concepts of processes and threads, their historical development, and how Java implements multithreading and synchronization using techniques like extending Thread, implementing Runnable, and applying the synchronized keyword to ensure thread safety.
This article explains Pika's master‑slave replication architecture, detailing its specialized threads, full and incremental replication workflows, key API functions, and the slaveof and trysync processes that enable persistent, large‑scale data synchronization beyond Redis limitations.
This article presents a comprehensive collection of 40 Java multithreading interview questions, covering the purpose of multithreading, thread creation methods, differences between start() and run(), Runnable vs Callable, synchronization utilities, memory model, locks, thread pools, and best practices for concurrent programming.
This article compiles 50 of the most frequently asked Java multithreading and concurrency interview questions, covering core concepts, thread creation, synchronization mechanisms, memory model, common pitfalls, and best practices, providing concise explanations to help both novice and experienced developers prepare effectively.
This article explains what processes and threads are, how they relate, their key differences, and the advantages and disadvantages of each, helping readers grasp why multithreading can boost efficiency while processes offer stronger isolation and fault tolerance.