# Strange behavior parallel for

**URL:** <https://discourse.julialang.org/t/strange-behavior-parallel-for/824>\
**Category:** General Usage\
**Created:** [December 9, 2016, 12:31pm UTC](https://discourse.julialang.org/t/strange-behavior-parallel-for/824 "2016-12-09T12:31:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Thuener](https://avatars.discourse-cdn.com/v4/letter/t/7ba0ec/32.png) [@Thuener](https://discourse.julialang.org/u/Thuener)\
**Post date:** [December 9, 2016, 12:31pm UTC](https://discourse.julialang.org/t/strange-behavior-parallel-for/824/1 "2016-12-09T12:31:30Z")

</div>

I’m having a strange behavior when using @parallel for inside other for.

```julia
 c = collect(0:0.1:0.2)
 λ = [0.0 0.0]
 for λ[1] in c
   @parallel for λ[2] in c
     println("λ $(λ)")
   end
 end

```

Running this code with one thread prints this strange result:

```julia
λ [0.2 0.0]
λ [0.2 0.1]
λ [0.2 0.2]
λ [0.2 0.0]
λ [0.2 0.1]
λ [0.2 0.2]

```

But running the same code with two threads(julia -p 2) I get the correct behavior:

```julia
From worker 3: λ [0.0 0.2]
From worker 2: λ [0.0 0.0]
From worker 2: λ [0.0 0.1]
From worker 2: λ [0.1 0.0]
From worker 3: λ [0.1 0.2]
From worker 3: λ [0.2 0.2]
From worker 2: λ [0.1 0.1]
From worker 2: λ [0.2 0.0]
From worker 2: λ [0.2 0.1]

```

I’m not sure if this is an issue.

---

<div class="post-metadata">

**Author:** ![yuyichao](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yuyichao/32/20_2.png) [@yuyichao](https://discourse.julialang.org/u/yuyichao)\
**Post date:** [December 9, 2016, 1:06pm UTC](https://discourse.julialang.org/t/strange-behavior-parallel-for/824/2 "2016-12-09T13:06:13Z")

</div>

Mutation of normal array won’t be visible on a different worker.
