.net - How are applications run on multi-core machines? -



.net - How are applications run on multi-core machines? -

i'm trying gain improve understanding of how multi-core processors work , how programmer can take advantage of them.

let's have standard .net console app. doesn't multithreading. run on 1 of cores? if core run on , same 1 everytime?

now let's have console app spins bunch of threads internally. threads divided amongst available cores or all run on same core the initial thread on , have special utilize other available ones?

the relationship between cores, threads, processes, , classes can complicated one. more when start considering how code may not have written (e.g. .net framework itself) scheduled run.

the simplistic reply unless specifically write console application utilize multiple threads, run on single core.

now, there .net framework classes behind scenes may utilize multiple threads, in case process may utilize more 1 core then. much of bcl doesn't utilize threads, frameworks wcf , wf may internally utilize threading.

furthermore, runtime environment may uses multiple threads (in instances) things garbage collection. beyond that, runtime environment may move code core core. occurs because os uses pre-emptive multitasking schedule threads - , single thread isn't guaranteed have affinity particular core.

for sec part of question, if process spawn threads explicitly, (but not always), end on separate cores. of time, these threads scheduled run on whichever core has capacity - , threads (as mentioned earlier) may move core core. should not have special (usually) multiple cores run code.

it's inverse harder achieve: ensuring particular thread runs on single core. referred affinity. in cases desirable affinitize thread particular core improve locality of reference , minimize potential cache misses. of time, however, don't need worry this.

if you're interested in learning more concurrent programming on windows (and in .net) suggest pick re-create of joe duffy's concurrent programming on windows.

.net multithreading multicore

Comments

Popular posts from this blog

java - How to set log4j.defaultInitOverride property to false in jboss server 6 -

c - GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable -

Using ajax with sonata admin list view pagination -