Parallel execution (CGI)

M

mmf

Hi!

I am using Python for CGI scripting. I had the following script:

#!/usr/bin/python
import sys
print 'Content-type: text/html\r\n\r\n'
print 'starting...'
sys.stdout.flush()
x = 999999
y = 5478
counter = 0
while counter < 10000000:
z = x^y
counter += 1
print 'finished!'
sys.stdout.flush()

I saved it in as test1.py - and tried to load it over HTTP. So
everything is fine.

But now I saw a very strange behaviour: I sent two parallel requests to
the script (for example by sending two requests in two browser windows
almost at the same time).

My problem: The requests to the script seem NOT to be done in parallel:
The first script prints "starting..." and after a short time
"finished". And then in the other browser window the second request
shows "starting...".

But I expected that in both browser windows "starting" will be shown
almost at the same time because the two requests are done in parallel.

The strange behaviour goes on:
If copied the test1.py and saved it as test2.py. Now I retried my test
and sent two requests - but to these two identical files (that only
differ in their filename). The the two requests seem to be done in
parallel...

(It tried my test on Fedora and Gentoo Linux, with Python 2.2 and
Python 2.4, with different webservers (Apache and others), and with
several different browsers - I always was the same.)

What am I doing wrong?

Best regards,
Markus Franz
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top