|This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.|
Windows CE can run up to 32 processes at one time. Each process starts with a single thread — often called the "primary thread" — that provides the resources that are required to run an application. Windows CE creates a primary thread when the loader calls the WinMainfunction. A process also can create additional threads when needed. The number of additional threads a process can create is limited only by the amount of random access memory (RAM) that is available on the device. The kernel itself can address 512 MB of physical memory.
When the Windows CE OS initializes, it creates a single 4-gigabyte (GB) virtual address space. The address space is divided into 33 "slots," and each slot is 32 megabytes (MB). The address space is shared by all of the processes. When a process initializes, Windows CE selects an open slot for the process in the address space of the system. Slot zero is reserved for the currently running process.
In addition to assigning a slot for each process, Windows CE creates a stack for the thread and a heap for the process. Each stack has an initial size of at least 1 or 4 kilobyte (KB), which is committed on demand. The amount of stack space that is reserved by the system, on a per process basis, is specified in the (/STACK) option for the linker. Because the stack size is CPU-dependent, on some devices the system allocates 4 KB for each stack. The maximum number of threads is dependent upon the amount of available memory. You can allocate additional memory, outside of the 32 MB that is assigned to each slot, by using memory-mapped files or by calling the VirtualAllocfunction.
The following illustration shows how memory is allocated in the Windows CE address space.
When a process initializes, the OS stores all the dynamic-link libraries (DLLs), the stack, the heap, and the data section for each process in the slot assigned to the process. DLLs are loaded at the top of the slot, followed by the stack, the heap, and the executable (.exe) file. The bottom 64 KB are always left free. DLLs are controlled by the loader, which loads all of the DLLs at the same address for each process.
Last updated on Tuesday, May 18, 2004