Fundamentals 18 min read

Master Core Tech: From OS Memory to Redis, MySQL, Docker & More

This article combines a look at Tencent Cloud Zhiy developer salaries and interview insights with in‑depth explanations of OS memory allocation, process vs thread vs coroutine, DNS resolution, MySQL indexing and locking, Redis speed factors, Kafka’s high throughput design, and Docker’s container architecture, plus resource links.

macrozheng
macrozheng
macrozheng
Master Core Tech: From OS Memory to Redis, MySQL, Docker & More

Salary and Interview Insights

Tencent Cloud Zhiy, a subsidiary of Tencent Cloud, has offices in Xi'an, Changsha, and Wuhan. The 2025 developer salary packages range from 14.5k × 16 + 1k × 12 (housing allowance) + 24k signing bonus for a bachelor in Wuhan, to 14k × 16 + 1k × 12 + 24k for a master’s graduate in Xi'an. Overall, ordinary offers total 220k–240k CNY annually, while special offers reach 260k–270k. The interview style mirrors Tencent’s, focusing on computer fundamentals, backend components, and algorithm questions.

Operating System Memory: Heap vs. Stack

Allocation Method : Heap memory is dynamically allocated and manually managed by the programmer; stack memory is statically allocated and automatically managed by the compiler.

Memory Management : Heap requires explicit allocation and deallocation, risking leaks or overflow; stack follows LIFO, with lifetimes tied to scope.

Size and Speed : Heap is larger but slower to allocate; stack is smaller but faster.

Why Temporary Variables Reside on the Stack and Objects on the Heap?

Simpler Lifecycle Management : Stack memory is automatically reclaimed when a scope ends, offering fast access.

Dynamic Size : Objects often have sizes unknown at compile time, requiring heap allocation for flexibility and sharing.

Why Not the Reverse?

Stack Limitations : Limited size can cause overflow for large or dynamic objects.

Complex Lifecycle : Placing objects on the stack would bind their lifetimes to a scope, hindering sharing and persistence.

Performance Issues : Frequent large allocations on the stack can fragment memory and degrade performance.

Process, Thread, and Coroutine Differences

Resource Sharing : Processes have independent memory spaces; threads share a process’s memory; coroutines share heap memory but have separate registers and stacks.

Scheduling and Switching : Process switches involve full context saves (address space, registers); thread switches save only thread‑specific registers and stack pointers; coroutine switches are user‑level, saving minimal context.

Stability and Safety : A crashed process does not affect others, while a faulty thread can bring down the whole process.

Which Switch Is Faster?

Thread switching is faster because it only changes stack and program counter, avoiding the heavy address‑space switch required for processes.

DNS Workflow

The client sends a DNS query to its configured local DNS server.

If the local server lacks a cached record, it queries the root server.

The root server directs the query to the .com TLD server.

The TLD server returns the authoritative server for the domain.

The authoritative server provides the final IP address.

The local server caches the result and returns it to the client.

Protocol Used by DNS

DNS primarily uses UDP for its low‑latency, connectionless communication.

UDP Reliability in DNS

DNS mitigates UDP’s unreliability with timeout retransmissions, retries, and caching.

Why Ping Uses ICMP Instead of UDP

ping

employs ICMP because it is designed for network diagnostics, offering built‑in error reporting (e.g., destination unreachable, timeout) that UDP lacks.

MySQL Indexing and Locking

B+Tree vs. B‑Tree : B+Tree stores data only in leaf nodes, enabling smaller internal nodes and efficient range scans via linked leaves.

B+Tree vs. Binary Tree : With high fan‑out (d > 100), B+Tree height stays low (3–4 levels) even for millions of rows, reducing I/O compared to binary trees.

B+Tree vs. Hash : Hash indexes excel at equality lookups (O(1)) but cannot handle range queries, where B+Tree shines.

MySQL lock types include global locks, table‑level locks (explicit table locks, metadata locks, intention locks), and row‑level locks (record locks, gap locks, next‑key locks) provided by InnoDB.

Why Redis Is Fast

Most operations execute entirely in memory using efficient data structures.

A single‑threaded model avoids context‑switch overhead and lock contention.

I/O multiplexing (select/epoll) handles many client sockets concurrently.

Kafka’s High Throughput Design

Sequential disk writes minimize seek time.

Batch processing reduces network and I/O overhead.

Zero‑copy transfers move data directly from disk to network sockets.

Compression lowers bandwidth usage.

Docker Container Implementation

Namespace isolation provides separate views of processes, network, mounts, and IPC.

cgroups enforce resource limits (CPU, memory, I/O) per container.

distributed systemsbackend developmentOperating Systemsdatabasesnetworking
macrozheng
Written by

macrozheng

Dedicated to Java tech sharing and dissecting top open-source projects. Topics include Spring Boot, Spring Cloud, Docker, Kubernetes and more. Author’s GitHub project “mall” has 50K+ stars.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.