Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
<!-- This component and the accompanying materials are made available under the terms of the License
"Eclipse Public License v1.0" which accompanies this distribution,
and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
<!-- Initial Contributors:
Nokia Corporation - initial contribution.
Contributors:
-->
<!DOCTYPE concept
PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
<concept id="GUID-7287F1D4-023E-5C90-91E1-6D8DF78D8241" xml:lang="en"><title>Virtual
machine model</title><shortdesc>The Kernel provides a 'virtual machine' environment to user processes
where each process accesses its data in the same virtual address range.</shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody>
<p>The Kernel provides a 'virtual machine' environment to user processes.
Each process accesses its data in the same virtual address range, called the
data section, which ranges from:</p>
<codeblock id="GUID-1FE73FDC-5058-5500-BD9D-C41C41DF2481" xml:space="preserve">0x00400000 to 0x3FFFFFFF</codeblock>
<p>but note that the static data always appears at:</p>
<codeblock id="GUID-10A112F3-28EF-589F-BE5C-0B53ED736596" xml:space="preserve">0x00400000</codeblock>
<p>The code chunk for RAM loaded processes always appears at:</p>
<codeblock id="GUID-18064043-B6FA-5791-81BC-A8D7859540E3" xml:space="preserve">0x20000000</codeblock>
<p>This allows multiple processes to run, each executing the same code (from
the same code chunk) for each of the processes. For example, multiple word
documents open at the same time, each in a separate instance of the word application.
This reduces RAM usage.</p>
<p>In effect, each user process has the same kind of view. Code instructions
address data using the virtual address; the Memory Management Unit (MMU) is
responsible for the translation of the virtual address to the physical RAM
address.</p>
<p>Only one chunk can occupy a given virtual address range at a time, so a
context switch between different processes involves re-mapping the chunks.
The process chunks of the old process are re-mapped to their home addresses.
These are in the home section, which is the virtual address range from:</p>
<codeblock id="GUID-27EFC279-550A-5970-98F5-959647314B44" xml:space="preserve">0x80000000 to 0xFFFFFFFF</codeblock>
<p>ROM code is normally mapped into the address range:</p>
<codeblock id="GUID-D75CC9C3-2AD3-5BA0-A8B6-F486CF1D0232" xml:space="preserve">0x50000000 to 0x5FFFFFFF</codeblock>
<p>The process chunks of the new process are mapped from their home addresses
back to the data section. Chunks which are not accessible by the current user
process reside in the home section, and they have supervisor-mode-only access
permissions, so that only the kernel can access them.</p>
<p>The Kernel's data and stack/heap chunks also reside in the home section.
These are never visible to user processes. Code chunks for RAM-loaded libraries
reside at the top end of the home section and have user read-only access,
so that all user processes can execute code from a loaded library.</p>
<p>A context switch between processes therefore involves:</p>
<ul>
<li id="GUID-F83EAD6D-626D-53B2-9DEB-310617FC03EE"><p>moving the old process
chunks to the home section, and changing their access permissions to supervisor-only</p> </li>
<li id="GUID-7BEBDFDE-DFFB-50F9-A136-5C0018CBD78F"><p>moving the new process
chunks to the data section and changing their access permissions back to user-accessible.</p> </li>
</ul>
<p>This is best seen graphically. In the first diagram shown below, user-process
1 is running and can 'see' all chunks in the clear boxes. Those boxes with
dark background represent chunks which are not visible to user-process 1.</p>
<p>When user-process 2 is running, the context switch re-maps the user-process
2 data to the data section and user process 1 data is re-mapped to the home
section as the second diagram shows.</p>
<fig id="GUID-A8C12C7E-7779-5D66-908B-51A1C36E1B63">
<title>User process 1's view.</title>
<image href="GUID-09044578-9ADB-540F-A854-A818EA3970B7_d0e215495_href.png" placement="inline"/>
</fig>
<fig id="GUID-5F15432A-0CCD-5195-921F-506679F023CC">
<title>User process 2's view.</title>
<image href="GUID-1A7183EC-B55E-5B61-8965-89C939ECB395_d0e215503_href.png" placement="inline"/>
</fig>
</conbody></concept>