Sunday, 15 February 2015

multithreading - Understanding basic concept regarding multi-threading -



multithreading - Understanding basic concept regarding multi-threading -

question: advantage and/or possible disadvantages of scheduling threads of process on multiple processors @ time versus scheduling threads (from different processes) 1 @ time individual processors become available?

update note: consider multiprocessor , process 2 threads. suppose 1 thread runs @ time. thread curretly running sends message sec thread , blocks waiting reply (and hence taken off cpu). after time, sec thread gets scheduled, receives message first thread, sends reply , blocks waiting new message first thread. after time, first thread gets scheduled, processes reply, sends new message , gets blocked waiting new reply , on. switching can avoided if both threads running concurrently.

if understand question correctly, scheduling threads processors become available , letting them run completion before scheduling thread on processor more efficient in terms of total throughput because won't have overhead of context switching. however, assumes processes/threads behaving - in contrast, if thread goes infinite loop or becomes deadlocked you've permanently lost access processor. scheduling run @ 1 time introduces context switching overhead, if thread/processor isn't behaved can still rely on operating scheme interrupt , allow thread/process work on processor.

multithreading operating-system

No comments:

Post a Comment