# Another julia riddle - parallel processes

**URL:** https://discourse.julialang.org/t/another-julia-riddle-parallel-processes/2900
**Category:** General Usage
**Tags:** question
**Created:** [March 27, 2017, 12:24pm UTC](https://discourse.julialang.org/t/another-julia-riddle-parallel-processes/2900 "2017-03-27T12:24:22Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![TsurHerman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tsurherman/32/1234_2.png) [@TsurHerman](https://discourse.julialang.org/u/TsurHerman)
#### Post date: [March 27, 2017, 12:24pm UTC](https://discourse.julialang.org/t/another-julia-riddle-parallel-processes/2900/1 "2017-03-27T12:24:22Z")

</div>

I have a module which starts a long running cycle of computation.

How do I send it to another process , if I don’t want to define the process beforehand.  
I am looking for a way to dynamically add processes.

something along the lines of:

```julia
module temp

function f(t,par = false)
    if par
        new_proc = addprocs(1)[1]
        remotecall_fetch(f,new_proc,t,false)
        rmprocs(new_proc)
    else
        print("hello process $(myid())")
        sleep(t)
    end
end

end

```

of course this doesn’t work , what is the right way to do it?

---

<div class="post-metadata">

### Author: ![TsurHerman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tsurherman/32/1234_2.png) [@TsurHerman](https://discourse.julialang.org/u/TsurHerman)
#### Post date: [March 27, 2017, 7:22pm UTC](https://discourse.julialang.org/t/another-julia-riddle-parallel-processes/2900/2 "2017-03-27T19:22:17Z")

</div>

found a somewhat hairy solution:

```julia
module temp

function f(t,par = false)
    if par
        new_proc = addprocs(1)[1]
        eval(Main,quote
             remotecall_fetch(x->Base.require(x),$new_proc,:temp) 
        end)
        remotecall_fetch(f,new_proc,t,false)
        rmprocs(new_proc)
    else
        print("hello process $(myid())")
        sleep(t)
    end
end

end

```
