[ 
https://issues.apache.org/jira/browse/ARROW-500?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17059512#comment-17059512
 ] 

Wes McKinney commented on ARROW-500:
------------------------------------

That partly addresses the issue. It seems like it might be better to turn this 
issue more generally into building some asynchronous work queue concepts. 

Consider the following pseudocode:

{code}
for $arg in $collection {
  $result1 = f($arg)
  g($result1)
}
{code}

Now:

* Suppose that "f" and "g" do not compete for the same resources. 
* The next invocation of "f" can occur while the prior invocation of "g" is 
still running
* We are OK with some fixed number of results of "f" accumulating while 
invocations of "g" are being carried out

So if we defined an asynchronous "work queue" for "g" function calls then the 
code looks something like:

{code}
g_queue->SetMaxDepth($queue_depth)
g_queue->Start();
for $arg in $collection {
  $result1 = f($arg)
  g_queue->Push($result1)
}
g_queue->WaitForCompletion();
{code}

Some of the machinery for this is available in the {{ReadaheadQueue}} used for 
CSV/JSON IO readahead but it could be made more general perhaps. 

> [C++] Implement concurrent IO read queue for file-like sources
> --------------------------------------------------------------
>
>                 Key: ARROW-500
>                 URL: https://issues.apache.org/jira/browse/ARROW-500
>             Project: Apache Arrow
>          Issue Type: New Feature
>          Components: C++
>            Reporter: Wes McKinney
>            Priority: Major
>              Labels: filesystem
>
> In a multithreaded setting, we may spawn many threads which will have access 
> to a shared IO resources. It may be useful to create a thread-safe IO queue 
> implementing the {{arrow::io::ReadableFileInterface}}, limiting the number of 
> concurrent requests to the desired number (which may be 1, for services not 
> permitting concurrent access).



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to