Windows CEOverview and Scheduling Presented by Dai Kawano
Topic • Overview of Windows CE • Windows CE in General • Windows CE Architecture • Scheduling • Processes and Threads • Thread Scheduling • Synchronization
Overview of Windows CE • Uses distinctively different kernel from desktop verison of Windows • 32-bit operating system optimized for devices that have minimal storage • industrial controllers, communications hubs • cameras, telephones, hand-held computers • Supported on Intel x86 (and compatibles), MIPS, ARM, and Hitachi SuperH microprocessors • History • Version 1.0 - Introduced in Nov/1996 • Version 5.0 - Latest stable version releaed in May/2005 • Version 6.0 - Scheduled to be released on Nov/2006
Windows CE Architecture • Kernel • create, terminate, and synchronize processes and threads • schedule, suspend a thread • assign priority to a thread • support interrupt • manage memory
Scheduling • The kernel maintains a priority list of each thread in the operating system • The scheduler • Controls the order in which these threads are sequenced • Allows threads to interact with each other in a predictable fashion • Considers interrupts and reprioritizes the threads accordingly
Processes and Threads • All applications consists of • 1 process • 1 or more threads • Process • Single instance of a running application • Win CE supports 32 processes running simultaneously • Thread • Independent portion of a process and is the basic unit that the operating system allocates processor time to • Execute any part of the process code • 256 priority levels
Thread Scheduling • Windows CE uses a priority-based time-slice algorithm to schedule the execution of threads • Higher priority runs first • Same priority runs in a round-robin fashion • Lower priority run only when all threads with a higher priority are not ready to run
Thread Scheduling (continued) • Threads run for a specific amount of time called a quantum • Default is 100ms but OEM’s can specify a different value • Per quantum a thread is suspended and another thread is scheduled to run • Thread priorities are typically fixed and do not change • One exception – Priority Inheritance • Thread can be suspended anytime
Synchronization • Synchronization Objects • Critical Section • Mutex • Event Notification • Semaphore • Interlocked Functions • Point-to-Point Message Queue
Synchronization – Critical Sections • Enter critical section • EnterCriticalSection • TryEnterCriticalSection • Leave critical section • LeaveCriticalSection
Synchronization – Mutex • Mutex - Synchronization object whose state is set to signaled when it is not owned by a thread and nonsignaled when it is • CreateMutex - Create a mutex • Wait functions - Waiting to own mutex • WaitForSingleObject • WaitForMultipleObjects • MsgWaitForMultipleObjects • ReleaseMutex – Release the mutex
Synchronization – Event Notifications • Windows CE uses event objects to: • Notify a thread when to perform its task • Indicate that an event has occurred • CreateEvent – Creates an event • PulseEvent - Signals and reset the event • SetEvent - Signals the event • ResetEvent - Resets the event
Synchronization – Semaphores • Semaphore - Interprocess synchronization object that limits the number of threads using a resource. • CreateSemaphore - Creates a semaphore • Wait functions to request for a semaphore • ReleaseSemaphore - Releases a semaphore
Synchronization – Interlock Functions • Synchronize access to a variable that is shared by multiple threads.
Synchronization – Message Queue • The only support Windows CE provided as far as message queue is the point-to-point message queue.
References • Microsoft Website - http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wcemain4/html/cmconScheduling.asp • Wikipedia - http://en.wikipedia.org/wiki/Windows_CE • HPC factor - http://www.hpcfactor.com/support/windowsce/