Skip to content

Commit

Permalink
WIP soundness 2
Browse files Browse the repository at this point in the history
  • Loading branch information
h33p committed Oct 4, 2023
1 parent 07065df commit 5ef77a4
Show file tree
Hide file tree
Showing 6 changed files with 553 additions and 438 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
[codecov]: https://codecov.io/gh/memflow/mfio/branch/main/graph/badge.svg?token=IJ1K4QPAIM
[codecov-link]: https://codecov.io/gh/memflow/mfio

## Async completion I/O with non-sequential results
## Async completion I/O research with non-sequential results

mfio is memflow's async completion based I/O base. It aims to make the following aspects of an
I/O chain as simple as possible:
mfio is memflow's research async completion based I/O base. It aims to make the following aspects
of an I/O chain as simple as possible:

1. Async
2. Automatic batching (vectoring)
Expand Down
28 changes: 21 additions & 7 deletions mfio/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
//! # mfio
//!
//! ## Async completion I/O with non-sequential results
//! ## Research async completion I/O with non-sequential results
//!
//! mfio is memflow's async completion based I/O base. It aims to make the following aspects of an
//! I/O chain as simple as possible:
//! mfio is memflow's research async completion based I/O base. It aims to make the following
//! aspects of an I/O chain as simple as possible:
//!
//! 1. Async
//! 2. Automatic batching (vectoring)
Expand All @@ -23,6 +23,12 @@
//! works really well with sparse files, albeit differs from the typical "stop as soon as an error
//! occurs" model.
//!
//! Lack of color is not true sync/async mix, instead, mfio is designed to expose minimal set of
//! data for invoking a built-in runtime, with handles of daisy chaining mfio on top of another
//! runtime. The end result is that mfio is able to provide sync wrappers that efficiently poll
//! async operations to completion, while staying runtime agnostic. We found that a single (unix)
//! file descriptor or (windows) handle is sufficient to connect multiple async runtimes together.
//!
//! ### Examples
//!
//! Read primitive values:
Expand Down Expand Up @@ -132,8 +138,16 @@
//!
//! ## Safety
//!
//! mfio can invoke UB in safe code if `mem::forget` is run on a packet stream and data sent to the
//! stream gets reused.
//! By default mfio is conservative and does not enable invoking undefined behavior. However, with
//! a custom opt-in config switch, enabled by passing `--cfg mfio_assume_linear_types` to the rust
//! compiler, mfio is able to provide significant performance improvements, at the cost of
//! potential for invoking UB in safe code.
//!
//! With `mfio_assume_linear_types` config enabled, mfio wrappers will prefer storing data on the
//! stack, and if a future waiting for I/O operations to complete is cancelled, a `panic!` may get
//! triggered. Moreover, if a future waiting for I/O operations to complete gets forgotten using
//! `mem::forget`, undefined behavior may be invoked, because use-after-(stack)-free safeguards are
//! discarded.
//!
//! ### Safety examples
//!
Expand Down Expand Up @@ -252,8 +266,8 @@ pub mod heap;
pub(crate) mod multistack;
pub mod packet;
mod poller;
//pub mod stdeq;
//pub mod traits;
pub mod stdeq;
pub mod traits;
pub mod util;

pub use tarc;
Expand Down
Loading

0 comments on commit 5ef77a4

Please sign in to comment.