# @threads uses only half the number of nthreads()

**URL:** <https://discourse.julialang.org/t/threads-uses-only-half-the-number-of-nthreads/54058>\
**Category:** General Usage\
**Tags:** question, multithreading, threads\
**Created:** [January 27, 2021, 2:29pm UTC](https://discourse.julialang.org/t/threads-uses-only-half-the-number-of-nthreads/54058 "2021-01-27T14:29:56Z")\
**Posts on this page:** 1\
**Showing post:** 11

<div class="post-metadata">

**Author:** ![Chris\_Green](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chris_green/32/32265_2.png) [@Chris\_Green](https://discourse.julialang.org/u/Chris_Green)\
**Post date:** [October 11, 2021, 9:42pm UTC](https://discourse.julialang.org/t/threads-uses-only-half-the-number-of-nthreads/54058/11 "2021-10-11T21:42:21Z")

</div>

This issue is almost certainly because of windows processor thread groups.

On dual socket systems, or more than 64 threads, by default, threads created in windows by a process will all be placed on the same physical core or subset of the threads.

This problem is easy to work around with a little code in thread creation in c++, and I have writtent his code for my c++ code. If I can figure out how to put it in Julia for windows, I’ll take a stab at it.

I have a 128 core/256 thread AMD system. Julia threads on it will only use 1/4 of the cores :-(.

If anyone could help me with where I could code this, its a simple loop that iterates the thread handles and does a couple windows calls.  
Perhaps it can be done wittout modifying julia or its libraries at all, if I can iterate the windows htread handles and make some calls into the windows dlls.

---

_[View the full topic](https://discourse.julialang.org/t/threads-uses-only-half-the-number-of-nthreads/54058)._
