[Tutor] about threads

Luke Paireepinart rabidpoobear at gmail.com
Wed Aug 16 08:52:41 CEST 2006

emilia12 at mail.bg wrote:
> Hi all,
> my question is probably about the threads... I have two IPs
> and i want to run web.py server for each IP in the same
> time from one script file. I can run them in two command
> boxes (and this works) but i want to do this from one ;-)
if you run two instances of the python interpreter (like you're doing 
when you start two command windows,)
they're executing in different threads, it's just that the threads are 
OS level instead of application level.
Windows automatically switches between the two instances of the 
interpreter and gives them both time to do something.
This is why you can run an E-mail application at the same time as your 
web browser.
I suspect that OS-level threading in this way would be more efficient in 
regard to speed, but
it'd use more RAM because two interpreter instances would be loaded into 
memory at the same time.
I don't know what web.py is.
Is it something you wrote?
You'll have to write multi-threaded code if you want it to run multiple 
threads :)
(Unless, of course, Web.py supports threads?)
What's your experience with Python?
Do you need help with threads in general? threads in Python?
 >Maybe i can do this with 'threads' but how ? is there some
 >example ??
There are plenty of examples of threaded code that you could find by 
googling around,
or do you mean 'is there some example [of multi-threading the web.py 
If the latter case, I guess you could find that by googling as well, if 
it exists.

> regards
> e.


More information about the Tutor mailing list