Symbian3/SDK/Source/GUID-7287F1D4-023E-5C90-91E1-6D8DF78D8241.dita
changeset 7 51a74ef9ed63
child 8 ae94777fff8f
equal deleted inserted replaced
6:43e37759235e 7:51a74ef9ed63
       
     1 <?xml version="1.0" encoding="utf-8"?>
       
     2 <!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
       
     3 <!-- This component and the accompanying materials are made available under the terms of the License 
       
     4 "Eclipse Public License v1.0" which accompanies this distribution, 
       
     5 and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
       
     6 <!-- Initial Contributors:
       
     7     Nokia Corporation - initial contribution.
       
     8 Contributors: 
       
     9 -->
       
    10 <!DOCTYPE concept
       
    11   PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
       
    12 <concept id="GUID-7287F1D4-023E-5C90-91E1-6D8DF78D8241" xml:lang="en"><title>Virtual
       
    13 machine model</title><shortdesc>The Kernel provides a 'virtual machine' environment to user processes
       
    14 where each process accesses its data in the same virtual address range.</shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody>
       
    15 <p>The Kernel provides a 'virtual machine' environment to user processes.
       
    16 Each process accesses its data in the same virtual address range, called the
       
    17 data section, which ranges from:</p>
       
    18 <codeblock id="GUID-1FE73FDC-5058-5500-BD9D-C41C41DF2481" xml:space="preserve">0x00400000 to 0x3FFFFFFF</codeblock>
       
    19 <p>but note that the static data always appears at:</p>
       
    20 <codeblock id="GUID-10A112F3-28EF-589F-BE5C-0B53ED736596" xml:space="preserve">0x00400000</codeblock>
       
    21 <p>The code chunk for RAM loaded processes always appears at:</p>
       
    22 <codeblock id="GUID-18064043-B6FA-5791-81BC-A8D7859540E3" xml:space="preserve">0x20000000</codeblock>
       
    23 <p>This allows multiple processes to run, each executing the same code (from
       
    24 the same code chunk) for each of the processes. For example, multiple word
       
    25 documents open at the same time, each in a separate instance of the word application.
       
    26 This reduces RAM usage.</p>
       
    27 <p>In effect, each user process has the same kind of view. Code instructions
       
    28 address data using the virtual address; the Memory Management Unit (MMU) is
       
    29 responsible for the translation of the virtual address to the physical RAM
       
    30 address.</p>
       
    31 <p>Only one chunk can occupy a given virtual address range at a time, so a
       
    32 context switch between different processes involves re-mapping the chunks.
       
    33 The process chunks of the old process are re-mapped to their home addresses.
       
    34 These are in the home section, which is the virtual address range from:</p>
       
    35 <codeblock id="GUID-27EFC279-550A-5970-98F5-959647314B44" xml:space="preserve">0x80000000 to 0xFFFFFFFF</codeblock>
       
    36 <p>ROM code is normally mapped into the address range:</p>
       
    37 <codeblock id="GUID-D75CC9C3-2AD3-5BA0-A8B6-F486CF1D0232" xml:space="preserve">0x50000000 to 0x5FFFFFFF</codeblock>
       
    38 <p>The process chunks of the new process are mapped from their home addresses
       
    39 back to the data section. Chunks which are not accessible by the current user
       
    40 process reside in the home section, and they have supervisor-mode-only access
       
    41 permissions, so that only the kernel can access them.</p>
       
    42 <p>The Kernel's data and stack/heap chunks also reside in the home section.
       
    43 These are never visible to user processes. Code chunks for RAM-loaded libraries
       
    44 reside at the top end of the home section and have user read-only access,
       
    45 so that all user processes can execute code from a loaded library.</p>
       
    46 <p>A context switch between processes therefore involves:</p>
       
    47 <ul>
       
    48 <li id="GUID-F83EAD6D-626D-53B2-9DEB-310617FC03EE"><p>moving the old process
       
    49 chunks to the home section, and changing their access permissions to supervisor-only</p> </li>
       
    50 <li id="GUID-7BEBDFDE-DFFB-50F9-A136-5C0018CBD78F"><p>moving the new process
       
    51 chunks to the data section and changing their access permissions back to user-accessible.</p> </li>
       
    52 </ul>
       
    53 <p>This is best seen graphically. In the first diagram shown below, user-process
       
    54 1 is running and can 'see' all chunks in the clear boxes. Those boxes with
       
    55 dark background represent chunks which are not visible to user-process 1.</p>
       
    56 <p>When user-process 2 is running, the context switch re-maps the user-process
       
    57 2 data to the data section and user process 1 data is re-mapped to the home
       
    58 section as the second diagram shows.</p>
       
    59 <fig id="GUID-A8C12C7E-7779-5D66-908B-51A1C36E1B63">
       
    60 <title>User process 1's view.</title>
       
    61 <image href="GUID-09044578-9ADB-540F-A854-A818EA3970B7_d0e244111_href.png" placement="inline"/>
       
    62 </fig>
       
    63 <fig id="GUID-5F15432A-0CCD-5195-921F-506679F023CC">
       
    64 <title>User process 2's view.</title>
       
    65 <image href="GUID-1A7183EC-B55E-5B61-8965-89C939ECB395_d0e244119_href.png" placement="inline"/>
       
    66 </fig>
       
    67 </conbody></concept>