Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / devtools / amd64 / html / python / lib / node441.html
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<link rel="STYLESHEET" href="lib.css" type='text/css' />
<link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" />
<link rel='start' href='../index.html' title='Python Documentation Index' />
<link rel="first" href="lib.html" title='Python Library Reference' />
<link rel='contents' href='contents.html' title="Contents" />
<link rel='index' href='genindex.html' title='Index' />
<link rel='last' href='about.html' title='About this document...' />
<link rel='help' href='about.html' title='About this document...' />
<link rel="next" href="node442.html" />
<link rel="prev" href="module-resource.html" />
<link rel="parent" href="module-resource.html" />
<link rel="next" href="node442.html" />
<meta name='aesop' content='information' />
<title>8.14.1 Resource Limits</title>
</head>
<body>
<DIV CLASS="navigation">
<div id='top-navigation-panel' xml:id='top-navigation-panel'>
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td class='online-navigation'><a rel="prev" title="8.14 resource "
href="module-resource.html"><img src='../icons/previous.png'
border='0' height='32' alt='Previous Page' width='32' /></A></td>
<td class='online-navigation'><a rel="parent" title="8.14 resource "
href="module-resource.html"><img src='../icons/up.png'
border='0' height='32' alt='Up One Level' width='32' /></A></td>
<td class='online-navigation'><a rel="next" title="8.14.2 Resource Usage"
href="node442.html"><img src='../icons/next.png'
border='0' height='32' alt='Next Page' width='32' /></A></td>
<td align="center" width="100%">Python Library Reference</td>
<td class='online-navigation'><a rel="contents" title="Table of Contents"
href="contents.html"><img src='../icons/contents.png'
border='0' height='32' alt='Contents' width='32' /></A></td>
<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
border='0' height='32' alt='Module Index' width='32' /></a></td>
<td class='online-navigation'><a rel="index" title="Index"
href="genindex.html"><img src='../icons/index.png'
border='0' height='32' alt='Index' width='32' /></A></td>
</tr></table>
<div class='online-navigation'>
<b class="navlabel">Previous:</b>
<a class="sectref" rel="prev" href="module-resource.html">8.14 resource </A>
<b class="navlabel">Up:</b>
<a class="sectref" rel="parent" href="module-resource.html">8.14 resource </A>
<b class="navlabel">Next:</b>
<a class="sectref" rel="next" href="node442.html">8.14.2 Resource Usage</A>
</div>
<hr /></div>
</DIV>
<!--End of Navigation Panel-->
<H2><A NAME="SECTION00101410000000000000000">
8.14.1 Resource Limits</A>
</H2>
<P>
Resources usage can be limited using the <tt class="function">setrlimit()</tt> function
described below. Each resource is controlled by a pair of limits: a
soft limit and a hard limit. The soft limit is the current limit, and
may be lowered or raised by a process over time. The soft limit can
never exceed the hard limit. The hard limit can be lowered to any
value greater than the soft limit, but not raised. (Only processes with
the effective UID of the super-user can raise a hard limit.)
<P>
The specific resources that can be limited are system dependent. They
are described in the <span class="manpage"><i>getrlimit</i>(2)</span> man page. The resources
listed below are supported when the underlying operating system
supports them; resources which cannot be checked or controlled by the
operating system are not defined in this module for those platforms.
<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-3057' xml:id='l2h-3057' class="function">getrlimit</tt></b>(</nobr></td>
<td><var>resource</var>)</td></tr></table></dt>
<dd>
Returns a tuple <code>(<var>soft</var>, <var>hard</var>)</code> with the current
soft and hard limits of <var>resource</var>. Raises <tt class="exception">ValueError</tt> if
an invalid resource is specified, or <tt class="exception">error</tt> if the
underlying system call fails unexpectedly.
</dl>
<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-3058' xml:id='l2h-3058' class="function">setrlimit</tt></b>(</nobr></td>
<td><var>resource, limits</var>)</td></tr></table></dt>
<dd>
Sets new limits of consumption of <var>resource</var>. The <var>limits</var>
argument must be a tuple <code>(<var>soft</var>, <var>hard</var>)</code> of two
integers describing the new limits. A value of <code>-1</code> can be used to
specify the maximum possible upper limit.
<P>
Raises <tt class="exception">ValueError</tt> if an invalid resource is specified,
if the new soft limit exceeds the hard limit, or if a process tries
to raise its hard limit (unless the process has an effective UID of
super-user). Can also raise <tt class="exception">error</tt> if the underlying
system call fails.
</dl>
<P>
These symbols define resources whose consumption can be controlled
using the <tt class="function">setrlimit()</tt> and <tt class="function">getrlimit()</tt> functions
described below. The values of these symbols are exactly the constants
used by C programs.
<P>
The <span class="Unix">Unix</span> man page for <span class="manpage"><i>getrlimit</i>(2)</span> lists the available
resources. Note that not all systems use the same symbol or same
value to denote the same resource. This module does not attempt to
mask platform differences -- symbols not defined for a platform will
not be available from this module on that platform.
<P>
<dl><dt><b><tt id='l2h-3059' xml:id='l2h-3059'>RLIMIT_CORE</tt></b></dt>
<dd>
The maximum size (in bytes) of a core file that the current process
can create. This may result in the creation of a partial core file
if a larger core would be required to contain the entire process
image.
</dd></dl>
<P>
<dl><dt><b><tt id='l2h-3060' xml:id='l2h-3060'>RLIMIT_CPU</tt></b></dt>
<dd>
The maximum amount of processor time (in seconds) that a process can
use. If this limit is exceeded, a <tt class="constant">SIGXCPU</tt> signal is sent to
the process. (See the <tt class="module"><a href="module-signal.html">signal</a></tt> module documentation for
information about how to catch this signal and do something useful,
e.g. flush open files to disk.)
</dd></dl>
<P>
<dl><dt><b><tt id='l2h-3061' xml:id='l2h-3061'>RLIMIT_FSIZE</tt></b></dt>
<dd>
The maximum size of a file which the process may create. This only
affects the stack of the main thread in a multi-threaded process.
</dd></dl>
<P>
<dl><dt><b><tt id='l2h-3062' xml:id='l2h-3062'>RLIMIT_DATA</tt></b></dt>
<dd>
The maximum size (in bytes) of the process's heap.
</dd></dl>
<P>
<dl><dt><b><tt id='l2h-3063' xml:id='l2h-3063'>RLIMIT_STACK</tt></b></dt>
<dd>
The maximum size (in bytes) of the call stack for the current
process.
</dd></dl>
<P>
<dl><dt><b><tt id='l2h-3064' xml:id='l2h-3064'>RLIMIT_RSS</tt></b></dt>
<dd>
The maximum resident set size that should be made available to the
process.
</dd></dl>
<P>
<dl><dt><b><tt id='l2h-3065' xml:id='l2h-3065'>RLIMIT_NPROC</tt></b></dt>
<dd>
The maximum number of processes the current process may create.
</dd></dl>
<P>
<dl><dt><b><tt id='l2h-3066' xml:id='l2h-3066'>RLIMIT_NOFILE</tt></b></dt>
<dd>
The maximum number of open file descriptors for the current
process.
</dd></dl>
<P>
<dl><dt><b><tt id='l2h-3067' xml:id='l2h-3067'>RLIMIT_OFILE</tt></b></dt>
<dd>
The BSD name for <tt class="constant">RLIMIT_NOFILE</tt>.
</dd></dl>
<P>
<dl><dt><b><tt id='l2h-3068' xml:id='l2h-3068'>RLIMIT_MEMLOCK</tt></b></dt>
<dd>
The maximum address space which may be locked in memory.
</dd></dl>
<P>
<dl><dt><b><tt id='l2h-3069' xml:id='l2h-3069'>RLIMIT_VMEM</tt></b></dt>
<dd>
The largest area of mapped memory which the process may occupy.
</dd></dl>
<P>
<dl><dt><b><tt id='l2h-3070' xml:id='l2h-3070'>RLIMIT_AS</tt></b></dt>
<dd>
The maximum area (in bytes) of address space which may be taken by
the process.
</dd></dl>
<P>
<DIV CLASS="navigation">
<div class='online-navigation'>
<p></p><hr />
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td class='online-navigation'><a rel="prev" title="8.14 resource "
href="module-resource.html"><img src='../icons/previous.png'
border='0' height='32' alt='Previous Page' width='32' /></A></td>
<td class='online-navigation'><a rel="parent" title="8.14 resource "
href="module-resource.html"><img src='../icons/up.png'
border='0' height='32' alt='Up One Level' width='32' /></A></td>
<td class='online-navigation'><a rel="next" title="8.14.2 Resource Usage"
href="node442.html"><img src='../icons/next.png'
border='0' height='32' alt='Next Page' width='32' /></A></td>
<td align="center" width="100%">Python Library Reference</td>
<td class='online-navigation'><a rel="contents" title="Table of Contents"
href="contents.html"><img src='../icons/contents.png'
border='0' height='32' alt='Contents' width='32' /></A></td>
<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
border='0' height='32' alt='Module Index' width='32' /></a></td>
<td class='online-navigation'><a rel="index" title="Index"
href="genindex.html"><img src='../icons/index.png'
border='0' height='32' alt='Index' width='32' /></A></td>
</tr></table>
<div class='online-navigation'>
<b class="navlabel">Previous:</b>
<a class="sectref" rel="prev" href="module-resource.html">8.14 resource </A>
<b class="navlabel">Up:</b>
<a class="sectref" rel="parent" href="module-resource.html">8.14 resource </A>
<b class="navlabel">Next:</b>
<a class="sectref" rel="next" href="node442.html">8.14.2 Resource Usage</A>
</div>
</div>
<hr />
<span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span>
</DIV>
<!--End of Navigation Panel-->
<ADDRESS>
See <i><a href="about.html">About this document...</a></i> for information on suggesting changes.
</ADDRESS>
</BODY>
</HTML>