Processes and Threads (Windows CE 5.0)
All applications that are based on Windows CE consist of a process and one or more threads:
- A process**is a single instance of a running application.
- Processes enable users to open and work in several applications at the same time. For example, a user can edit a file in a word processing application while another application is recalculating a spreadsheet.
- As a preemptive multitasking operating system, Windows CE supports up to 32 processes running simultaneously within the system.
- A thread is an independent portion of a process and is the basic unit that the OS allocates processor time to.
Threads enable an application to perform more than one task at a time, even though applications cannot execute more than one thread at a time.
A thread can execute any part of the process code, including parts that are being executed by another thread.
Although one thread is designated as the primary thread for the process, a process can also create an unspecified number of additional threads.
Available system resources limit the number of threads.
Windows CE provides 256 priority levels that you can set on a thread. To assign priority levels, Windows CE uses the CeSetThreadPriority and CeGetThreadPriority functions.
CeSetThreadPriority sets the priority for a specified thread.
CeGetThreadPriority returns 0 (zero) as the highest priority and 255 as the lowest priority.
If an OEM enforces a trusted environment, Windows CE can protect the top 248 priority levels from applications.
Because Windows CE supports preemptive multitasking, it creates the effect of a process simultaneously executing multiple threads. When a process has more than one thread running, the OS rapidly switches from one thread to another, so that the threads appear to run simultaneously.
See Also
Scheduling | Processes | Threads | Fibers | Priority Levels | Priority Inversion | Controlling Timing with the Sleep Timer
Send Feedback on this topic to the authors