On 1/10/07, Laurent Pointal <[EMAIL PROTECTED]> wrote:
This is a system configurable limit (up to a maximum).
See ulimit man pages.
test
ulimit -a
to see what are the current limits, and try with
ulimit -u 2000
to modify the maximum number of user process (AFAIK each thread use a
process entry on Linux)
I don't think it's only this.
---
$ ulimit -a
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
max nice (-e) 20
file size (blocks, -f) unlimited
pending signals (-i) unlimited
max locked memory (kbytes, -l) unlimited
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) unlimited
max rt priority (-r) unlimited
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) unlimited
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
---
Well, unlimited number user processes. But:
---
$ python test.py
50
100
150
200
250
300
350
Exception raised: can't start new thread
Biggest number of threads: 382
---
The test.py script is attached.
--
Felipe.
from thread import start_new_thread
from time import sleep
def sleeper():
try:
while 1:
sleep(10000)
except:
if running: raise
def test():
global running
n = 0
running = True
try:
while 1:
start_new_thread(sleeper, ())
n += 1
if not (n % 50):
print n
except Exception, e:
running = False
print 'Exception raised:', e
print 'Biggest number of threads:', n
if __name__ == '__main__':
test()
--
http://mail.python.org/mailman/listinfo/python-list