How to run two tasks on parallel?

Although, your problem is probably better suited to just spawning threads:

for n in tmin+1:tmax
   Xn = Threads.@spawn D1[n]*D2[n] + Y[n-1];
   Yn = Threads.@spawn D1[n-1]*D2[n-1] + X[n-1];
   X[n] = fetch(Xn)
   Y[n] = fetch(Yn)
end
2 Likes