# How to use channel to communicate with a process

**URL:** <https://discourse.julialang.org/t/how-to-use-channel-to-communicate-with-a-process/17074>\
**Category:** Julia at Scale\
**Created:** [November 1, 2018, 9:35pm UTC](https://discourse.julialang.org/t/how-to-use-channel-to-communicate-with-a-process/17074 "2018-11-01T21:35:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alexander-Barth](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/alexander-barth/32/3692_2.png) [@Alexander-Barth](https://discourse.julialang.org/u/Alexander-Barth)\
**Post date:** [November 1, 2018, 9:35pm UTC](https://discourse.julialang.org/t/how-to-use-channel-to-communicate-with-a-process/17074/1 "2018-11-01T21:35:50Z")

</div>

I try to run a function with `@span` and get some status back on the computation using e.g. a Channel before I get the end-result. The following code already works, but I am new to channels and I am wondering if there is a better way to do this.

```julia
@everywhere function myfun(chan)
  put!(chan,"starting")
  sleep(3)
  put!(chan,"still computing")
  sleep(3)
  put!(chan,"almost done")
  return 42;
end

c = Channel{String}(100)

ff = @spawn myfun(c);

status = @fetchfrom ff.where take!(c) # returns "starting"
status = @fetchfrom ff.where take!(c) # returns "still computing"
status = @fetchfrom ff.where take!(c) # returns "almost done"
result = fetch(ff) # returns 42

```

Ideally I would like to let Julia choose a “free” process for computing the tasks (as opposed to make this choise myself with `@spawnat`).
