pra123
09-14-2009, 02:25 AM
Hi All,
How to implement timeslicing or thread scheduling in vb dotnet.
I have created two threads. But one thread is taking too much time because it is executing a lenghty stored procedure.
I read in a website about time slicing but could not find how to implement it.
http://www.diranieh.com/NETThreading/MultithreadingBasics.htm
"The Windows OS supports a concept called timeslicing that enables threads of equal priority to share a CPU. Without timeslicing, each thread in a set of equal-priority threads will run to completion before any of the other threads get a chance to execute (unless the running threads enters a Suspended, Stopped, or WaitJoinSleep state). But with timeslicing, each thread receives a brief burst of processor time called a quantum, during which the thread can execute. At the completion of the quantum, the processor time is taken away from the thread (even if it has not finished executing) and given to another thread of equal priority, if one is available. Thread schedueling is therefore preemptive - meaning that the OS will pre-empt (i.e.,. stop) any thread to allow other threads to run."
How to implement timeslicing or thread scheduling in vb dotnet.
I have created two threads. But one thread is taking too much time because it is executing a lenghty stored procedure.
I read in a website about time slicing but could not find how to implement it.
http://www.diranieh.com/NETThreading/MultithreadingBasics.htm
"The Windows OS supports a concept called timeslicing that enables threads of equal priority to share a CPU. Without timeslicing, each thread in a set of equal-priority threads will run to completion before any of the other threads get a chance to execute (unless the running threads enters a Suspended, Stopped, or WaitJoinSleep state). But with timeslicing, each thread receives a brief burst of processor time called a quantum, during which the thread can execute. At the completion of the quantum, the processor time is taken away from the thread (even if it has not finished executing) and given to another thread of equal priority, if one is available. Thread schedueling is therefore preemptive - meaning that the OS will pre-empt (i.e.,. stop) any thread to allow other threads to run."