<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Boling Consulting &#187; Windows Mobile</title>
	<atom:link href="http://bolingconsulting.com/category/windows-mobile/feed/" rel="self" type="application/rss+xml" />
	<link>http://bolingconsulting.com</link>
	<description>Windows CE Training</description>
	<lastBuildDate>Mon, 24 Sep 2018 22:58:02 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.5</generator>
		<item>
		<title>Windows Mobile 6.1 Memory Management Changes</title>
		<link>http://bolingconsulting.com/2008/windows-mobile-6-1-memory-management-changes/</link>
		<comments>http://bolingconsulting.com/2008/windows-mobile-6-1-memory-management-changes/#comments</comments>
		<pubDate>Fri, 06 Jun 2008 18:35:38 +0000</pubDate>
		<dc:creator>Doug</dc:creator>
				<category><![CDATA[Windows Mobile]]></category>

		<guid isPermaLink="false">http://dev.fittingsites.com/bol/?p=1154</guid>
		<description><![CDATA[I just returned from the Microsoft TechEd conference in Orlando.  While there, I gave two talks and presented a Preconference tutorial. During the preconference tutorial, I discussed changes to the Windows Mobile 6.1 memory model.  Here is a short summary &#8230; <a href="http://bolingconsulting.com/2008/windows-mobile-6-1-memory-management-changes/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I just returned from the Microsoft TechEd conference in Orlando.  While  there, I gave two talks and presented a Preconference tutorial. During the  preconference tutorial, I discussed changes to the Windows Mobile 6.1 memory  model.  Here is a short summary of the changes.</p>
<p>Despite the implication of the “6.x” version number, Windows Mobile 6.1, like  Windows Mobile 6 and Windows Mobile 5 are based on a modified Windows CE 5.0  kernel, not the newer Windows Embedded CE 6 kernel.  The “old” kernel uses the  slot based model for memory management shown in the figure below.</p>
<p><a href="http://bolingconsulting.com/?attachment_id=1240"><img class="alignnone size-full wp-image-1240" title="Beforememory" src="http://bolingconsulting.com/wp-content/wp-uploads/Beforememory.jpg" alt="" width="451" height="626" /></a></p>
<p>Processes are assigned a “slot” from 2 to 32 allowing up to 31 processes.  (The kernel is counted as the 32<sup>nd</sup> process.)  The process with the  currently running thread is cloned into slot 0.  This allows each application to  act as if it is running in slot 0 since when a thread in a process is running  that process is in slot 0.  Slot 1 is used to load DLLs that have been bundled  with the system.  Slot 63, at the top of the Large Memory Area, is used to store  resource only DLLs, those DLLs that have no code, only resource data such as  fonts and strings.  More detail on this memory model, and the problems  associated with it can be found in a white paper I wrote a while back titled <a href="http://msdn.microsoft.com/en-us/library/ms836325.aspx">Windows CE Advanced  Memory Management</a>.  (For those interested in Windows Embedded CE 6, I wrote  paper on CE 6 memory management <a href="http://msdn.microsoft.com/en-us/library/bb331824.aspx">here</a>.)</p>
<p>The problem with memory in Windows Mobile has always been the vast number of  DLLs in the system.  DLLs are loaded from the top of slot 1 down.  Since there  are so many DLLs in the system, not only do they fill up slot 1, they encroach  into slot 0.  This leaves only about 18-20 Meg of virtual space for each  application.  This problem is most acute in the Device Manager process space  where dozens of device drivers, each with their own interrupt service thread,  tended to consume most of the virtual space in that process.</p>
<p>This slot arrangement remained pretty constant from Windows Mobile 2003 to  Windows Mobile 6.0.  However, with the release of Windows Mobile 6.1, things  were changed to reduce the DLL pressure and to help out in the Device Manager  process space.</p>
<p>In Windows Mobile 6.1, the stacks for the device manager are no longer  allocated in the processes’ slot.  Instead, the operating system uses slot 59,  at the top of the Large Memory Area, for the device manager thread stacks.</p>
<p>In addition to the stack move, changes were also made in where DLLs are  placed.  While execute-in-place(XIP) DLLs are still loaded from the top of Slot  1, any DLL that is larger than 64 KB and isn’t XIP is loaded in slot 60.  If the  32 MB of slot 60 fills up with DLLs, the OS uses slot 61 for the DLLs.   This  additional 64 MB of DLLs space should go a long way in reducing the problem of  too many DLLs in Windows Mobile systems.  The new memory map now looks like  this:</p>
<p><a href="http://bolingconsulting.com/?attachment_id=1239"><img class="alignnone size-full wp-image-1239" title="Aftermemory" src="http://bolingconsulting.com/wp-content/wp-uploads/Aftermemory.jpg" alt="" width="451" height="626" /></a></p>
<p>The shared heap slot was added in Windows CE/Windows Mobile 5 but its  addition wasn’t an attempt to solve the DLL problems with Windows Mobile. While  in this diagram it looks like the large memory area has been shrunk  significantly, it really hasn’t.  The LMA size, which is close to 1 GB was only  reduced 128 MB.</p>
<p>To take advantage of this change, OEMs who build Windows Mobile systems need  to adjust how they assign DLLs in their .BIB files.  Now, large DLLs should be  moved from the MODULES section of the .BIB to the FILES section.  This change  prevents the tools from converting those DLLs to XIP.  DLLs smaller than 64 KB  should be left in the MODULES section.</p>
<p>Third party application developers really don’t have to do anything to take  advantage of this new arrangement.  It has always been good practice to combine  DLL code into a few, large DLLs.  Now, if that DLL is larger than 64 KB, it’ll  be loaded in one of the upper slots.  This won’t change the way DLLs operate,  its just you may notice some rather unusual base addresses for DLLs when you  start debugging your application on Windows Mobile 6.1.</p>
]]></content:encoded>
			<wfw:commentRss>http://bolingconsulting.com/2008/windows-mobile-6-1-memory-management-changes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
