I want to spawn multiple threads using a ThreadPool based on the available system memory, how can I do that using C#? For example: I want to spawn around 200 threads per GB of available system memory.
I have done this exercise on python where I could use the psutil package to fetch the memory.
memory = psutil.virtual_memory()
total_memory = memory.available/1024/1024/1024
available_memory = round(total_memory)
print ('Available memory in GB is %s'%available_memory)
I would like to replicate the same on C#.