[ prev | next | up ]

Scheduler and stack for Assignment #2

> In the description of the scheduler, it says that ThreadYield should use 
> internal priorities. Does this mean that we can neglect internal priorities 
> in all the other cases. For example, creating a thread with higher external 
> priority automatically forces a switch to that thread without the use of 
> ThreadYield if we do not use the scheduler. Should we modify all of these 
> scheduling mechanism as well so that they use internal instead of external 
> priorities? This could imply more work, depending on our original 
> implementation.
Unless the ThreadsUseScheduler() function has been invoked, only the externally assigned thread priorities are relevant. However, once the scheduler has been activated, all functions that lead to possible context switches should be sensitive to internal priorities.
> The way I see it, the CPU has no way to know how large the stack is in a 
> thread. Are we responsible if the library fails because a thread uses up 
> all of its stack and corrupts the memory?
You are not responsible if the library fails because a thread uses all of its stack.