Programming Isn't Special
Programming is often dismissed as merely functional, but it is fundamentally an art form. Using AI in programming disregards this artistic nature and undermines the creative value involved. (blog.glyph.im)
This text explains how Linux represents and manipulates bit arrays (bitmaps) as a compact, high-performance data structure for tracking many binary states. It argues that bitmaps are pervasive in the kernel because they store presence/availability flags very compactly and exploit machine-word operations for speed. Basic operations - set, clear, test and finding the first set/clear bit - are described, along with their benefits over arrays of booleans or linked lists. Common uses such as interrupt vector allocation and CPU masks illustrate why tight memory usage and bit-level parallelism matter in kernel code.
The implementation details show that a bitmap is simply an array of unsigned long, with DECLARE_BITMAP and BITS_TO_LONGS converting a required bit count into the needed number of words. Examples include a 256-entry interrupt vector bitmap that occupies four machine words and cpumask structures that embed a bitmap. Bit indexing is done by computing the word index and bit offset (using macros like BIT_WORD and BIT_MASK), and single-bit operations call architecture-specific primitives (arch_set_bit) often wrapped with sanitizer instrumentation (e.g., set_bit calls instrument_atomic_write). Whole-bitmap routines scan a word at a time to locate bits efficiently and leverage CPU instructions where available.
Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.
Programming is often dismissed as merely functional, but it is fundamentally an art form. Using AI in programming disregards this artistic nature and undermines the creative value involved. (blog.glyph.im)
Implementing lazy imports in Python can significantly reduce startup time by delaying module loading until necessary. This technique improves performance for large applications and scripts that do not require all modules immediately. (lemire.me)
Efforts to minimize undefined behavior in the C programming language aim to improve program safety and predictability. These include potential language enhancements and best practices for developers. (lwn.net)
Spinal is a predictive surface that provides near-instant insights into any codebase, streaming live changes and understanding code evolution. It offers ultra-low-latency search and anticipates user needs, demonstrated by its performance on the Linux kernel's extensive commit history. (spinal.sh)
The video discusses the current state of the Racket programming language, highlighting its features and community. It emphasizes ongoing development and the language's role in education and research. (youtube.com)
GTKX is a framework that enables developers to build native Linux applications using React, TypeScript, and Adwaita widgets. It aims to simplify creating desktop apps with modern web technologies. (github.com)
Today's best Hacker News stories, summarized and screenshotted, one email a day.