hk2012 Knowledge Base

website·Indexed 30 days ago

https://hk2012.github.io/

A personal technical blog and knowledge base covering Java development, JVM internals (memory models, bytecode, Class initialization), and concurrency (ThreadLocal, ABA problem, daemon threads). It also includes academic notes on linear algebra, integral calculus, software engineering (OO methodology, UML, RUP), and political theory (Marxism, Chinese Modern History), alongside practical guides for npm, MySQL indexing, and Hexo deployment.

Tokens
65.7K
Snippets
160
Records
410
Agent score
75%

What's inside hk2012

  1. Overview of Object-Oriented (OO) Methodology

    Object-Oriented methodology aims to simulate human thinking patterns to align software development with problem-solving processes. The core formula for OO is: Objects + Classes + Inheritance + Communication with messages.

    Key characteristics include:

    • Advantages: Better software stability, high reusability, suitability for large-scale products, and easier maintenance/testing.
    • Disadvantages: Increased code verbosity compared to procedural programming, higher memory consumption, potential performance overhead due to polymorphism and object instantiation, and challenges in representing overall system dynamic features.
  2. Overview of HotSpot JVM Memory Areas

    The HotSpot JVM divides memory into five primary areas, some of which are thread-private and others shared across all threads:

    1. JVM Stack (Thread-Private): Created with the thread. Stores 'stack frames' containing local variable tables (primitive types and object references), operand stacks, and method exit information. Throws StackOverflowError if depth is exceeded or OutOfMemoryError if dynamic expansion fails.
    2. Native Method Stack (Thread-Private): Also known as the 'C Stack', used for Native methods implemented in C. Similar to the JVM stack, it stores frames for local variables and operand stacks. Throws StackOverflowError and OutOfMemoryError.
    3. PC Register (Thread-Private): Stores the address of the current instruction being executed. It is empty when executing a native method.
    4. Heap (Shared): Created at JVM startup. All objects and arrays are allocated here. It is the primary area for Garbage Collection (GC) and is divided into the Young Generation (Eden, From Survivor, To Survivor) and the Old Generation. Throws OutOfMemoryError when space is exhausted.
    5. Method Area (Shared): A logical part of the heap (often called 'Non-Heap'). Stores class information, constant pools, method data, and method code. In HotSpot, this is implemented as PermGen (JDK 7 and earlier) or Metaspace (JDK 8+).

    Additionally, Direct Memory (Off-Heap) is memory outside the JVM controlled by the OS but usable by Java. It offers better I/O performance than heap memory but has higher allocation overhead and can throw OutOfMemoryError.

  3. Overview of the Old Democratic Revolution Period

    The Old Democratic Revolution period is characterized by the struggle against foreign aggression and the early exploration of national salvation. Key phases include:

    • Foreign Aggression: The decline of feudal society, the Opium War, and the subsequent semi-colonial and semi-feudal nature of modern China, involving military, political, economic, and cultural penetration by Western powers.
    • Early Explorations: Various social forces attempted to find a way forward, including the Taiping Rebellion (peasant war), the Self-Strengthening Movement (Yangwu Movement), and the Hundred Days' Reform (Wuxu Reform).
    • Xinhai Revolution: The overthrow of the Qing Dynasty and the end of imperial autocracy, leading to the establishment of the Republic of China, though it ultimately failed to resolve the crisis due to the rise of Beiyang warlords.
  4. Overview of the New Democratic Revolution Period

    The New Democratic Revolution period marks the rise of the Communist Party of China (CPC) and the shift toward a new revolutionary path. Key developments include:

    • Founding of the CPC: Influenced by the New Culture Movement, the October Revolution, and the May Fourth Movement, Marxism was integrated with the Chinese workers' movement.
    • The New Path: After the failure of the Great Revolution, the CPC explored a new strategy: surrounding the cities from the countryside and seizing power through armed struggle (Land Revolution).
    • Key Turning Points: The Zunyi Conference and the Long March were critical for the party's survival and strategic redirection.
  5. Overview of Common Algorithms

    A summary of widely used algorithmic strategies and specific algorithms for various computational problems:

    General Strategies:

    • Enumeration, Recurrence, Recursion, Backtracking, Greedy, and Dynamic Programming.

    Graph Algorithms:

    • Minimum Spanning Tree (MST): Connects all nodes with minimum total edge weight.
    • Shortest Path: Minimizes total weight between two nodes.
    • Depth-First Search (DFS): Explores as deep as possible along a path before backtracking.
    • Breadth-First Search (BFS): Explores all neighbor nodes at the current depth before moving to the next level.

    Sorting Algorithms:

    • Bubble Sort: Repeatedly swaps adjacent elements to move the largest/smallest to the end.
    • Selection Sort: Repeatedly selects the minimum element from the unsorted part.
    • Insertion Sort: Inserts elements from the unsorted part into their correct position in the sorted part.
    • Quick Sort: Uses a pivot to partition the array into smaller and larger elements recursively.

    Search Algorithms:

    • Linear Search: Checks elements sequentially.
    • Binary Search: Efficiently finds elements in a sorted array by repeatedly halving the search range.

    Dynamic Programming Examples:

    • Fibonacci Sequence: Avoids redundant calculations by storing sub-problem results.
    • Longest Common Subsequence (LCS): Finds the longest non-contiguous common subsequence between two sequences.
  6. Overview of the 'Three Represents' (三个代表) Theory

    The 'Three Represents' is a core theoretical framework of the Theoretical System of Socialism with Chinese Characteristics. It emphasizes that the Party must always represent: 1. The development requirements of China's advanced productive forces; 2. The advanced direction of China's advanced culture; 3. The fundamental interests of the overwhelming majority of the Chinese people.

    Key tenets include:

    • Development is the Party's primary task for governing the country.
    • Establishment of a socialist market economy (including ownership, distribution, and social security systems).
    • Comprehensive construction of a moderately prosperous society (Xiaokang society).
    • Construction of socialist political civilization, including rule of law and the 'Great New Project' of Party building.
  7. Overview of C Language Characteristics

    C is a procedural programming language focused on algorithm and logic implementation, organized primarily through processes and functions. Key characteristics include:

    • Procedural Nature: Programs are decomposed into a series of functions or processes to complete tasks.
    • Efficiency: Designed for simplicity and high execution speed, making it suitable for system programming and low-level development.
    • Memory Access: Provides pointers that allow direct access and manipulation of memory addresses.
    • Low-Level Control: Offers direct control over computer hardware and memory management.
  8. Understand the concept and essence of Sinicization of Marxism

    The 'Sinicization of Marxism' refers to the process of combining the basic principles of Marxism with China's specific actual conditions and excellent traditional culture. This process involves using Marxist perspectives and methods to solve practical problems in China's revolution, construction, and reform, while refining practical experiences into theory to enrich Marxism with new contemporary meanings.
  9. Requirements for Establishing Proletarian Leadership

    To achieve leadership over other classes and groups, the leading party must meet two fundamental conditions:

    1. Lead the allies in a resolute struggle against a common enemy and achieve victory.
    2. Provide material benefits (or at least not harm the interests) of the led, while providing political education.

    Key strategies for maintaining this leadership include:

    • Establishing a broad united front based on the worker-peasant alliance.
    • Maintaining independence in thought, politics, and organization while practicing a policy of both union and struggle.
    • Developing a powerful revolutionary armed force, primarily composed of peasants.
    • Strengthening the construction of the proletarian party.
  10. Understand the HotSpot JVM Memory Model layout

    The HotSpot JVM memory model is divided into five primary components: the Heap, JVM Stack, Native Method Stack, Program Counter Register, and the Runtime Data Areas. A significant change introduced in JDK 1.8 is the replacement of the Permanent Generation (PermGen) with Metaspace, which serves a similar purpose of storing JVM metadata but is managed differently.
  11. Distinguish between New Democratic Revolution and Old Democratic Revolution

    While both are bourgeois democratic revolutions in nature (based on social nature, revolutionary targets, and tasks), the fundamental difference lies in the leadership:

    • Old Democratic Revolution: Led by the bourgeoisie.
    • New Democratic Revolution: Led by the proletariat.
  12. Structure a Software General Design Document (Architectural Design)

    The General Design (or Summary Design) document answers 'How should the system be implemented?' based on the DFDs from the requirement phase. It should contain:

    1. Introduction: Purpose, background, definitions, and references.
    2. Task Overview: Goals, environment, requirement summary, and constraints.
    3. General Design: Processing flow, overall structure/module external design (Structure Charts), and functional allocation.
    4. Interface Design: External and internal interfaces.
    5. Data Structure Design: Logical and physical structures and their relationship to programs.
    6. Operational Design: Module combinations, control flow, and timing.
    7. Error Handling: Output messages and recovery strategies (e.g., backup, performance degradation).
    8. Security and Confidentiality Design.
    9. Maintenance Design: Facilities for maintenance modules.