Hi list,<br><br>First Hello to all, I have a serious problem for understand some results when I&#39;m comparing cpu usages between same python code in embedded mode and standalone mode ( python name_script.py )<br><br>This
last months I have been writing a&nbsp; program in c like to mod_python for
embedding python language, it&#39;s a middleware for dispatch and execute
python batch programs into several nodes. Now I&#39;m writing some python
program for test how scale this into several nodes and comparing with
&quot;standalone&quot; performance. <br>
<br>I found a very strange problem with one application named
md5challenge, this aplication try to calculate the max number md5
digest in several seconds, md5challenge use a simple signal alarm for
stop program when time has passed. This is the code of python script<br>
<br><div id="1gau" class="ArwC7c ckChnd">_nrdigest = 0<br>_const_b = 20<br>_f = None<br>_signal = False<div class="Ih2E3d"><br><br><br>def handler_alrm(signum, frame):<br>&nbsp;&nbsp;&nbsp; global _signal<br>
&nbsp;&nbsp;&nbsp; global _nrdigest<br>&nbsp;&nbsp;&nbsp; global _f<br><br><br>&nbsp;&nbsp;&nbsp; _signal = True<br><br>def try_me():<br>&nbsp;&nbsp;&nbsp; global _nrdigest<br>&nbsp;&nbsp;&nbsp; global _f<br>&nbsp;&nbsp;&nbsp; global _signal<br><br>&nbsp;&nbsp;&nbsp; _f = open(&quot;/dev/urandom&quot;,&quot;r&quot;)<br>&nbsp;&nbsp;&nbsp; while _signal is not True:<br>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; buff = _f.read(_const_b)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; md5.md5(buff).hexdigest()<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _nrdigest = _nrdigest + 1<br><br>&nbsp;&nbsp;&nbsp; if _f is not None : <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _f.close()<br><br></div># Define entry point with one input variable<br>
# req is a instance of Request object, usefull members of this object are:<br>
# req.input is a dictionary with input.xml variables<br># req.constants is a dictionary with constants defined into signature.xml<br># req.output is void dictionary for full with output variables<br># req.config is a dictionary with config values take from namespace<br>

# req.apdn_pid is a pid of aplication<br><br><br>def main( req ):<br>&nbsp;&nbsp;&nbsp; global _nrdigest<br><br><br>&nbsp;&nbsp;&nbsp; signal.signal(signal.SIGALRM, handler_alrm)<br>&nbsp;&nbsp;&nbsp; signal.alarm(req.input[&#39;time&#39;])<br><div class="Ih2E3d">&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp; try_me()<br>
<br>&nbsp;&nbsp;&nbsp; req.output[&#39;count&#39;] = _nrdigest<br><br>&nbsp;&nbsp;&nbsp; return req.OK<br><br><br>if __name__ == &quot;__main__&quot;:<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; # test code<br>&nbsp;&nbsp;&nbsp; class test_req:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pass<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; req = test_req()<br>

&nbsp;&nbsp;&nbsp; req.input = { &#39;time&#39; : 10 }<br>&nbsp;&nbsp;&nbsp; req.output = { &#39;ret&#39; : 0, &#39;count&#39; : 0 }<br>&nbsp;&nbsp;&nbsp; req.OK = 1<br><br>&nbsp;&nbsp;&nbsp; main(req)<br><br>&nbsp;&nbsp;&nbsp; print &quot;Reached %d digests&quot; % req.output[&#39;count&#39;]<br>

</div><br><br>When
I try to run this program in standalone into my Pentium Dual Core
md5challenge reached 1.000.000 milion keys in 10 seconds but when i try
to run this code in embedded mode md5challenge reached about 200.000 more
keys !!! I repeat this test many times and&nbsp; always&nbsp; wins&nbsp; embedded
mode&nbsp; !!!&nbsp; What&#39;s happen ?<br>
<br>Also I tested to erase read dependencies from /dev/random, and
calculate all keys from same buffer. In this case embedded mode win
always also, and the difference are more bigger !!!<br><br>The alarm time expires in both case in 10 seconds.<br><br>Thks to all, can anybody help to me for understand this results ?</div><br clear="all"><br>-- <br>Pau Freixes<br>
Linux GNU/User