Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

You might find my epollserver interesting.

It multiplexes multiple clients (sockets) over a thread, so you can write an event loop in each thread and serve far more requests per thread than you could if it was one thread per client or one process per client. (epollserver_threaded.c)

It uses a thread safe multiconsumer multiproducer ringbuffer to communicate between threads.

https://github.com/samsquire/epoll-server

I use Alexander Krizhanovsky's of Tempesta technologies Lock-Free Multi-Producer Multi-Consumer Queue on Ring Buffer

https://www.linuxjournal.com/content/lock-free-multi-produce...



This sounds really interesting. Thanks for the share.


Thanks for your kind thanks.

I'm currently working on a generalised approach to structuring multiple multithreaded components that run kernel threads and lightweight threads similar to golang.

My 1:M:N userspace scheduler multiplexes N lightweight threads onto M kernel threads but it's a different repository. It has one kernel thread and preempts loops by setting them to their limit.

Ideally they should be merged into one codebase.

https://GitHub.com/samsquire/preemptible-thread




Consider applying for YC's Winter 2027 batch! Applications are open till November 2.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: