Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A type for execute ahead but consume in order #53

Closed
harendra-kumar opened this issue Apr 2, 2018 · 4 comments
Closed

A type for execute ahead but consume in order #53

harendra-kumar opened this issue Apr 2, 2018 · 4 comments
Labels
type:enhancement User visible feature

Comments

@harendra-kumar
Copy link
Member

harendra-kumar commented Apr 2, 2018

We can have a hybrid of SerialT and CoparallelT type called AheadT. The behavior of CoparallelT is to execute a batch of actions at the head of the stream in parallel. The results of these actions may be consumed out of order. The behavior of AheadT would be to execute a batch of actions at the head of the stream in parallel (like CoparallelT) but consume the results in the same order (like SerialT). This means we may execute ahead but maintain the serial order. This is like the concept of readahead or we may call it IOahead. The type combinator for this could be ahead.

@harendra-kumar
Copy link
Member Author

harendra-kumar commented Apr 12, 2018

Thinking about more generalized combinators, we perhaps need a better organization scheme for the combinators used to mix streams together. Currently we have these:

  • serially
  • coserially
  • coparallely
  • parallely

The following independent dimensions are involved when we mix streams:

  1. whether we are going depth first (finish one stream before going to next) or breadth first (yield one element, or some elements, based on numbers or time slice, from one stream and then go to next). For example both serially and interleaving are serial in nature but they differ in DFS or BFS pattern.
  2. whether we are executing serially i.e. producing only one element at a time or parallely i.e. producing more than one. This is how serial (serially, coserially) and parallel (coparallely, parallely) types differ from each other.
  3. When executing parallely, what is the quantum of parallelism i.e. a few of them on-demand (coparallely) or it can range to all of them in parallel (parallely).
  4. When we are executing parallely whether we are yielding elements in the specified order (FIFO) or out of order (FCFS) as they arrive. This is how out-of-order types (coparallely, parallely) and in order types (ahead, coahead) differ.

May be we can design combinators for different dimensions and mix them to create a desired scheme instead of having many canned combinators.

@harendra-kumar
Copy link
Member Author

In fact we need a dual pair of AheadT and CoaheadT. AheadT would execute stream actions in parallel but yield exactly in the same order as SerialT, this is like CoparallelT but yielding in positional order. CoaheadT would execute actions in parallel but yield exactly in the same order as CoserialT, this is like ParallelT but yielding in positional order.

@harendra-kumar harendra-kumar added the type:enhancement User visible feature label Apr 19, 2018
@harendra-kumar
Copy link
Member Author

An Ahead type has been added via 9da3fcc. We also need a corresponding wAhead type for wide (breadth first) traversal with lookahead.

@harendra-kumar
Copy link
Member Author

This is fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:enhancement User visible feature
Projects
None yet
Development

No branches or pull requests

1 participant