ibm-information-center/dist/eclipse/plugins/i5OS.ic.apis_5.4.0.1/293735.htm

80 lines
3.3 KiB
HTML
Raw Normal View History

2024-04-02 14:02:31 +00:00
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Copyright" content="Copyright (c) 2006 by IBM Corporation">
<title>Running threaded programs</title>
<!-- Begin Header Records ========================================== -->
<!-- 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. -->
<!-- NETMG2 SCRIPT A converted by B2H R4.1 (346) (CMS) by HOLTJM at -->
<!-- RCHVMW2 on 29 Jan 1999 at 10:01:37 -->
<!-- Change History: -->
<!-- YYMMDD USERID Change description -->
<!--File Edited November 2001 -->
<!--End Header Records -->
<link rel="stylesheet" type="text/css" href="../rzahg/ic.css">
</head>
<body>
<!-- Java sync-link -->
<script language="Javascript" src="../rzahg/synch.js" type="text/javascript">
</script>
<h2>Running threaded programs</h2>
<p>When you run a threaded program, the job that runs a threaded program must
be specially initialized by the system to support threads. Currently, several
mechanisms allow you to start a job that is capable of creating multiple kernel
threads:</p>
<ul>
<li>Use the i5/OS<SUP>(TM)</SUP> QShell Interpreter. In the QShell Interpreter, a program
gets descriptors 0, 1, and 2 as the standard files; the parent and child I/O is
directed to the console. The QShell interpreter allows you to run multithreaded
programs as if they were interactive. See <a href="../rzahz/intro.htm">Qshell</a>
for a description of the QIBM_MULTI_THREADED shell variable,
which, when set to 'Y', allows you to run multithreaded programs the same way
you run any other program. The QShell Interpreter is option 30 of Base
i5/OS.<br>
<br>
</li>
<li>Use the <strong>spawn</strong>() API. The <strong>spawn</strong>() API has
a flag in the spawn inheritance structure that allows you to turn on the
multithread capability for the child job. The <strong>QUSRTOOL</strong> library
also provides source code and an example CL command to allow you to create and
use a <strong>SPAWN</strong> CL command in a way that is similar to the
<strong>SBMJOB</strong> CL command. See the <a href="concep32.htm">SPAWN CL
command, QUSRTOOL example</a> for more information.<br>
<br>
</li>
<li>Use the <strong>SBMJOB</strong> CL command. Setting the 'Allow multiple
threads' parameter (keyword <strong>ALWMLTTHD</strong>) on the CL command
allows you to turn on the multithread capability of the submitted job.<br>
<br>
</li>
<li>Use the <strong>CRTJOBD</strong> CL command to create a special job
description; then create your job using a mechanism that will use the job
description. Setting the 'Allow multiple threads' parameter (keyword <strong>
ALWMLTTHD</strong>) on the job description allows you to turn on the
multithread capability of the jobs that are created using that job
description.</li>
</ul>
<hr>
<center>
<table cellpadding="2" cellspacing="2">
<tr align="center">
<td valign="middle" align="center"><a href="rzah4mst.htm">Pthread APIs</a> | <a
href="aplist.htm">APIs by category</a></td>
</tr>
</table>
</center>
</body>
</html>