# lowlet
Low-latency inter-process communication library for Rust.
## Features
- Shared memory regions with automatic cleanup
- Lock-free SPSC queue and MPMC ring buffer
- Inline assembly memory fences and atomics (x86_64)
- TTAS spinlock with pause instruction
- Process synchronization barrier
- Batch send/receive operations
- Timeout-based operations
- Channel statistics and metrics
## New in 0.1.2
- **RwLock**: Multiple readers, single writer lock
- **Semaphore**: Counting semaphore with acquire/release
- **SeqLock**: Optimistic read locking for read-heavy workloads
- **Broadcast Channel**: One-to-many message delivery
- **Priority Queue**: Lock-free min-heap implementation
- **Object Pool**: Pre-allocated slots for reduced allocation overhead
- **Zero-copy API**: `send_in_place()` and `recv_in_place()` methods
- **Latency Histogram**: HDR histogram with p50/p90/p99/p999 percentiles
- **Channel Health**: Real-time utilization and saturation monitoring
- **Graceful Shutdown**: `close()` and `is_closed()` methods
- **Additional Methods**: `is_full()`, `drain()`, `peek()`
## Installation
```toml
[dependencies]
lowlet = "0.1.2"
```
## Quick Start
```rust
use lowlet::channel;
fn main() {
let (tx, rx) = channel::<u64, 1024>();
tx.send(42).unwrap();
let value = rx.recv().unwrap();
assert_eq!(value, 42);
}
```
## Broadcast Example
```rust
use lowlet::broadcast;
fn main() {
let (tx, rx1) = broadcast::<u64, 64>();
let rx2 = tx.subscribe();
tx.send(100).unwrap();
assert_eq!(rx1.recv().unwrap(), 100);
assert_eq!(rx2.recv().unwrap(), 100);
}
```
## Documentation
- [API Reference](docs/api/README.md)
- [Guides](docs/guides/README.md)
- [Examples](docs/examples/)
## Performance
- ~61 cycles per send/recv operation
- ~20ns latency at 3GHz
- Zero-copy message passing
- Lock-free algorithms
## License
MIT OR Apache-2.0