I 'm somewhat confused about when @async tasks switch.
My understanding was tasks would yield on a blocking operation such as IO.

On 0.4.1, I started multiple workers on remote hosts asynchronously, and 
these started as I expected.
Presumably the tasks launching the workers yielded when the command to 
start the worker was issued:
     io, pobj = open(detach(cmd), "r")

On 0.4.5, workers are started one host at a time (all workers on a host are 
started before moving on to the next host), suggesting the launching tasks 
are not yielding.
Is this a reasonable assumption?

At this stage, I assumed something changed between 0.4.1 and 0.4.5 which 
affected task yielding/switching.

I was further confused when I tried setting up a minimal example using 
println(), which I thought would yield:

function Test()
    @sync begin
        for task = 1:5
            @async begin
                for job = 1:5
                    println("task.job = $(task).$(job)")
                    #sleep(5)
                    #yield()
                end
            end
        end
    end
end


On both 0.4.1 and 0.4.5 Test() produces output in task order, suggesting no 
yielding.
Explicit call to sleep or yield works as expected, producing output in job 
order.

In any case, it seems something has changed between 0.4.1 and 0.4.5 wrt 
yielding when issuing commands?
Should detach(cmd), where cmd starts a worker on remote host, yield?


Reply via email to