C# multiprocess-multithread service and windows scheduler -


i have developed windows service that, shortly, manages thousand of remote devices. consists of 2 precesses, each hundreds of threads (we can discuss of opportunity reduce number of threads, not point), , works quite fine. trying join threads in single process semplify data exchange between threads, happens threads runs slower (it seems in conditions threads run less frequently). question is: expected windows scheduler works in different way on single-process/multi-thread application compared multi-process/multi-thread application?

little simple example: - single core cpu - 2 threads (a , b) - thread doing long task, while thread b sleeping - time wake thread b, thread still running

my conjecture: - on single-process/multi-thread, scheduler force thread b sleep , delay wake - on multi-process/multi-thread, if belongs process 1 , b belongs process 2, scheduler wake thread b when expected

could be? suggestion join threads in single process without throubles?

sorry poor english.

edit following advice of luaan profiling application check gc behavior. see on 45 seconds time slot: enter image description here questions: - why 13.000.000ms here? - why reference sleep here?

edit 2 solved performance issue: said using hundreds of threads in service. have rewritten parts of code in order group old threads in few main threads , using 8 main worker thread of job (around 50 threads total including secondary threads)... , magically service runs using half of cpu. maybe issue related gc activity also, think of issues due overhead of context switch threads.

edit 3 little performance issues continues checked gc load performancecounter object , right: threads hangs when gc use 99% of cpu time. how can solve? trying set gc in server mode.

firstly, cpu cores , threading unrelated. kernel decides how thread divided amongst logical cpus. lower logical cpus more context switching has occur, slowing process down overall, it's still multi-threaded.

if want talk other threads normal procedure events subscribed main application thread. can decide information.

you shouldn't concerned how kernel divides threads on logical cpus automatically unless using processor affinity mask.


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -