Re: Thread scheduling vs Process scheduling

On 3/5/2010 1:10 PM, Dilip wrote:

In WinCE, the scheduler does a thread scheduling instead of process
scheduling? What is the difference between the thread scheduling and the
process scheduling and what are the advantages of the thread scheduling over
process scheduling ?

In windows CE the threads are scheduled based on their priority. There is no concept of "process priority" and the scheduler is quite simple. Round robin between all the highest priority threads and a single level of priority inversion. No dynamic priority changes controlled by the scheduler (to rise the priority of a thread that hasn't been running for a long time, for example), but dynamic priority management allowed with specific APIs.
The process is an address space where one or more threads can run.
When the scheduler activate a thread it checks if it should remap the MMU to active the process address space where that thread is supposed to run.
Working with threads instead of processes where an execution flow and an address space are coupled will allow you to have multiple flows of execution (thread) sharing the same data and resources (inside the process address space), without requiring any marshaling of those resources (no copies, no remaps).
On the other side all the resources shared by multiple threads may need to be syncronized and this makes development more complex.
When you design a system based on Windows CE you should carefully choose what to implement as a thread inside a shared process and what to implement as a distinct process. Using too many processes may involve some overhead to share information, using only threads may lead to a less reliable system because a failure in a single thread may impact all the thread sharing the same process space.

Valter Minute (eMVP)
Training, support and development for Windows CE:
My embedded programming and cooking blog:
Windows Embedded support forums in Italian:
(the reply address of this message is invalid)