# Threads, @spawn on Mac - inconsistent behavior

**URL:** <https://discourse.julialang.org/t/threads-spawn-on-mac-inconsistent-behavior/56376>\
**Category:** Performance\
**Created:** [March 3, 2021, 12:16am UTC](https://discourse.julialang.org/t/threads-spawn-on-mac-inconsistent-behavior/56376 "2021-03-03T00:16:45Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![pbayer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pbayer/32/11675_2.png) [@pbayer](https://discourse.julialang.org/u/pbayer)\
**Post date:** [March 3, 2021, 7:54am UTC](https://discourse.julialang.org/t/threads-spawn-on-mac-inconsistent-behavior/56376/2 "2021-03-03T07:54:17Z")

</div>

Welcome! Your post is difficult to read. I suggest, you edit it following …

> [@Please read: make it easier to help you](https://discourse.julialang.org/t/psa-make-it-easier-to-help-you/14757):
>
> Welcome to the Julia Discourse! We are enthusiastic about helping Julia programmers, both beginner and experienced. This public service announcement (PSA) outlines best practices when asking for help. Following these points makes it easier for us to help you and more likely you’ll get a prompt, useful answer. Keywords are highlighted to make it easier to refer to specific points. Choose a descriptive title that captures the key part of your question, eg “plots with multiple axes” instead of …

> [@marsmen](#):
>
> I’m at a total loss why, no matter what I do, running with or without parallel processes, most things take the same time, but in some cases, running parallel takes longer.

That may be due to **load imbalance**. If you `Threads.@spawn` several tasks doing IO operations, the load can become very imbalanced (as in [that example](https://discourse.julialang.org/t/looking-for-code-to-solve-surely-common-embarrassing-parallelism-multithreading-use-case/53527/10)). This happens because the tasks `yield` immediately after start and the Julia scheduler then starts the next task on the same thread.

Without having investigated further I guess this may be also the case in your problem since your functions/tasks get an `MyRGB[....]` argument.

---

_[View the full topic](https://discourse.julialang.org/t/threads-spawn-on-mac-inconsistent-behavior/56376)._
