|
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-3A625B23-354E-5CB4-98CF-FF53AD724FA0" xml:lang="en"><title>Migration |
|
13 Tutorial: Demand Paging</title><shortdesc/><prolog><metadata><keywords/></metadata></prolog><conbody> |
|
14 <p>Demand paging is a change to how the Kernel can use RAM from Symbian platform |
|
15 v9.3. This topic describes the possible results for base port. </p> |
|
16 <p>When demand paging is used, the contents of memory are available to a program |
|
17 when they are required - i.e. 'on demand'. When the contents are no longer |
|
18 required, the RAM can be used for other content. In this way, the total RAM |
|
19 required to store content is less than if it were all permanently available. </p> |
|
20 <p>The Device Driver Guide provides <xref href="GUID-469EC7BB-8697-57FE-A487-016882A0BEA8.dita#GUID-469EC7BB-8697-57FE-A487-016882A0BEA8/GUID-E382AA71-8BB5-5567-8578-51598D3131FD">Suggested |
|
21 techniques for mitigating the effects of demand paging</xref> for writers |
|
22 of device drivers. These recommendations can result in a more ‘multithreaded’ |
|
23 base-port. This may have the following impact that needs to be considered: </p> |
|
24 <ul> |
|
25 <li id="GUID-DB6CC462-FB46-5D3B-8BAA-5B21FA06AF9D"><p>A base-port component |
|
26 may provide services to device drivers, exposing to them a shared resource; |
|
27 either hardware or software: </p> <ul> |
|
28 <li id="GUID-6B9E9433-EA19-54AE-B7A5-6E2C3341723B"><p>hardware - may be a |
|
29 hardware controller whose non-instantaneous operation, once initiated, cannot |
|
30 be disturbed until it completes </p> </li> |
|
31 <li id="GUID-92AD6E2B-34CC-59B4-8D52-FD739C3DD841"><p>software - may be a |
|
32 list of requests for services. </p> </li> |
|
33 </ul> </li> |
|
34 <li id="GUID-45F7D284-C216-5684-8C7B-2958C809B1BC"><p>A hardware component |
|
35 has a control interface that can be used by a number of drivers. Operations |
|
36 on the control interface although near instantaneous, are not atomic and cannot |
|
37 be interrupted. </p> </li> |
|
38 </ul> |
|
39 <p>In the case of the base-port component, when the state of a resource needs |
|
40 to be protected from the effects of pre-emption for a non-negligible period |
|
41 of time, the recommended approach is to use mutual exclusion, protecting the |
|
42 resource with a mutex: unless there is any chance that the same driver may |
|
43 trigger the same operation before the previous one completed. For example, |
|
44 when operations are non-blocking and happen in a context different from the |
|
45 initiator’s, a <xref href="GUID-D5B555DA-3D17-3ED2-A931-CB35BD93A953.dita"><apiname>NFastMutex</apiname></xref> should suffice. </p> |
|
46 <p>An example of the hardware component situation is a set-clear control interface, |
|
47 where a pair of registers (one containing the bits to be set, the other the |
|
48 bits to be cleared) have to be written to produce the desired change. If the |
|
49 operation is pre-empted after bits are set but before they are cleared for |
|
50 a desired final output, and a new set-clear operation is initiated, the final |
|
51 state of the interface may be undetermined. Pre-emption protection in this |
|
52 case is achieved by simply locking the Kernel using <xref href="GUID-3A3C08F3-3D33-3D9E-80E7-7855C7B21E02.dita#GUID-3A3C08F3-3D33-3D9E-80E7-7855C7B21E02/GUID-7CBBF72B-4519-38DD-92CA-38AF636AFD8A"><apiname>NKern::Lock()</apiname></xref> before |
|
53 the operation starts and unlocking it with <xref href="GUID-3A3C08F3-3D33-3D9E-80E7-7855C7B21E02.dita#GUID-3A3C08F3-3D33-3D9E-80E7-7855C7B21E02/GUID-A1A42137-906C-30F1-AF61-4F786FC372DE"><apiname>NKern::Unlock()</apiname></xref> after |
|
54 it completes. If the interface is to be used from an interrupt context disabling |
|
55 all interrupts is sufficient to protect against thread concurrency. </p> |
|
56 </conbody><related-links> |
|
57 <link href="GUID-90B5FDD9-7D59-5035-BF53-2B177655DCD6.dita"><linktext>Migration |
|
58 Tutorial: Demand Paging and Internal MMC Cards</linktext> |
|
59 </link> |
|
60 <link href="GUID-EB2566BD-8F65-5A81-B215-E8B05CFE21C3.dita"><linktext>Migration |
|
61 Tutorial: Demand Paging and Media Drivers</linktext></link> |
|
62 </related-links></concept> |