Skip operation

Gregg Wonderly gregg at wonderly.org
Tue Sep 18 10:24:59 PDT 2012


On Sep 18, 2012, at 11:21 AM, Henry Jen <henry.jen at oracle.com> wrote:

> 
> On Sep 18, 2012, at 3:01 AM, Paul Sandoz <paul.sandoz at oracle.com> wrote:
> 
>> Hi Henry,
>> 
>> On Sep 17, 2012, at 5:31 PM, Henry Jen <henry.jen at oracle.com> wrote:
>> 
>>> The patch looks good.
>>> 
>>> At beginning I thought it to be a 'step' operation, then realize it's a one-time skip operation. 
>>> 
>>> Does it make sense to have a step operation as well?
>> 
>> Can you give an example?
>> 
> 
> countTo(10).step(1).sum() would be a sum of odd numbers.
> 
> Useful when doing sampling.
> 
>> 
>>> Both skip and serial probably be serial only.
>>> 
>> 
>> It might be possible to implement limit/skip in parallel, although i admit to not currently knowing how :-)n , need to experiment. probably requires some way to cancel the creation of new F/J tasks and ones that are running.
> 
> Agree. Without a predictable split, it would be challenging to step in parallel. :)

Phasers might provide some controls, but ordering and parallelization are, to some degree, disparate things;  i.e. when (delivery of results into the output stream) vs where (core/processor).

We do have view of some parallels to this problem in the TCP reassembly mechanisms, where multiple IP datagrams come into the network stack, potentially out of order, but even if frames arrive in the order 12 9 10 13 11, the application won't see them out of order in the stream of data which is read.  So, it could be that a similar "windowing" mechanism could be developed to allow the stream to slide along as work is done, but always waiting to preserve ordering.

Gregg Wonderly


More information about the lambda-dev mailing list