|
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-44540C74-CD73-5D8E-A9E0-F90F46B4E7B1" xml:lang="en"><title>Preventing |
|
13 And Recovering From Thrashing Tutorial</title><shortdesc>Describes how to reduce the chance of thrashing occurring in demand |
|
14 memory and how to recover from thrashing. </shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody> |
|
15 <section id="GUID-B9C385CD-A155-52F9-9001-C219A9AD52DB"><title>Introduction</title> <p>Thrashing |
|
16 is a state where the vast majority of the processing time is spent paging |
|
17 memory in and out of the system and very little is spent useful work. If this |
|
18 situation persists, then the system performance rapidly becomes unacceptable |
|
19 and will appear to the user to have hung. </p> </section> |
|
20 <section id="GUID-D93027E5-EC83-431B-872C-17F81F5FD64B"><title>Background information</title><p>The following is useful background |
|
21 reading: </p><ul> |
|
22 <li><p> Thrashing </p></li> |
|
23 </ul> </section> |
|
24 <section id="GUID-6EAA97DD-B352-4C40-9A41-4F60F2A34A8B"><title>Thrashing features</title><p>When thrashing occurs the device |
|
25 will appear to do nothing or 'hang' for period. Unlike a deadlock however, |
|
26 the device can recover from thrashing.</p> </section> |
|
27 <section id="GUID-6355035F-BBE3-4D33-8B02-76BA7B40AA0B"><title>Prevention of thrashing</title><p>The following can be used |
|
28 reduce the chance of thrashing: </p><ul> |
|
29 <li><p>Compress pages in memory to decrease the amount of memory that has |
|
30 to be paged in and out </p></li> |
|
31 <li><p>Limit the maximum size of each process's paged memory to the minimum |
|
32 size of the paging cache </p></li> |
|
33 <li><p>Partition the page cache per-process and allocate pages to processes |
|
34 based on the Working Set Size (WSS) of threads in that process</p></li> |
|
35 <li><p>Swap out the oldest pages in advance to free up memory to cope with |
|
36 spikes in paging demand</p></li> |
|
37 <li><p>Don't let threads steal pages from other threads </p></li> |
|
38 </ul> </section> |
|
39 <section id="GUID-5E119B58-E5C5-49AD-95B3-76DDDD4AF0CD"><title>Recovery from thrashing</title> <p>The possible courses of |
|
40 action to undertake, should thrashing occur, are : </p> <ul> |
|
41 <li id="GUID-50BE3032-DE49-575A-B2A8-20D12F387C86"><p>Reboot the device </p> </li> |
|
42 <li id="GUID-DFB20955-70DA-5403-BFDD-D45B50926E98"><p>Kill a thread </p> </li> |
|
43 <li id="GUID-DF970B70-A9BA-5532-A267-5920950F6F2A"><p>Decrease the number |
|
44 of paged threads running concurrently </p> </li> |
|
45 <li id="GUID-B849006B-66E7-5F31-8225-297235614AC4"><p>Pick one thread with |
|
46 a high page fault rate and stop other threads stealing pages from the thread's |
|
47 associated process </p> </li> |
|
48 <li id="GUID-0497BC30-7BCA-5E69-A835-722C80EA2680"><p>Prompt the user-side |
|
49 memory manager to close down applications. </p> </li> |
|
50 </ul> </section> |
|
51 </conbody><related-links> |
|
52 <link href="GUID-ACB79CEF-CA4D-5C96-AFCD-6AD7C7C26C53.dita"><linktext>Thrashing |
|
53 guide</linktext></link> |
|
54 </related-links></concept> |