usr bin env python encoding utf-8 import threading sys threadc 10 def

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
import threading, sys
threadc = 10
def loop():
s = 1000^1000000000;
while s > 0:
# какаянить математическая опирация
1000/5000*7000^200
s-=1
l,c = [],0
sys.stdout.write('allocate ...\n')
for q in xrange(0, threadc):
l.append(threading.Thread(None, loop))
sys.stdout.write('starting ...\n')
for q in l:
q.start()
c+=1
sys.stdout.write('started #%s/%s\n' %(c, threadc))
sys.stdout.flush()
sys.stdout.write('start ok. wait...\n')
c = 0
for q in l:
c+=1
q.join()
sys.stdout.write('thread #%s end work\n'%c)
Этот код часто юзает память?