V
vooose
Consider a Server that spawns child threads to handle requests,
something of the form:
ThreadPool.QueueUserWorkItem(new WaitCallback(MyClass.HandleRequest));
and HandleRequest would look something like
public void HandleRequest(Object stateInfo)
{
//first section (lots of code)
//critical section
//end method
}
Suppose two threads are in operation, T1 and T2, where T1 was created
FIRST. Is there any way to guarantee that T1 enteres the critical
section before T2?
Suppose T1 was in the 'first section' and then T2 got control and
somehow scheduling allowed it to 'get in' to the critical section before
T1.
I guess it matters not how long the first section of code is, because at
any instance T2 could enter the Run state and beat T1 to the CS.
something of the form:
ThreadPool.QueueUserWorkItem(new WaitCallback(MyClass.HandleRequest));
and HandleRequest would look something like
public void HandleRequest(Object stateInfo)
{
//first section (lots of code)
//critical section
//end method
}
Suppose two threads are in operation, T1 and T2, where T1 was created
FIRST. Is there any way to guarantee that T1 enteres the critical
section before T2?
Suppose T1 was in the 'first section' and then T2 got control and
somehow scheduling allowed it to 'get in' to the critical section before
T1.
I guess it matters not how long the first section of code is, because at
any instance T2 could enter the Run state and beat T1 to the CS.