r/C_Programming • u/ConsistentContest256 • Oct 24 '26
I built a zero-dependency concurrent search engine daemon in C11 from scratch (Custom Arena Allocator, SSO, and pthreads).
Hi everyone!
Over the past few weeks, I’ve been working on a lightweight, concurrent text search engine and TCP server built entirely from scratch in pure C11, without any external dependencies.
My main goals were to practice low-level memory management, lock-based concurrency, and custom data structures without relying on heavy frameworks. Here is a quick breakdown of how it's structured:
- Memory Management: Implemented a custom Arena Allocator to avoid heap fragmentation and handle batch cleanups efficiently.
- Small String Optimization (SSO): A custom string implementation that stores short strings directly on the stack/struct to minimize heap allocations.
- Concurrency: Uses POSIX threads (
pthread) with read-write locks (pthread_rwlock_t) to allow multiple concurrent readers while safely serializing writes. - Persistence: Added a custom zero-overhead binary serialization module (
engine_save/engine_load) for instant state restoration from disk.
The project includes a full modular structure (includes/, src/, tests/) and is protected under a source-available license for personal evaluation.
You can check out the source code and architecture details here: 👉 https://github.com/joseramoncabrera/fast-c-search-engine.git
I would love to hear feedback from more experienced C developers here. Specifically:
- How do you usually handle edge cases with read-write locks in high-contention search scenarios?
- Any architectural improvements you’d suggest for the arena allocator?
Thanks for taking a look!
View all comments
•
u/AutoModerator Oct 24 '26
Hi /u/ConsistentContest256,
Your submission in r/C_Programming was filtered because it links to a git project.
You must edit the submission or respond to this comment with an explanation about how AI was involved in the creation of your project.
While AI-generated code is not disallowed, low-effort "slop" projects may be removed and it's likely that other users push back strongly on substantially AI-generated projects.
You can read more at https://www.reddit.com/r/C_Programming/wiki/index/posting-projects
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.