Windows CE Overview 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 Introduced in Nov/1996 Version Latest stable version releaed in May/2005 Version 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 CreateMutex Wait functions - Waiting to own mutex WaitForSingleObject WaitForMultipleObjects MsgWaitForMultipleObjects ReleaseMutex – Release the mutex ReleaseMutex
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 CreateEvent PulseEvent - Signals and reset the event SetEvent - Signals the event ResetEvent - Resets the event ResetEvent
Synchronization – Semaphores Semaphore - Interprocess synchronization object that limits the number of threads using a resource. CreateSemaphore - Creates a semaphore CreateSemaphore Wait functions to request for a semaphore ReleaseSemaphore - Releases a semaphore ReleaseSemaphore
Synchronization – Interlock Functions Synchronize access to a variable that is shared by multiple threads. ToCall Increment a shared variable and check the resulting value InterlockedIncrement Decrement a shared variable and check the resulting value InterlockedDecrement Exchange the values of specified variablesInterlockedExchange Exchange the values of specified variables if one variable is equal to a specified value InterlockedTestExchange Compare the values of specified values and exchange the values based on the outcome InterlockedCompareExchange Perform an atomic addition of an increment value to an addend value InterlockedExchangeAdd Perform an atomic comparison of specified values and exchange the values based on the outcome of the comparison InterlockedCompareExchangePointer Atomically exchange a pair of valuesInterlockedExchangePointer
Synchronization – Message Queue The only support Windows CE provided as far as message queue is the point-to-point message queue. FunctionDescription CreateMsgQueue Creates or opens a user-defined message queue. OpenMsgQueue Opens a handle to an existing message queue. CloseMsgQueue Closes an open message queue. ReadMsgQueue Reads a single message from a message queue. WriteMsgQueue Writes a single message to a message queue. GetMsgQueueInfo Returns information about a message queue.
References Microsoft Website - =/library/en- us/wcemain4/html/cmconScheduling.asp =/library/en- us/wcemain4/html/cmconScheduling.asp Wikipedia HPC factor -