My main thread A is running on logical core #1.
My local machine has 16 logical cores.
I create a process-based Client with 1 process.
By default the client is created with as many threads as the number of logical cores: 16.
from dask.distributed import Client
if __name__ == "__main__":
print("Main thread A")
with Client(processes=True, n_workers=1) as client:
print(f"client spawned as an independent process: {client}")
--------------------
>>> Main thread A
>>> client spawned as an independent process: <Client: 'tcp://127.0.0.1:51522' processes=1 threads=16, memory=31.72 GiB>
- How do I ensure that main thread A on logical core #1 never gets slowed down by the client?
- More generally, how do the main thread and an independent process-based client share logical cores?
There is a partial answer here:
The OS takes care of waking threads and running them in the cores of your CPU
- Would
Client(processes=True, n_workers=1, threads_per_worker=15)
ensure that the Client does not try to use logical core #1?