A News Story Categorization System Written By Philip J. Hayes

Download Report

Transcript A News Story Categorization System Written By Philip J. Hayes

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 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



Process



1 process
1 or more threads
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 timeslice 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



Thread priorities are typically fixed and do
not change


Default is 100ms but OEM’s can specify a
different value
Per quantum a thread is suspended and
another thread is scheduled to run
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.
To
Call
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 variables
InterlockedExchange
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 values
InterlockedExchangePointer
Synchronization – Message Queue

The only support Windows CE provided as far as message
queue is the point-to-point message queue.
Function
Description
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 http://msdn.microsoft.com/library/default.asp?url
=/library/enus/wcemain4/html/cmconScheduling.asp
Wikipedia http://en.wikipedia.org/wiki/Windows_CE
HPC factor http://www.hpcfactor.com/support/windowsce/