r/C_Programming • • 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:

  1. How do you usually handle edge cases with read-write locks in high-contention search scenarios?
  2. Any architectural improvements you’d suggest for the arena allocator?

Thanks for taking a look!

0 Upvotes

34 comments sorted by

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.

1

u/ConsistentContest256 Oct 24 '26

Hi! To clarify: This project is an authentic, hand-crafted C11 systems programming project built to practice low-level memory management and concurrency.

  • AI Involvement: AI was strictly used as a conversational coding assistant/technical reviewer to refine documentation, structure tests, and discuss design patterns.
  • Core Codebase: All architectural decisions, memory models (custom Arena Allocator), string implementations (SSO), vector logic, thread safety (pthread_rwlock_t), binary persistence, and core C logic were written, debugged, and verified manually by me.

I am sharing this repository to get peer feedback from experienced C programmers on my implementation details and memory architecture, not to post low-effort generated code. Thanks for reviewing!

1

u/mikeblas Oct 25 '26

Thank you for your disclosure. I have approved your post.