This comprehensive guide presents 65 common embedded‑system interview questions covering topics such as memory layout, stack vs. heap, static and volatile keywords, pointers and references, malloc usage, C vs. C++ differences, compilation stages, process and thread concepts, IPC mechanisms, and networking fundamentals, providing concise explanations and code examples for each.
This article introduces SmallChat, an ultra‑minimal open‑source chat server created by the Redis founder, highlighting its 200‑line C implementation, design philosophy, future roadmap, and where to find the source code.
This article explains the difference between unsigned and signed integer overflow in C, shows how overflow can lead to buffer overflows and security breaches, illustrates common pitfalls with code examples, discusses compiler optimizations that remove overflow checks, and provides reliable techniques for detecting and preventing integer overflow.
This article compares motor‑control engineering and Linux driver development, outlining the core tasks, required knowledge, and typical technologies for each field, and helps readers decide which specialization aligns better with their skills and interests.
This article explains the five memory partitions in C, the storage regions created during compilation and linking, the different program segments (code, RO data, RW data, BSS, heap, stack), the proper use of const and pointers, 8051-specific memory qualifiers, and a detailed comparison of stack and heap allocation, including practical code examples.
This article provides a comprehensive guide to C memory organization, covering the five primary memory regions, the layout of compiled C programs, detailed segment types such as code, read‑only, read‑write, BSS, heap and stack, as well as const usage, pointer rules, and embedded‑system storage qualifiers.
This article explains the limitations of the traditional Unix fork model, introduces POSIX threads as lightweight processes, details their data structures, core functions, creation, termination, synchronization primitives, attributes, and provides extensive C code examples for practical multithreaded programming on Linux.
This comprehensive guide explains Linux memory management concepts, covering physical and virtual memory, allocation and release methods, related kernel functions, process switching interactions, performance tuning, leak detection, fragmentation mitigation, and real‑world application examples with practical C code snippets.
This comprehensive guide explains Linux memory management, covering physical and virtual memory concepts, allocation and release methods, related kernel functions, process switching interactions, performance tuning, leak detection, fragmentation handling, and real‑world application scenarios for servers, embedded systems, and driver development.
This article guides readers through the complete GCC toolchain workflow—preprocessing, compilation, assembly, linking—and explains how to analyze the resulting ELF binary, covering essential commands, Binutils utilities, and runtime library details for C/C++ programs on Linux.
This article explains the complete transformation of C/C++ source code into processor‑executable binary files using the GCC toolchain, covering preprocessing, compilation, assembly, linking, ELF structure, and practical command‑line examples on a Linux system.
In bare‑metal embedded systems without an RTOS, the fate of a program after the C main() function returns varies by compiler, and understanding the startup code and post‑main behavior explains why LEDs may flicker or why an infinite loop is often required.
This article explains the concepts of user threads, the pthread library implementation, thread creation and termination functions, synchronization mechanisms like mutexes and condition variables, and demonstrates how to design and use a lightweight C thread‑pool with practical code examples.
This guide explains Linux process priority concepts, how to view and modify priorities with ps, top, renice and nice commands, and details environment variables, their common commands, and C APIs such as getenv, main arguments and environ, complete with practical code snippets and screenshots.
This comprehensive guide walks through Linux process creation with fork, explains its return values and copy‑on‑write behavior, covers normal and abnormal termination using return, exit and _exit, details waiting with wait/waitpid, and demonstrates program replacement via exec functions and a simple custom shell.
This article explains the design and C implementation of a five‑level hierarchical timing wheel, covering its data structures, pointer handling with bitwise operations, timer insertion, modification, deletion, cascade processing, and a demo program that highlights blocking behavior of long‑running timer callbacks.
This article walks through essential C concepts for embedded development, including macro definitions for constants and MIN, the use of #error, infinite loops, variable declaration patterns, the roles of static, const, and volatile, bit‑mask operations, absolute address access, ISR constraints, unsigned‑int quirks, safe typedef usage, and tricky expressions like a+++b.
The article explains how requesting memory larger than physical RAM interacts with virtual memory, page faults, swap mechanisms, and OOM handling on 32‑bit and 64‑bit operating systems, illustrated with C code experiments and Linux/macOS observations.
This article walks through the complete GCC toolchain workflow—preprocessing, compilation, assembly, and linking—using a simple C "Hello World" program, explains the roles of GCC, Binutils and the C runtime, and shows how to inspect the resulting ELF binary with common Linux utilities.
This article explains the epoll interface, its underlying data structures, the three-step usage pattern, the differences between level‑triggered and edge‑triggered modes, the reactor model, and provides a complete C demo, helping developers efficiently handle millions of concurrent TCP connections on Linux.
This article explains how epoll solves the inefficiencies of select/poll by using a kernel‑side red‑black tree and ready‑list, details its API, internal structures, trigger modes, reactor model, and provides a complete C demo for building a scalable TCP server.
This article provides a comprehensive source-level analysis of Redis 6.0 and later multi-threaded architecture, detailing how the main event loop coordinates with dedicated I/O threads to efficiently distribute, parse, and process concurrent read and write requests while maintaining high throughput and low latency.
This article introduces the five common linked‑list variations, explains head pointers and head nodes, compares singly and doubly linked lists, and provides a complete C implementation of a doubly circular linked list with functions for creation, traversal, insertion, and deletion.
This article provides a step-by-step guide for Java programmers on using gcc, covering the preprocessing, compilation, assembly, and linking stages, and demonstrates how to create and use static and dynamic libraries in C with practical code examples.
This tutorial walks through Linux file programming fundamentals, covering how to open, create, read, write, and manipulate file descriptors and cursor positions with system calls like open, creat, read, write, lseek, and close, and demonstrates practical examples such as implementing a cp command, editing configuration files, and using both low‑level and standard C library I/O functions.
This article explains how function calls are implemented using a stack‑based memory model, describing stack frames, the role of base and stack pointer registers, and the assembly instructions that create and dismantle these frames during program execution.
In a live‑stream chat, a middle‑schooler asks whether to start with C or Python, prompting the host to explain why adults should begin with C for deep fundamentals while children benefit more from Python’s simplicity and rapid feedback.
An investigation reveals that the classic Hello World program, often considered bug‑free, actually contains hidden I/O handling bugs in seven of sixteen tested languages, illustrating how even simple code can silently fail and highlighting the importance of proper error detection in software development.
Carnegie Mellon researchers introduced PolyCoder, a 27‑billion‑parameter open‑source code generation model built on GPT‑2, trained on 249 GB of multi‑language code and achieving superior performance to Codex in C while remaining competitive across eleven other programming languages.
This article explains how Redis uses the simple text‑based RESP protocol for client‑server communication, details each reply type, shows how to capture traffic with tcpdump, and dives into the internal C structures and error codes that power Redis commands.
This tutorial walks you through creating a small LC‑3 virtual machine in C, covering the underlying architecture, memory and register modeling, instruction decoding, implementation of key opcodes such as ADD and LDI, trap routines, program loading, and platform‑specific details, all with full source code examples.
As mobile CPUs plateau, developers increasingly use OpenCL to harness Android GPUs like Qualcomm Adreno and Huawei Mali for heterogeneous computing, leveraging its platform, execution, and memory models to write portable kernels—illustrated by a simple array‑addition example that demonstrates device initialization, kernel creation, buffer management, and parallel execution.
This article explains the syntax, execution flow, and practical differences between the C constructs while(1) and for(;;), demonstrating through compiled assembly that both produce identical code for an empty infinite loop under typical compiler settings.
This article explains the merge sort algorithm in detail, covering its divide‑and‑conquer principle, step‑by‑step process with illustrative examples, a complete C implementation, and an analysis of its time and space complexities and suitable use cases.
Algorithm AnalysisDivide and ConquerSorting Algorithm
This tutorial explains why kernel modules are needed, walks through preparing a Linux environment, installing required headers, creating and compiling a simple "Hello, World" module, extending it to a character device driver, and shows how to load, test, and unload the module safely.
This article outlines five typical C programming mistakes—uninitialized variables, array out‑of‑bounds access, string overflow, double free, and invalid file pointers—explaining why they occur, showing concrete code examples with varied outputs, and offering practical safeguards to prevent them.
This article highlights five typical C programming mistakes—uninitialized variables, array out‑of‑bounds access, string overflows, double freeing memory, and invalid file pointers—explains why they occur, shows sample code and outputs, and offers practical tips to prevent each bug.
This article lists five common C programming mistakes—uninitialized variables, array out‑of‑bounds access, string overflow, double free, and invalid file pointers—explains why they occur, shows concrete code examples with typical output, and offers practical ways to prevent each bug.
This guide walks you through the fundamentals of fuzz testing, demonstrating how to install, configure, and use popular tools like AFL and Honggfuzz on Ubuntu to detect buffer overflows, illegal memory accesses, and other security vulnerabilities in C programs, complete with code examples and result analysis.
This article uses truck and train analogies, visual diagrams, and C code examples to explain how linked lists differ from arrays, how they are represented in memory, and how to implement a basic linked list node structure.
Discover how althttpd, the minimalist C‑based web server created by SQLite’s author Richard Hipp, powers the high‑traffic SQLite.org site with minimal resources, its simple design philosophy, low‑cost hardware usage, and why it makes an excellent learning project for developers.
This article explains the various timer implementations—sorted linked list, min‑heap, balanced binary tree, and especially the hierarchical timing wheel used in the Linux kernel—detailing their time complexities, data structures, and the core C code that inserts and executes timers efficiently.
This article walks through a step‑by‑step refactoring of a small C program that reads employee data, adjusts salaries, and writes results, illustrating how to identify repeated code, extract reusable abstractions, apply object‑oriented and functional techniques, and even explore dynamic scope and data‑structure replacement for cleaner, more maintainable software.
This article explains CPU time‑slice scheduling, defines CPU utilization as T2/T1, and demonstrates through C programs how different loops affect measured CPU usage, showing why multi‑core systems can report over‑100% utilization while single‑core systems cannot.
This article recounts how celebrated Chinese writer Wang Xiaobo, also an early programmer, created his own Chinese input method and statistical software in the late 1980s and early 1990s, detailing his self‑taught mastery of FORTRAN, assembly, C, and the challenges of building software in a nascent Chinese computing environment.
This article explains how Nginx runs as a daemon with a master process and multiple worker processes, details its asynchronous non‑blocking I/O model, connection and request handling, keep‑alive and pipeline mechanisms, and describes the key internal data structures such as connections, requests, arrays, queues, lists, strings, memory pools, hash tables, and red‑black trees.
Redis sorted sets (zsets) combine a hash table with a skiplist that provides O(log N) search, insertion, and deletion, using forward, backward, and span pointers to maintain element order and rank, enabling fast score‑based queries, leaderboards, and range operations via commands such as ZADD, ZRANK, and ZRANGE.
This guide walks through the complete GCC compilation pipeline—preprocessing, compilation, assembly, and linking—using a simple C "Hello World" program, detailing each step, relevant commands, and how to inspect the resulting ELF binary.
This article explains how to treat a polynomial addition and multiplication program as a black box, outlines its input/output format, describes a linked‑list implementation with key functions, and presents critical, equivalence‑class, and loop‑related test cases along with practical debugging tips.
This article explains the fundamentals of Linux pipes and named pipes (FIFOs), their kernel implementation, read/write APIs with code examples, and an overview of signal mechanisms, types, and handling in the context of inter‑process communication.
This article explains why and how to apply object‑oriented programming concepts such as encapsulation, inheritance, and polymorphism using plain C, provides the necessary prerequisites, and walks through complete code examples—including virtual tables—to demonstrate OOP techniques without relying on C++.
This article explains the fundamentals of Linux pipes and file redirection, covering their definitions, how they work as inter‑process communication mechanisms, how to create and use them in C with pipe(), dup2() and fork(), and how to redirect standard streams using freopen(), all illustrated with clear code snippets and diagrams.
This article explains the concepts of reentrant and thread‑safe functions, their differences, how signals affect them, examples of non‑reentrant scenarios, and practical guidelines for writing safe code in C on Unix-like systems.
This tutorial explains how GCC version 10.2 compiles C and C++ programs, clarifies the differences between the gcc and g++ commands, shows how file extensions and the -x option affect language selection, and provides concrete command examples for successful compilation and linking.
This article explains why C heap memory leaks cause board resets after months of operation, describes heap allocation methods, the three key leak elements, common release misconceptions, and provides practical code‑review techniques to detect and eliminate leaks.
This article introduces the importance of the C language, outlines its key features and design history, walks through a simple "Hello, World" program with detailed line‑by‑line explanations, and demystifies the compilation and execution process including preprocessing, assembly, linking, and hardware interactions such as caching.
This guide shows how a file can appear deleted on Linux yet still occupy disk space, explains the inode reference‑count mechanism, demonstrates how to reproduce the issue with dd and a C program, and provides commands like lsof and /proc inspection to locate and release such hidden usage.
This article compiles a wide range of typical binary tree interview problems—including judgment, construction, storage, search, distance, and mixed challenges—provides detailed explanations, multiple solution approaches, and complete C code implementations for each, serving as a thorough study guide for interview preparation.
This article explains the step‑by‑step process Redis follows to launch, from executing the redis‑server binary, initializing the server struct, loading configuration files, setting up data structures, restoring persistence, to entering the event loop.
This article explains how to determine whether a binary tree contains a root‑to‑leaf path whose node values sum to a given target, outlines the recursive subtraction method, and provides a complete C implementation of the algorithm.
This article presents an interview case about finding the minimum enclosing circle of a planar point set, explains the geometric concepts, outlines a randomized incremental algorithm with correctness proof and complexity analysis, and provides a complete C implementation.
Linus Torvalds shares his dual impact on technology through Linux and Git, explains his pragmatic engineering mindset, the philosophy of open source collaboration, and demonstrates the difference between messy and elegant C code using real‑world examples.
This article examines the WABT project's wasm2c memory bug caused by improper use of realloc, explains two classic realloc pitfalls—failure detection and zero‑size allocation—provides safe coding patterns, and describes the submitted fix that has been merged into the main branch.
This article explains the principles of Linux shared memory interprocess communication, details the relevant data structures and system limits, walks through the essential API calls for creating, controlling, attaching, and detaching shared memory, and provides a full C program demonstrating parent‑child communication.
This article shares practical experiences from unit testing a 6000‑line C module, detailing static code review and dynamic gtest testing, uncovering common defects such as memory leaks, and presenting two memory‑leak case studies with root‑cause analysis and cleanup recommendations.
The article reviews three common boundary‑value bugs encountered during software testing, explains why they occur, shows the original C code that triggers each issue, and provides concise corrections to prevent off‑by‑one errors and buffer overflows.
This article provides a comprehensive overview of Redis, covering its core concepts, common use cases, and detailed explanations of internal objects such as redisObject, dictEntry, SDS, and the underlying data structures for String, List, Hash, Set, and ZSet, including code snippets and performance characteristics.
This article explains the classic Linux kernel list linked‑list data structure, covering its definition, file locations, core operations such as initialization, insertion, deletion, replacement, moving, splitting and merging, the list_entry macro, usage examples, and important multithreading considerations.
This tutorial guides you through building a classic Snake game in C using a top‑down design that includes a refresh loop, keyboard or AI‑generated commands, structures for snake, food, and map, queue‑based body handling, random food placement, hard‑coded maps, collision detection, and heuristic AI to steer the snake toward food while avoiding self‑collision and obstacles.
This article explains Linux shared memory IPC, covering its data structures, system limits, essential API calls for creating, controlling, attaching, and detaching memory segments, conventions between parent and child processes, and provides a complete C example demonstrating interprocess communication.
This article reviews three typical boundary‑value bugs encountered during software testing—incorrect memory size checks, off‑by‑one retry counters, and misplaced increment operations—explaining their causes, showing original C code, and providing concise corrective solutions.
This step‑by‑step tutorial shows how to write a Makefile for a tiny C program, then progressively improves it with separate object files, variables, pattern rules, and built‑in functions like wildcard and patsubst, while explaining each concept and its benefits.
This guide explains what a Makefile is, its advantages, naming conventions, basic syntax, workflow, common commands, special symbols, variable types, pattern rules, and built‑in functions, providing clear code examples to help developers automate compilation in Linux projects.
This comprehensive guide explains C language operators—including arithmetic, relational, logical, assignment, comma, and sizeof—detailing their types, precedence, associativity, and usage with clear examples and code snippets to help you write correct and efficient expressions.
This article describes the motivation, layered architecture, protocol implementation details, and a plug‑in refactoring approach for a cross‑platform long‑connection component that unifies iOS, Android, and WebSocket communication using libuv, mbedTLS, and C interfaces.
This article explains C/C++ constants—including integer, floating‑point, character, string, and symbolic forms—their syntax, examples, and common errors, and then covers variables, their definition, assignment, initialization, and related best‑practice notes.
Explore the essential C programming concepts—from basic data types, constants, and variables to complex structures, unions, enums, and pointers—through clear explanations, practical examples, and code snippets, helping beginners understand memory allocation, type definitions, and safe coding practices.
This comprehensive guide explains linear search, binary search, bubble sort, insertion sort, selection sort, quicksort, and merge sort, detailing their concepts, step‑by‑step procedures, and providing complete, ready‑to‑run C code examples for each algorithm.
This article explains how to model a comment system as a tree structure, defines node attributes and enums in C, and discusses handling deletions, replies, and conversation lists while keeping the data model extensible for future features.
This article shares practical experiences from unit testing a critical C module, describing common memory‑leak scenarios, their root causes, and concrete solutions while also offering a checklist of typical leak‑prone patterns for developers.
This article explores x86 performance optimization by comparing a simple sum‑of‑array loop with and without a pre‑sort step, demonstrating how branch prediction and cache behavior can make seemingly redundant code run up to three times faster, and outlines practical benchmarking principles and common pitfalls.
The article recounts Xu Haiyang’s hands‑on experience designing Baidu’s early Spider system, describing its pure C procedural architecture, bug‑fixing journey, PageRank processing, team‑management analogies, and his later moves into AI and education entrepreneurship.
This guide explains Linux library types, naming conventions, and step‑by‑step commands for creating static (.a) and shared (.so) libraries, managing symbolic links, checking dependencies, runtime search paths, dynamic loading, and using GNU Libtool.
This article explains the mathematical construction of the Koch curve and snowflake, demonstrates how to render them using only four ASCII characters, and provides a complete C program that recursively draws these fractals on a character buffer.
This guide walks C programmers through transitioning to Java, covering why Java is approachable, essential tools, coding standards, exception handling, core SDK libraries, object‑oriented fundamentals, and advanced topics like Effective Java, SOLID principles, design patterns, and functional programming with Java 8.
This article explains the fundamentals of character encoding, covering the evolution from the 7‑bit ASCII standard to Chinese GB2312, the development of Unicode and UTF‑8, and provides practical guidance for handling these encodings in Windows and Linux C programs, including a sample UTF‑8 detection function.
A seemingly safe configuration swap using barriers caused a crash because a shallow copy duplicated resource pointers, leading to premature freeing of the active configuration; the article explains the bug, shows the faulty code, and presents a corrected approach.
The article explores the historical and practical reasons for mastering C, compares it with Lisp, C++, Java, Perl, Ruby, and Python, and reflects on how language choices shape software development, performance, and developer culture within large engineering teams.
This article introduces developers to the fundamentals of locating, navigating, and understanding PHP 5.4's C source code, covering the repository, directory structure, essential C concepts, and the role of the Zend engine and extensions.
This article presents a collection of fifteen C programming quiz questions, each accompanied by the original code, multiple‑choice options, the correct answer, and in‑depth explanations covering topics such as setjmp/longjmp, pointer casting, recursion, sizeof, function pointers, variadic functions, and static variables.
The article outlines the architecture, design principles, challenges, and performance optimizations of a large‑scale server monitoring system built for handling hundreds of gigabytes of data per day with high availability, low latency alerts, and multi‑platform support.
This article explains why Chinese characters often appear as mojibake on Windows and Linux, introduces the history and technical details of ASCII, GB2312, GBK, GB18030 and Unicode, and provides concrete examples and command‑line tools for inspecting and converting file encodings.