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

74 lines
4.8 KiB
HTML
Raw Normal View History

2024-04-02 14:02:31 +00:00
<?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="Multithreaded server recommendations" />
<meta name="abstract" content="When you write a typical server to take advantage of threads, a common design is to have a single listener thread waiting for client requests and multiple individual worker threads to perform the client's requested operations." />
<meta name="description" content="When you write a typical server to take advantage of threads, a common design is to have a single listener thread waiting for client requests and multiple individual worker threads to perform the client's requested operations." />
<meta name="DC.Relation" scheme="URI" content="rzahwpcoco.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="rzahwser-serco" />
<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>Multithreaded server recommendations</title>
</head>
<body id="rzahwser-serco"><a name="rzahwser-serco"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Multithreaded server recommendations</h1>
<div><p>When you write a typical server to take advantage of threads, a
common design is to have a single listener thread waiting for client requests
and multiple individual worker threads to perform the client's requested operations.</p>
<div class="section"><p>Creating threads should not use very many resources. However,
because some servers require a faster response time to clients, some server
application programs maintain a pool of worker threads that are waiting for
work. They do this to avoid creating new threads.</p>
</div>
<div class="section"><p>Typically, the worker threads use some synchronization primitive
to wait for client processing requests. Instead of creating a new thread to
process each client request, the listener thread queues the client request
and signals the waiting worker threads. The signal sometimes uses variables.</p>
</div>
<div class="section"><p>A server application is commonly considered trusted with the data
that it serves to clients. Because the server is running multithreaded applications,
you must consider some issues concerning the activities it performs:</p>
<ul><li>You should not call user application code from a multithreaded server.
To run user application code safely from a multithreaded server, the user
application code must follow the same strict rules that the original multithreaded
server did. These rules concern the actions that it can take and the application
programming interfaces (APIs) that it can call </li>
<li>As you should with any other part of your application, you must evaluate
the processing that is required to fulfill the client request for its thread
safety.</li>
<li>Processing on behalf of the client might affect process-level
resources of the server in a way that is not wanted for the server. For example,
changing the coded character set identifier (CCSID) so that data representation
is the same as that of the client also affects other threads in the job. CCSID
is a job resource.</li>
<li>A server can change the security information (user profile and group profile)
of a worker thread to make it become the client that is being served. However,
when the server does this, you need to consider what resources the threads
share. The worker thread has access to all the already opened job level resources
that more privileged users in the same job might have created or opened. </li>
</ul>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="rzahwpcoco.htm" title="There are several performance considerations for multithreaded jobs on i5/OS.">Performance considerations in multithreaded applications</a></div>
</div>
</div>
</body>
</html>