Skip to content

Channels v2 #265

Open
Open
@ryanolson

Description

  • BufferedChannel
    • Writes will yield if the channel is at capacity
    • Reads will yield if the channel is empty
    • Writes will preferentially resume awaiting readers
    • In the case a reader is resumed from a writer’s execution context, the writers will be rescheduled on scheduler of the caller’s coroutine or the default scheduler
    • Back pressure is managed by transfer the execution context downstream; upstream is only rescheduled for execution when space exists in the buffer.
    • Enabled pipeline concurrency proprotional allowing upstream and downstream to be co-scheduled
  • ImmediateChannel
    • Writes will suspend if there are no awaiting Readers
    • Reads will suspend if there are no awaiting Writers
    • Awaiting writers holding data are always processed first
    • Suspended writers are put in a FIFO resume linked-list after their data has been consumed
    • If no incoming (writer) data is available, writers are resumed in FIFO ordering from the resume queue
    • Back pressure is managed by transferring the execution context downstream, pausing upstream progress
    • Does not enable pipeline concurrency as the execution context is transferred.
  • RecentChannel
    • Writes will never yield
    • Writes will preferentially resume awaiting readers
    • If the Channel is at capacity, the oldest data at the front of the queue is popped and the newest data is pushed to the back of the queue.
    • Back pressure is managed by dropping oldest data then transferring the execution context downstream with the upstream getting rescheduled
  • NullChannel
    • Writes never yield, immediate drops the data sent to it
    • Read never yield, always returns a channel closed

#262 adds mrc::core::concepts::not_void - all channels should use not_void at minimum

#264 adds the first concrete v2 channel based on coroutines

  • note: type-erasing concrete implementations of channels requires wrapping them in a generic task which has a generic return type

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

  • Status

    Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions