Windows CE Overview and Scheduling Presented by Dai
Windows CE Overview and Scheduling Presented by Dai Kawano
Topic p Overview of Windows CE in General n Windows CE Architecture n p Scheduling Processes and Threads n Thread Scheduling n Synchronization n
Overview of Windows CE p p Uses distinctively different kernel from desktop verison of Windows 32 -bit operating system optimized for devices that have minimal storage n n p p industrial controllers, communications hubs cameras, telephones, hand-held computers Supported on Intel x 86 (and compatibles), MIPS, ARM, and Hitachi Super. H microprocessors History n n n 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 p p The kernel maintains a priority list of each thread in the operating system The scheduler n n n 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 p All applications consists of n n p Process n n p 1 process 1 or more threads Single instance of a running application Win CE supports 32 processes running simultaneously Thread n n n 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 p Windows CE uses a priority-based timeslice algorithm to schedule the execution of threads n n n 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) p Threads run for a specific amount of time called a quantum n n p Thread priorities are typically fixed and do not change n p Default is 100 ms but OEM’s can specify a different value Per quantum a thread is suspended another thread is scheduled to run One exception – Priority Inheritance Thread can be suspended anytime
Synchronization p Synchronization Objects n n Critical Section Mutex Event Notification Semaphore Interlocked Functions p Point-to-Point Message Queue p
Synchronization – Critical Sections p Enter critical section n n p Enter. Critical. Section Try. Enter. Critical. Section Leave critical section n Leave. Critical. Section
Synchronization – Mutex p p p Mutex - Synchronization object whose state is set to signaled when it is not owned by a thread and nonsignaled when it is Create. Mutex - Create a mutex Wait functions - Waiting to own mutex n n n p Wait. For. Single. Object Wait. For. Multiple. Objects Msg. Wait. For. Multiple. Objects Release. Mutex – Release the mutex
Synchronization – Event Notifications p Windows CE uses event objects to: n n p p Notify a thread when to perform its task Indicate that an event has occurred Create. Event – Creates an event Pulse. Event - Signals and reset the event Set. Event - Signals the event Reset. Event - Resets the event
Synchronization – Semaphores p p Semaphore - Interprocess synchronization object that limits the number of threads using a resource. Create. Semaphore - Creates a semaphore Wait functions to request for a semaphore Release. Semaphore - Releases a semaphore
Synchronization – Interlock Functions p Synchronize access to a variable that is shared by multiple threads. To Call Increment a shared variable and check the resulting value Interlocked. Increment Decrement a shared variable and check the resulting value Interlocked. Decrement Exchange the values of specified variables Interlocked. Exchange the values of specified variables if one variable is equal to a specified value Interlocked. Test. Exchange Compare the values of specified values and exchange the values based on the outcome Interlocked. Compare. Exchange Perform an atomic addition of an increment value to an addend value Interlocked. Exchange. Add Perform an atomic comparison of specified values and exchange the values based on the outcome of the comparison Interlocked. Compare. Exchange. Pointer Atomically exchange a pair of values Interlocked. Exchange. Pointer
Synchronization – Message Queue p The only support Windows CE provided as far as message queue is the point-to-point message queue. Function Description Create. Msg. Queue Creates or opens a user-defined message queue. Open. Msg. Queue Opens a handle to an existing message queue. Close. Msg. Queue Closes an open message queue. Read. Msg. Queue Reads a single message from a message queue. Write. Msg. Queue Writes a single message to a message queue. Get. Msg. Queue. Info Returns information about a message queue.
References p p p Microsoft Website http: //msdn. microsoft. com/library/default. asp? url =/library/enus/wcemain 4/html/cmcon. Scheduling. asp Wikipedia http: //en. wikipedia. org/wiki/Windows_CE HPC factor http: //www. hpcfactor. com/support/windowsce/
- Slides: 16