x86-64 Machine-Level Program Representation: Registers, Instructions, and Control Flow
x86-64 Register Set and Usage
The x86-64 architecture includes 16 general-purpose registers that store 64-bit values. While these register are general-purpose, they follow conventional usage patterns. The registers r8 through r15 were added in the 80386 architecture extension.
%rax: Return value register
%rbx: Callee-saved register
%rcx: 4th f ...
Posted on Sun, 24 May 2026 18:01:07 +0000 by Bilbozilla
Linux File I/O Fundamentals: System Calls, Descriptors, and Access Control
I/O Buffering Layers and Architecture
Standard C I/O streams utilize user-space buffers (typically 8192 bytes) to batch read/write operations. POSIX functions like write() operate at a lower level, bypassing application buffers but still interacting with the kernel's page cache. Consequently, data sent via write() might temporarily reside in me ...
Posted on Sat, 16 May 2026 11:33:41 +0000 by dbrown
Linux File Operations: Buffered and Unbuffered I/O
Linux provides two distinct approaches for file I/O operations: library functions (buffered/standard I/O) and system calls (unbuffered I/O). Understanding the differences between these approaches is essential for writing efficeint file handling code.
Buffered I/O (Standard Library Functions)
Buffered I/O functions are part of the C standard lib ...
Posted on Sat, 09 May 2026 19:38:16 +0000 by mogen
Implementation and Usage Guide for Memory Mapped File I/O in C
Core Advantages of Memory Mapped I/O
Higher performance than standard read/write operations by reducing redundant data copies between kernel space and user space
Intuitive file access via regular memory pointer operations, eliminating the need for custom buffer management logic
Native support for inter-process data sharing when multiple proces ...
Posted on Sat, 09 May 2026 02:08:11 +0000 by jwmessiah
Understanding Memory Alignment and Padding in C Structs
Calculating Member Offsets
To understand how structures are laid out in memory, it is useful to know the concept of an offset. The offset of a member is the distance in bytes from the start of the structure's base address. The first member always has an offset of 0.
You can utilize the standard macro offsetof (defined in stddef.h) to inspect th ...
Posted on Fri, 08 May 2026 22:44:06 +0000 by rathersurf