Adaptation/GUID-44540C74-CD73-5D8E-A9E0-F90F46B4E7B1.dita
author Graeme Price <GRAEME.PRICE@NOKIA.COM>
Fri, 15 Oct 2010 14:32:18 +0100
changeset 15 307f4279f433
permissions -rw-r--r--
Initial contribution of the Adaptation Documentation.

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