# Control number of threads

**URL:** https://discourse.julialang.org/t/control-number-of-threads/62887
**Category:** New to Julia
**Tags:** question, parallel
**Created:** [June 14, 2021, 12:36pm UTC](https://discourse.julialang.org/t/control-number-of-threads/62887 "2021-06-14T12:36:54Z")
**Posts on this page:** 1
**Showing post:** 6

<div class="post-metadata">

### Author: ![tkf](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tkf/32/17635_2.png) [@tkf](https://discourse.julialang.org/u/tkf)
#### Post date: [August 2, 2021, 2:38pm UTC](https://discourse.julialang.org/t/control-number-of-threads/62887/6 "2021-08-02T14:38:37Z")

</div>

These “already parallelized basic functions” are just normal Julia functions. So, you can do the same for your hand-rolled function. For example, if you can rephrase your program as a [Divide-and-conquer algorithm](https://en.wikipedia.org/wiki/Divide-and-conquer_algorithm), it’s often straightforward to use this strategy. Even if this does not work, as I said in [Async limit - #3 by tkf](https://discourse.julialang.org/t/async-limit/62732/3), I’d recommend using the “worker pool” pattern rather than semaphore. For more specific comments, I think it’d be helpful if you can provide an MWE.

---

_[View the full topic](https://discourse.julialang.org/t/control-number-of-threads/62887)._
