All Topics
All Topics
Technology
Technology
Design
Design
Programming
Programming
Science
Science
News
News
Gaming
Gaming
Entertainment
Entertainment
Business
Business
Finance
Finance
Sports
Sports
Health
Health
Food
Food
Travel
Travel
Art
Art
Music
Music
Books
Books
Education
Education
Politics
Politics
Personal
Personal
No algorithm. No AI slop. No ads. Just RSS. Pro-human. Indie writers. Real journalism. Open web. Chronological. Hand toasted.

Cimba: High-Performance Discrete Event Simulation Library in C with Multithreading and Coroutines

By

ambonvik

3mo ago· 13 min readenCode

Summary

Cimba is a high-performance discrete event simulation library written in C and assembly that uses POSIX pthreads for parallelized replications and stackful asymmetric coroutines (fibers) for concurrent simulated processes within each thread. The library demonstrates significant performance advantages over Python's SimPy, running 40-50 times faster in multithreaded scenarios and 25% faster on a single core than SimPy using all 64 cores. The implementation focuses on efficient event processing with benchmarks showing 20 million events per second on a single core.

Key quotes

· 4 pulled
Cimba models run 40-50 times faster than SimPy equivalents.
Cimba runs 25% faster (20M events/sec) on a single core than SimPy using all 64 cores (16M events/sec).
A fast discrete event simulation library written in C and assembly with POSIX pthreads.
Simulated processes are implemented as stackful coroutines ('fibers') inside the pthreads.
Snippet from the RSS feed
A multithreaded discrete event simulation library in C, using POSIX pthreads for parallelized replications and stackful asymmetric coroutines for concurrent simulated processes inside each thread -...

You might also wanna read