# How to use Preemptive threads for all cores?

**URL:** <https://forum.xojo.com/t/how-to-use-preemptive-threads-for-all-cores/83307>\
**Category:** Windows\
**Created:** [November 22, 2024, 8:40pm UTC](https://forum.xojo.com/t/how-to-use-preemptive-threads-for-all-cores/83307 "2024-11-22T20:40:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![MarkusR](https://forum.xojo.com/user_avatar/forum.xojo.com/markusr/32/685_2.png) [@MarkusR](https://forum.xojo.com/u/MarkusR)\
**Post date:** [November 22, 2024, 8:40pm UTC](https://forum.xojo.com/t/how-to-use-preemptive-threads-for-all-cores/83307/1 "2024-11-22T20:40:54Z")

</div>

hello,  
how can i use the Preemptive threads to maximal use of all cores or limit to 99% CPU?  
i will use a single xojo app for calculations instead of extern running multiple workers.

---

<div class="post-metadata">

**Author:** ![Kem\_Tekinay](https://forum.xojo.com/user_avatar/forum.xojo.com/kem_tekinay/32/154_2.png) [@Kem\_Tekinay](https://forum.xojo.com/u/Kem_Tekinay)\
**Post date:** [November 22, 2024, 9:21pm UTC](https://forum.xojo.com/t/how-to-use-preemptive-threads-for-all-cores/83307/2 "2024-11-22T21:21:18Z")

</div>

Take a look at ThreadPool, available through the examples. You can specify the number of cores to use and it defaults to the number of cores on the system minus 1. (That info is now available through the System module.)

---

<div class="post-metadata">

**Author:** ![MarkusR](https://forum.xojo.com/user_avatar/forum.xojo.com/markusr/32/685_2.png) [@MarkusR](https://forum.xojo.com/u/MarkusR)\
**Post date:** [November 22, 2024, 9:51pm UTC](https://forum.xojo.com/t/how-to-use-preemptive-threads-for-all-cores/83307/3 "2024-11-22T21:51:12Z")

</div>

info about cpu core count

`System.DebugLog System.CoreCount.ToString`
