473,324 Members | 2,246 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

About Threading - implementation

Hi !

I don't understand something.

Under Python the threads are simulated by Python Interpreter as when
prev. setted pieces (interval) of the interpreted tokens are executed,
it is change to another "virtual" thread ?

Or it was really create real threads, and they are figth for the
priority, and for the execution time ?

And can I create REAL threads under Python (just like in Delphi), or
better if I use processes, not threads ?

Please help me:
dd
Jun 14 '06 #1
1 1129
In <ma***************************************@python. org>, Dara Durum
wrote:
Under Python the threads are simulated by Python Interpreter as when
prev. setted pieces (interval) of the interpreted tokens are executed,
it is change to another "virtual" thread ?

Or it was really create real threads, and they are figth for the
priority, and for the execution time ?
Both. CPython creates real threads but only one of those can be active at
a time if python bytecode is executed because of the `global interpreter
lock` (GIL). Extensions written in C can release that lock unless they
are accessing the interpreter "internals". For example blocking IO calls
like `file.read()` release the lock.
And can I create REAL threads under Python (just like in Delphi), or
better if I use processes, not threads ?


Depends on the use case. If your program is IO bound i.e. many threads
waiting for blocking IO then just use Python threads. If your task is
computational intensive then it may be better to use processes and some
form of inter process communication.

Ciao,
Marc 'BlackJack' Rintsch
Jun 14 '06 #2

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

Similar topics

17
by: Andrae Muys | last post by:
Found myself needing serialised access to a shared generator from multiple threads. Came up with the following def serialise(gen): lock = threading.Lock() while 1: lock.acquire() try: next...
4
by: Joe Wong | last post by:
Hi, Is there any way to increase/decrease a thread priority in Python? Best regards, -- Wong
15
by: Valkyrie | last post by:
Refering to the following codes I found, there is nothing displayed in the console, may I ask why? def thrd(param): # the thread worker function print "Received",param import thread for i in...
77
by: Jon Skeet [C# MVP] | last post by:
Please excuse the cross-post - I'm pretty sure I've had interest in the article on all the groups this is posted to. I've finally managed to finish my article on multi-threading - at least for...
6
by: Dan | last post by:
I've created a pocketpc app which has a startup form containing a listview. The form creates an object which in turn creates a System.Threading.Timer. It keeps track of the Timer state using a...
5
by: John Richardson | last post by:
Quick question about the UnhandledException event and associated Handler. I just implemented this handler for the first time, and am surprised that it this event is being raised for an exception...
2
by: Peter Row | last post by:
Hi, I think I am having some threading issues in a project I am porting from VB6 webclass to VB.NET. Therefore I would like to temporarily set the threading mode to STA to get around it until I...
23
by: Ray | last post by:
Hello! I've been reading about PyPy, but there are some things that I don't understand about it. I hope I can get some enlightenment in this newsgroup :) First, the intro: <excerpt> "The...
9
by: akrapus | last post by:
Hi, I am trying to understand how to use threading in Python. I get threading as a concept, but not the implementation. In order to start threading, do you call it as a separate function,...
126
by: Dann Corbit | last post by:
Rather than create a new way of doing things: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2497.html why not just pick up ACE into the existing standard:...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.