ibm-information-center/dist/eclipse/plugins/i5OS.ic.rzahw_5.4.0.1/rzahwdetco.htm

102 lines
6.1 KiB
HTML

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en-us" xml:lang="en-us">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="security" content="public" />
<meta name="Robots" content="index,follow" />
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
<meta name="DC.Type" content="reference" />
<meta name="DC.Title" content="Areas to test for multithreaded applications" />
<meta name="abstract" content="Testing is key to the process of verifying the correctness of a multithreaded program." />
<meta name="description" content="Testing is key to the process of verifying the correctness of a multithreaded program." />
<meta name="DC.Relation" scheme="URI" content="rzahwbugco.htm" />
<meta name="copyright" content="(C) Copyright IBM Corporation 1998, 2006" />
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 1998, 2006" />
<meta name="DC.Format" content="XHTML" />
<meta name="DC.Identifier" content="rzahwdet-detco" />
<meta name="DC.Language" content="en-us" />
<!-- All rights reserved. Licensed Materials Property of IBM -->
<!-- US Government Users Restricted Rights -->
<!-- Use, duplication or disclosure restricted by -->
<!-- GSA ADP Schedule Contract with IBM Corp. -->
<link rel="stylesheet" type="text/css" href="./ibmdita.css" />
<link rel="stylesheet" type="text/css" href="./ic.css" />
<title>Areas to test for multithreaded applications</title>
</head>
<body id="rzahwdet-detco"><a name="rzahwdet-detco"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Areas to test for multithreaded applications</h1>
<div><p>Testing is key to the process of verifying the correctness
of a multithreaded program. </p>
<div class="section"><div class="p">You should consider the following key concepts when testing a
multithreaded program: <ul><li>Multiple instances:<p>Test your multithreaded program by having multiple
instances of the program active at the same time. If your application allows
the number of threads to vary, configure each instance of the program with
a different number of threads. </p>
</li>
<li>Vary system workload:<p>Test your multithreaded program by running it
repeatedly with a different mix of applications running. The interaction of
different applications might reveal timing problems or race conditions. </p>
</li>
<li>Stress environments:<p>Environments running stressful workload can reveal
contention, timing, and performance problems. </p>
</li>
<li>Different hardware models:<p>Whenever possible, run your multithreaded
program on different hardware models with varying workload and stress levels.
Different hardware models, especially multiprocessor systems, reveal a variety
of problems. If you are porting an application from another platform, verify
that your application produces the same result on both platforms.</p>
</li>
</ul>
</div>
</div>
<div class="section"><div class="p">Testing is only one consideration for validating the correctness
of a multithreaded program. Code inspections are critical and often the only
way to determine potential problems. When inspecting the code for a multithreaded
program, you need to continually ask the question, "If the code is interrupted
at this point, what potential problems can occur?" Often, knowing the potential
sources of problems helps you avoid them. Common problems are as follows:<ul><li>Hardware-related problems:<p>It is typically sufficient to test a single-threaded
program on one hardware model and expect that it will behave identically on
different hardware models. Unlike with single-threaded programs, you cannot
have the same expectation with a multithreaded program that runs on a hardware
platform that supports kernel threads. On these platforms, each thread runs
in a separately dispatched task. Depending on processor speed, main memory
sizes, storage capacity, and other hardware characteristics, timing problems
or race conditions might result when the multithreaded programs are called
on different hardware. Multiprocessor systems further increase the likelihood
of discovering potential problems. On multiprocessor systems, two different
threads can be running the same sequence of code at the same time. </p>
</li>
<li>Java™ virtual
machine implementation problems:<p>A problem for Java application developers is the implementation
of the Java virtual machine (JVM). On some platforms, the JVM
is single-threaded. On <span class="keyword">i5/OS™</span>,
the JVM is multithreaded. Similar problems might occur with a Java application
as with an application from another platform that supports user threads.</p>
</li>
<li>Threads model problems:<p>If you are porting an application from another
platform, you need to know the threads model that the other platform supported.
If the platform supported a user threads model, you might encounter problems
with the application on <span class="keyword">i5/OS</span> because
it supports a kernel threads model. A key difference between the two models
is that the user threads model uses cooperative scheduling and the kernel
threads model uses preemptive scheduling. With a user threads model, only
one thread in the application can be active at a given time. With a kernel
threads model, the machine determines which threads are eligible to run. Race
conditions, resource contention, and other problems might occur with kernel
threads because the application writer did not consider these potential problems
when using user threads. </p>
</li>
</ul>
</div>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="rzahwbugco.htm" title="Use the concepts and techniques that are described here to learn about debugging and servicing multithreaded jobs:">Debugging and servicing of multithreaded jobs</a></div>
</div>
</div>
</body>
</html>