Mr Dk's Technical Notes

website·Indexed 30 days ago

https://mrdrivingduck.github.io/blog/

A collection of detailed technical study notes covering Nginx internals (including ngx_pool_t, event-driven frameworks, and IPC), Redis implementation (data structures and slow logs), Linux kernel development, process management, and Spring Cloud microservices with Netflix Hystrix and Spring Cloud Stream.

Tokens
539.8K
Snippets
2.2K
Records
3.3K
Agent score
75%

What's inside Mr Dk's Technical Notes

  1. Overview of pg_duckdb extension

    pg_duckdb is a PostgreSQL extension that embeds the DuckDB analytical engine directly into the PostgreSQL process. It allows PostgreSQL to maintain its transactional strengths while gaining DuckDB's analytical capabilities, such as columnar storage, vectorized execution, parallel query processing, and support for various data formats (Parquet, CSV, JSON) and sources (S3, HTTP).
  2. Overview of ScheduledExecutorService

    The ScheduledExecutorService interface extends ExecutorService to allow tasks to be scheduled for execution after a specific delay or to be executed periodically. All scheduling methods use relative delays and periods rather than absolute dates or times. Tasks submitted via standard execute() or submit() methods are treated as having a delay of zero (immediate execution).
  3. Overview of java.util.concurrent.FutureTask

    FutureTask is a default implementation of the Future interface that represents a cancellable asynchronous computation. It can wrap a Callable or Runnable object and, because it implements RunnableFuture (and thus Runnable), it can be submitted to an Executor for execution.

    Key capabilities include:

    • Starting and cancelling a computation.
    • Querying whether the computation is complete.
    • Retrieving the result of the computation (blocking if the task is not yet finished).

    Once a computation completes, it cannot be restarted or cancelled unless it was invoked using runAndReset().

    public class FutureTask<V> implements RunnableFuture<V> {
        // Implementation details
    }
  4. Overview of the Java Platform Module System (JPMS)

    Introduced in JDK 9, the Java Platform Module System (JPMS) evolves the JAR concept from a simple code container to a structured module. JPMS provides a configurable encapsulation mechanism where the public keyword no longer grants global access. Instead, access control is fine-grained and must be explicitly declared.

    Modules include the following metadata:

    • A list of dependencies on other modules.
    • A list of exported packages (packages accessible to other modules).
    • A list of open packages (packages accessible via reflection by other modules).
    • A list of services used.
    • A list of service implementations provided.
  5. Overview of Redis Sentinel High Availability

    Redis Sentinel is a high-availability solution consisting of one or more Sentinel instances that monitor master and slave servers. When a monitored master server goes offline, Sentinel automatically promotes a slave to be the new master. The process involves: 1. Selecting a healthy slave to promote. 2. Instructing other slaves to replicate from the new master (failover). 3. Reconfiguring the original master to be a slave of the new master once it returns online.
  6. Overview of lsof (list open files)

    lsof is used to list all open files on a Linux system. Because 'everything is a file' in Linux, lsof reports on various types of open entities, including regular files, directories, character/block devices, and pipes.
  7. Overview of Pipe Implementation in pipe.c

    Pipes are a fundamental mechanism for inter-process communication (IPC). In this implementation, each pipe is associated with an inode and uses a single page of memory as a circular buffer. The inode stores the buffer address, a head pointer (for writing), and a tail pointer (for reading).

    Key behaviors:

    • Read Operation: Data is retrieved from the tail pointer; the pointer then advances. If the pipe is empty, the reading process sleeps and wakes up writing processes.
    • Write Operation: Data is placed starting at the head pointer; the pointer then advances. If the pipe is full, the writing process sleeps and wakes up reading processes.
    • Memory Space: Pipe memory resides in kernel space, requiring data to be copied between kernel and user space during read/write operations.
  8. Overview of java.util.NavigableMap

    The NavigableMap<K,V> interface extends SortedMap<K,V> to provide navigation methods that return the closest matches for given search targets. It allows the map to be accessed and traversed in either ascending or descending key order. Submaps created from a NavigableMap must also implement the NavigableMap interface. Note that entry-returning methods typically return snapshots of mappings and generally do not support Entry.setValue.
    public interface NavigableMap<K,V> extends SortedMap<K,V> {
        // Navigation and boundary methods
    }
  9. Overview of μC/OS-II Memory Management

    μC/OS-II uses a memory partitioning scheme instead of standard ANSI C malloc() and free() to prevent memory fragmentation and ensure deterministic execution time, which is critical for real-time operating systems.

    In this system, a large contiguous block of memory (provided by the user as a static array or dynamically allocated memory) is divided into multiple partitions. Each partition consists of a fixed number of equal-sized memory blocks organized as a linked list. Multiple partitions with different block sizes can be created to meet various allocation needs.

  10. Overview of pg_mooncake extension

    pg_mooncake is a PostgreSQL extension implemented primarily in Rust. It allows PostgreSQL to create Iceberg-format columnar replicas of row-based Heap tables. It uses PostgreSQL's logical replication to automatically synchronize data between the row-store and column-store. Users can choose between the row-store or column-store based on the query type; columnar queries are executed via pg_duckdb to leverage vectorized processing.
  11. Overview of java.util.TreeSet

    TreeSet is a NavigableSet implementation based on a TreeMap. Elements are ordered using their natural ordering (Comparable) or by a provided Comparator. It provides guaranteed log(n) time cost for basic operations: add, remove, and contains.

    Key characteristics:

    • Ordering: Must be consistent with equals if it is to correctly implement the Set interface.
    • Thread Safety: Not synchronized. For concurrent access, it must be synchronized externally or wrapped using Collections.synchronizedSortedSet.
    • Iterators: Fail-fast; they throw ConcurrentModificationException if the set is modified after the iterator is created (except through the iterator's own remove method).
    SortedSet s = Collections.synchronizedSortedSet(new TreeSet(...));
  12. Overview of duckdb-paimon extension

    duckdb-paimon is a DuckDB extension that enables lightweight, embedded analysis of Apache Paimon tables stored on local disks or object storage (OSS). It eliminates the need for heavy JVM-based engines like Flink or Spark for ad-hoc queries, reducing startup time to under one second and memory usage to hundreds of megabytes. The extension bridges DuckDB's SQL engine with the paimon-cpp library, which provides pure C++ read/write capabilities for Paimon tables (including Snapshots, Manifests, and Parquet/ORC data files).