473,545 Members | 1,893 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Parallel execution (CGI)

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.flus h()
x = 999999
y = 5478
counter = 0
while counter < 10000000:
z = x^y
counter += 1
print 'finished!'
sys.stdout.flus h()

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

Jul 19 '05 #1
0 1303

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
2536
by: | last post by:
Assume that we have a complex application with many math operations and it is written in an ANSI C++ code and running on a single PC without any problem. Is there an automatic way to execute the same application on a cluster of PCs to speed-up the execution? (How?) Or does it has to be re-written in some special way to be executed on the...
2
13652
by: Neil Ginsberg | last post by:
I have a SQL 7 db with a union query (view), and I'm getting the error, "The query processor could not start the necessary thread resources for parallel query execution." This union query has been in place for about two years now with no problems until just now, though I haven't changed anything. Also, I have a local copy of the database on my...
3
2701
by: paytam | last post by:
Hi all, Is it possible to write parallel programming in C? I mean for example a simple program like I have a clock on a program that show me current time and and at the same time another job like input data from a user.If it is possible PLZ write a simple code for me ..
126
4229
by: ramyach | last post by:
Hi friends, I need to write a parallel code in 'C' on the server that is running SGI Irix 6.5. This server supports MIPS Pro C compiler. I don't have any idea of parallel C languages. I looked into few posts in this group. I could make out that there are several languages for parallel programming and parallel C is one of them. I need to know...
14
7870
by: Dave Booker | last post by:
I'm doing some analysis that is readily broken up into many independent pieces, on a multicore machine. I thought it would be best to just queue like 1000 of these pieces in the ThreadPool, and let that object take care of running them in the background on the machine's free cycles. But I need the program to wait for all the queued pieces...
10
2459
by: Mythmon | last post by:
I am trying to make a program that will basically simulate a chess clock in python. To do this I have two threads running, one that updates the currently running clock, and one that watches for a keypress. I am using the effbot Console module, and that is where I get the events for the keypresses. But when I press space it crashes shortly...
43
4271
by: parallelpython | last post by:
Has anybody tried to run parallel python applications? It appears that if your application is computation-bound using 'thread' or 'threading' modules will not get you any speedup. That is because python interpreter uses GIL(Global Interpreter Lock) for internal bookkeeping. The later allows only one python byte-code instruction to be executed...
5
1931
by: fdu.xiaojf | last post by:
Hi all, I'm interested in Parallel Python and I learned from the website of Parallel Python that it can run on SMP and clusters. But can it run on a our muti-CPU server ? We are running an origin3800 server with 128 CPUs. Thanks.
0
7486
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7416
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7676
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7442
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6001
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5347
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4965
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3473
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1032
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.