Re: Multithreading? How?

2023-05-12 Thread Diego Souza
delay. You will probably not do it now, but if you ever need it, make a pool of workers to process this and keep the Gateway free. Replace the Threads with multiprocessing.Process, as well, as Python lacks true multithreading. Regarding thread/process communication, I like to implement this using Queu

Multithreading? How?

2023-04-28 Thread pozz
I need to develop a Python application that is a sort of gateway between to networks: a "serial bus" network (think of a serial port or a USB connection) and a MQTT connection (in my case, it's AWS IoT service). On the bus, a proprietary protocol is implemented. From the bus, the app knows the

Re: Multithreading python,two tkinter windows

2015-11-01 Thread Terry Reedy
On 11/1/2015 9:05 AM, Vindhyachal Takniki wrote: I have made a python code & using multithreading in it. this is very basic code, not using queues & other stuff. You can run multiple windows, or one window with multiple panes, in one thread with one event loop. Best to do gui stuf

Re: Multithreading python,two tkinter windows

2015-11-01 Thread Chris Angelico
On Mon, Nov 2, 2015 at 1:05 AM, Vindhyachal Takniki wrote: > #get reading at every 1 second > def get_analog_1(thread_name): > global read_ok_1, current_time_1,analog_1 > while True: > if((time.time() - current_time_1) > 1): > if(0 == read_ok_1): > curre

Re: Multithreading python,two tkinter windows

2015-11-01 Thread Laura Creighton
In a message of Sun, 01 Nov 2015 06:05:58 -0800, Vindhyachal Takniki writes: >I have made a python code & using multithreading in it. this is very basic >code, not using queues & other stuff. This is your problem. The code that uses queues is more basic. For tkinter you cannot us

Multithreading python,two tkinter windows

2015-11-01 Thread Vindhyachal Takniki
I have made a python code & using multithreading in it. this is very basic code, not using queues & other stuff. 1. Task is to create two independent Tkinter windows 2. Code has four files: main.py:creates individual thread analog.py: generate random values every 1 sec & 10 s

Re: querry on queue ( thread safe ) multithreading

2014-03-11 Thread Jim Gibson
In article , Jaiprakash Singh wrote: > hey i am working on scraping a site , so i am using multi-threading concept. > i wrote a code based on queue (thread safe) but still my code block out after > sometime, please help , i have searched a lot but unable to resolve it. > please help i stuck here

querry on queue ( thread safe ) multithreading

2014-03-10 Thread Jaiprakash Singh
hey i am working on scraping a site , so i am using multi-threading concept. i wrote a code based on queue (thread safe) but still my code block out after sometime, please help , i have searched a lot but unable to resolve it. please help i stuck here. my code is under .. +

Re: Multiprocessing and Multithreading

2013-10-08 Thread Grant Edwards
On 2013-10-08, Mark Lawrence wrote: > On 08/10/2013 06:34, Chandru Rajendran wrote: >> Hi all, >> >> Please give me an idea about Multiprocessing and Multithreading. >> >> Thanks & Regards, >> >> Chandru >> > > I'll assume that y

Re: Multiprocessing and Multithreading

2013-10-08 Thread Mark Lawrence
On 08/10/2013 06:34, Chandru Rajendran wrote: Hi all, Please give me an idea about Multiprocessing and Multithreading. Thanks & Regards, Chandru I'll assume that you're a newbie so I'll keep it simple. Multiprocessing is about more than one process and multithreading

Re: Multiprocessing and Multithreading

2013-10-08 Thread Terry Reedy
On 10/8/2013 1:34 AM, Chandru Rajendran wrote: Please give me an idea about Multiprocessing and Multithreading. Please give us some idea of what you know and what you actually want to know. CAUTION - Disclaimer * This e-mail contains PRIVILEGED AND

Multiprocessing and Multithreading

2013-10-08 Thread Chandru Rajendran
Hi all, Please give me an idea about Multiprocessing and Multithreading. Thanks & Regards, Chandru CAUTION - Disclaimer * This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely for the use of the addressee(s). If you are not the inte

Re: multithreading in python

2013-08-13 Thread Terry Reedy
On 8/13/2013 4:06 AM, samaneh.yahyap...@gmail.com wrote: Aside from the other comments... def item_thread(self): imageAnalyzer=ctypes.CDLL("../so/image_process.so") imageAnalyzer.aref_img_score_init("/opt/amniran/etc/face.xml", "/opt/amniran/etc/porn.xml") for f

Re: multithreading in python

2013-08-13 Thread Dave Angel
samaneh.yahyap...@gmail.com wrote: > hi > my program work by 4 thread but when i use more thread it terminates > > how can i solve this problem I simplified the code so I could actually run it, and tested it in Python 2.7, both under Komodo IDE and in the terminal. The code: #!/usr/bin/en

Re: multithreading in python

2013-08-13 Thread Dave Angel
samaneh.yahyap...@gmail.com wrote: > hi > my program work by 4 thread but when i use more thread it terminates > > I simplified your code so anybody could run it, and tested it inside Komodo IDE, on Python 2.7 #!/usr/bin/env python import sys import os import time import threading class MyC

Re: multithreading in python

2013-08-13 Thread Steven D'Aprano
On Tue, 13 Aug 2013 01:06:01 -0700, samaneh.yahyapour wrote: > hi > my program work by 4 thread but when i use more thread it terminates Is that a problem? Isn't it supposed to terminate, when it has finished? If it raises an exception, or crashes, you should tell us. > i use opencv in my ima

multithreading in python

2013-08-13 Thread samaneh . yahyapour
hi my program work by 4 thread but when i use more thread it terminates i use opencv in my image_process.so my code is : #!/usr/bin/python import sys import os import io import time import copy import threading import ctypes class MyClass(): def __init__(self): i = 0

Re: introduction and first question about multithreading

2012-07-12 Thread Dave Angel
game for handling of sounds and keyboard events, speech > dispatcher under Linux and pyttsx under Windows to provide speech > output, numpy for sound cutting and my two little and simple modules for > providing menu system and unified interface for both speech engines. > During the develo

Re: introduction and first question about multithreading

2012-07-11 Thread Roy Smith
In article , Vojt®ßch Pol®¢‰ek wrote: > Then the menu module kicks in and should launch its > own loop checking for pygame keyboard events, but right after doing it > it prints: > [xcb] Unknown sequence number while processing queue > [xcb] Most likely this is a multi-threaded client and X

introduction and first question about multithreading

2012-07-11 Thread Vojtěch Polášek
ech output, numpy for sound cutting and my two little and simple modules for providing menu system and unified interface for both speech engines. During the development, I discovered, that I have to use multithreading to be able to check for key presses and manage the game at the same time. I tried

Re: multithreading

2012-04-08 Thread Bryan
Kiuhnm wrote: > I have a decorator which takes an optional argument that tells me > whether I should use locks. > Maybe I could import 'threading' only if needed. If the user wants to > use locks I'll assume that 'threading' is available on his/her system. Use of dummy_threading might be cleaner.

Re: multithreading

2012-04-08 Thread Kiuhnm
On 4/8/2012 7:04, Bryan wrote: Kiuhnm wrote: My question is this: can I use 'threading' without interfering with the program which will import my module? Yes. The things to avoid are described at the bottom of: http://docs.python.org/library/threading.html On platforms without threads, 'impor

Re: multithreading

2012-04-07 Thread Bryan
Kiuhnm wrote: > My question is this: can I use 'threading' without interfering with the > program which will import my module? Yes. The things to avoid are described at the bottom of: http://docs.python.org/library/threading.html On platforms without threads, 'import threading' will fail. There's

Re: multithreading

2012-04-07 Thread Adam Skutt
On Apr 7, 5:06 pm, Kiuhnm wrote: > On 4/7/2012 22:09, Bryan wrote:>> For instance, let's say I want to make this > code thread-safe: > > >> ---> > >> myDict = {} > > >> def f(name, val): > >>       if name not in myDict: > >>           myDict[name] = val > >>       return myDict[name] > >> <--- >

Re: multithreading

2012-04-07 Thread Kiuhnm
On 4/7/2012 22:09, Bryan wrote: For instance, let's say I want to make this code thread-safe: ---> myDict = {} def f(name, val): if name not in myDict: myDict[name] = val return myDict[name] <--- First, don't re-code Python's built-ins. The example is a job for dict.setd

Re: multithreading

2012-04-07 Thread Bryan
Kiuhnm wrote: > I'm about to write my first module and I don't know how I should handle > multithreading/-processing. > I'm not doing multi-threading inside my module. I'm just trying to make > it thread-safe so that users *can* do multi-threading. There are a coup

multithreading

2012-04-07 Thread Kiuhnm
I'm about to write my first module and I don't know how I should handle multithreading/-processing. I'm not doing multi-threading inside my module. I'm just trying to make it thread-safe so that users *can* do multi-threading. For instance, let's say I want to m

Re: Multithreading

2011-12-26 Thread Ian Kelly
On Dec 26, 2011 4:13 PM, "Yigit Turgut" wrote: > Why is there N variable in write_data function ? N is related to > timer.tick(N) which is related to display function ? time.sleep(N) > will pause writing to file for specified amount of time which is > exactly what I am trying to avoid. My underst

Re: Multithreading

2011-12-26 Thread Yigit Turgut
On Dec 26, 10:01 pm, Ian Kelly wrote: > On Mon, Dec 26, 2011 at 11:31 AM, Yigit Turgut wrote: > > I have a loop as following ; > > > start = time.time() > > end = time.time() - start > >  while(end >          data1 = self.chan1.getWaveform() > >          end = time.time() - start > >          tim

Re: Multithreading

2011-12-26 Thread Ian Kelly
On Mon, Dec 26, 2011 at 1:13 PM, Yigit Turgut wrote: > I had thought the same workaround but unfortunately loop is already > under a def ; So nest the functions, or refactor it. Either way, that shouldn't be a significant obstacle. -- http://mail.python.org/mailman/listinfo/python-list

Re: Multithreading

2011-12-26 Thread Yigit Turgut
On Dec 26, 10:03 pm, Ian Kelly wrote: > On Mon, Dec 26, 2011 at 1:01 PM, Ian Kelly wrote: > > You essentially have two completely independent loops that need to run > > simultaneously with different timings.  Sounds like a good case for > > multiple threads (or processes if you prefer, but these

Re: Multithreading

2011-12-26 Thread Ian Kelly
On Mon, Dec 26, 2011 at 1:01 PM, Ian Kelly wrote: > You essentially have two completely independent loops that need to run > simultaneously with different timings.  Sounds like a good case for > multiple threads (or processes if you prefer, but these aren: I accidentally sent before I was finishe

Re: Multithreading

2011-12-26 Thread Ian Kelly
On Mon, Dec 26, 2011 at 11:31 AM, Yigit Turgut wrote: > I have a loop as following ; > > start = time.time() > end = time.time() - start >  while(end          data1 = self.chan1.getWaveform() >          end = time.time() - start >          timer.tick(10)  #FPS >          screen.fill((255,255,255)

Multithreading

2011-12-26 Thread Yigit Turgut
I have a loop as following ; start = time.time() end = time.time() - start while(endhttp://mail.python.org/mailman/listinfo/python-list

Re: Python Tutorial on Multithreading

2011-02-21 Thread Terry Reedy
On 2/21/2011 7:02 PM, KevinSimonson wrote: On Feb 21, 4:04 pm, Alexander Kapps wrote: That tutorial seems to be wrong. According to the official docs: "If the subclass overrides the constructor, it must make sure to invoke the base class constructor (Thread.__init__()) before doing anything

Re: Python Tutorial on Multithreading

2011-02-21 Thread KevinSimonson
On Feb 21, 4:04 pm, Alexander Kapps wrote: > > That tutorial seems to be wrong. > > According to the official docs: > > "If the subclass overrides the constructor, it must make sure to > invoke the base class constructor (Thread.__init__()) before doing > anything else to the thread." > > http://d

Re: Python Tutorial on Multithreading

2011-02-21 Thread Alexander Kapps
On 21.02.2011 23:30, KevinSimonson wrote: I've been teaching myself Python from the tutorial routed at "http:// www.tutorialspoint.com/python/index.htm". It's worked out pretty well, but when I copied its multithreading example from the bottom of the page at "http

Python Tutorial on Multithreading

2011-02-21 Thread KevinSimonson
I've been teaching myself Python from the tutorial routed at "http:// www.tutorialspoint.com/python/index.htm". It's worked out pretty well, but when I copied its multithreading example from the bottom of the page at "http://www.tutorialspoint.com/python/ python_multith

Re: How to initialize each multithreading Pool worker with an individual value?

2010-12-30 Thread Adam Tauno Williams
On Thu, 2010-12-30 at 08:01 -0800, Aahz wrote: > In article , > Valery Khamenya wrote: > >However it doesn't look possible to use it to initialize each Pool's > >worker with some individual value (I'd wish to be wrong here) > >So, how to initialize e

Re: How to initialize each multithreading Pool worker with an individual value?

2010-12-30 Thread Aahz
In article , Valery Khamenya wrote: > >However it doesn't look possible to use it to initialize each Pool's >worker with some individual value (I'd wish to be wrong here) > >So, how to initialize each multithreading Pool worker with the >individual values? &

Re: How to initialize each multithreading Pool worker with an individual value?

2010-12-02 Thread Valery
On Dec 1, 3:24 am, James Mills wrote: > I assume you are talking about multiprocessing > despite you mentioning "multithreading" in the mix. yes, sorry. > Have a look at the source code for multiprocessing.pool > and how the Pool object works and what it does > with

Re: How to initialize each multithreading Pool worker with an individual value?

2010-12-01 Thread Valery Khamenya
Hi Dan, > If you create in the parent a queue in shared memory (multiprocessing > facilitates this nicely), and fill that queue with the values in your > ports tuple, then you could have each child in the worker pool extract > a single value from this queue so each worker can have its own, unique

Re: How to initialize each multithreading Pool worker with an individual value?

2010-11-30 Thread James Mills
wrong here) > > So, how to initialize each multithreading Pool worker with the > individual values? > > The typical use case might be a connection pool, say, of 3 workers, > where each of 3 workers has its own TCP/IP port. > > from multiprocessing.pool import Pool > > def po

Re: How to initialize each multithreading Pool worker with an individual value?

2010-11-30 Thread Dan Stromberg
ish to be wrong here) > > So, how to initialize each multithreading Pool worker with the > individual values? > > The typical use case might be a connection pool, say, of 3 workers, > where each of 3 workers has its own TCP/IP port. > > from multiprocessing.pool impo

How to initialize each multithreading Pool worker with an individual value?

2010-11-30 Thread Valery Khamenya
Hi, multithreading.pool Pool has a promissing initializer argument in its constructor. However it doesn't look possible to use it to initialize each Pool's worker with some individual value (I'd wish to be wrong here) So, how to initialize each multithreading Pool worker with

Re: sqlite3, memory db and multithreading

2010-03-19 Thread królewna
W dniu 19.03.2010 12:10, Tim Golden pisze: Is it possible you've misunderstood the meaning of the word "serialize" here? It's not possible, it just happened :) What's being suggested isn't serialising (ie marshalling, pickling) the data; rather, serialising the *access*, ie pushing all db requ

Re: sqlite3, memory db and multithreading

2010-03-19 Thread Tim Golden
On 19/03/2010 10:56, królewna wrote: W dniu 18.03.2010 23:06, Aahz pisze: You probably need to serialize access to the database through one thread. sqlite3 objects are not pickable so it's not proper way. Is it possible you've misunderstood the meaning of the word "serialize" here? What's b

Re: sqlite3, memory db and multithreading

2010-03-19 Thread królewna
W dniu 19.03.2010 08:20, Expo pisze: You can put the SQLite database into a Singleton class and use a semaphore to serialize the access to methods which writes to the database. I've tried this out but doesnt work. Still gives an error like: ProgrammingError: SQLite objects created in a thread

Re: sqlite3, memory db and multithreading

2010-03-19 Thread królewna
W dniu 18.03.2010 23:06, Aahz pisze: You probably need to serialize access to the database through one thread. sqlite3 objects are not pickable so it's not proper way. -- best regards princess -- http://mail.python.org/mailman/listinfo/python-list

Re: sqlite3, memory db and multithreading

2010-03-19 Thread królewna
W dniu 18.03.2010 15:49, DreiJane pisze: Principally sqlite connections (sqlite3 objects in the C-API) can be used over multiple threads - and connections to :memory: make no difference. There are additional parameters to open() giving fine- tuned control. And apsw is promising a true reflection

Re: sqlite3, memory db and multithreading

2010-03-19 Thread Expo
On Mar 18, 1:58 pm, królewna wrote: > The problem is simple: I have multiple threads within one program. At > least 2 threads have to have access to in-memory sqlite database. It is > not possible to pass sqlite objects to those threads because an > exception is rised: > > ProgrammingError: SQLite

Re: sqlite3, memory db and multithreading

2010-03-18 Thread John Nagle
królewna wrote: The problem is simple: I have multiple threads within one program. At least 2 threads have to have access to in-memory sqlite database. It is not possible to pass sqlite objects to those threads because an exception is rised: ProgrammingError: SQLite objects created in a threa

Re: sqlite3, memory db and multithreading

2010-03-18 Thread Aahz
In article , =?UTF-8?B?a3LDs2xld25h?= wrote: > >The problem is simple: I have multiple threads within one program. At >least 2 threads have to have access to in-memory sqlite database. It is >not possible to pass sqlite objects to those threads because an >exception is rised: > >ProgrammingErr

Re: sqlite3, memory db and multithreading

2010-03-18 Thread DreiJane
Hello, i cannot help you directly with sqlite2 in the Standardlib, since i am used to work with Roger Binns's apsw. After a short experiment with pysqlite leading to data loss - caused by one of the unclearer exception messages of sqlite3 and me having a bad day - i at once turned back to apsw. An

sqlite3, memory db and multithreading

2010-03-18 Thread królewna
The problem is simple: I have multiple threads within one program. At least 2 threads have to have access to in-memory sqlite database. It is not possible to pass sqlite objects to those threads because an exception is rised: ProgrammingError: SQLite objects created in a thread can only be use

Re: multithreading, performance, again...

2010-01-18 Thread Oktaka Com
On 30 Aralık 2009, 17:44, mk wrote: > Hello everyone, > > I have figured out (sort of) how to do profiling of multithreaded > programs with cProfile, it goes something like this: > > #!/usr/local/bin/python > > import cProfile > import threading > > class TestProf(threading.Thread): >      def __i

Re: a huge shared read-only data in parallel accesses -- How? multithreading? multiprocessing?

2010-01-07 Thread Klauss
On Dec 31 2009, 6:36 pm, garyrob wrote: > One thing I'm not clear on regarding Klauss' patch. He says it's > applicable where the data is primarily non-numeric. In trying to > understand why that would be the case, I'm thinking that the increased > per-object memory overhead for reference-counting

Re: a huge shared read-only data in parallel accesses -- How? multithreading? multiprocessing?

2010-01-03 Thread garyrob
One thing I'm not clear on regarding Klauss' patch. He says it's applicable where the data is primarily non-numeric. In trying to understand why that would be the case, I'm thinking that the increased per-object memory overhead for reference-counting would outweigh the space gains from the shared m

Re: multithreading, performance, again...

2009-12-31 Thread Antoine Pitrou
> 39123 function calls (38988 primitive calls) in 6.004 CPU > seconds > [...] > > It's not burning CPU time in the main thread (profiling with cProfile > indicated smth similar to the above), it's not burning it in the > individual worker threads What do you mean, it's not b

multithreading, performance, again...

2009-12-30 Thread mk
Hello everyone, I have figured out (sort of) how to do profiling of multithreaded programs with cProfile, it goes something like this: #!/usr/local/bin/python import cProfile import threading class TestProf(threading.Thread): def __init__(self, ip): threading.Thread.__init__(sel

Re: a huge shared read-only data in parallel accesses -- How? multithreading? multiprocessing?

2009-12-26 Thread Valery
Hi Antoine On Dec 11, 3:00 pm, Antoine Pitrou wrote: > I was going to suggest memcached but it probably serializes non-atomic > types. It doesn't mean it will be slow, though. Serialization implemented > in C may well be faster than any "smart" non-serializing scheme > implemented in Python. No

Re: a huge shared read-only data in parallel accesses -- How? multithreading? multiprocessing?

2009-12-14 Thread Klauss
On Dec 11, 11:00 am, Antoine Pitrou wrote: > I was going to suggest memcached but it probably serializes non-atomic > types. Atomic as well. memcached communicates through sockets[3] (albeit possibly unix sockets, which are faster than TCP ones). multiprocessing has shared memory schemes, but doe

Re: a huge shared read-only data in parallel accesses -- How? multithreading? multiprocessing?

2009-12-11 Thread Antoine Pitrou
Le Wed, 09 Dec 2009 06:58:11 -0800, Valery a écrit : > > I have a huge data structure that takes >50% of RAM. My goal is to have > many computational threads (or processes) that can have an efficient > read-access to the huge and complex data structure. > > "Efficient" in particular means "withou

Re: a huge shared read-only data in parallel accesses -- How? multithreading? multiprocessing?

2009-12-10 Thread Valery
Hi Klauss, > How's the layout of your data, in terms # of objects vs. bytes used? dict (or list) of 10K-100K objects. The objects are lists or dicts. The whole structure eats up to 2+ Gb RAM > Just to have an idea of the overhead involved in refcount > externalization (you know, what I mentione

Re: a huge shared read-only data in parallel accesses -- How? multithreading? multiprocessing?

2009-12-10 Thread Klauss
On Dec 9, 11:58 am, Valery wrote: > Hi all, > > Q: how to organize parallel accesses to a huge common read-only Python > data structure? > > Details: > > I have a huge data structure that takes >50% of RAM. > My goal is to have many computational threads (or processes) that can > have an efficient

Re: a huge shared read-only data in parallel accesses -- How? multithreading? multiprocessing?

2009-12-09 Thread Aaron Watters
On Dec 9, 9:58 am, Valery wrote: > Hi all, > > Q: how to organize parallel accesses to a huge common read-only Python > data structure? Use a BTree on disk in a file. A good file system will keep most of the pages you need in RAM whenever the data is "warm". This works for Python or any other p

Re: a huge shared read-only data in parallel accesses -- How? multithreading? multiprocessing?

2009-12-09 Thread Emile van Sebille
On 12/9/2009 6:58 AM Valery said... Hi all, Q: how to organize parallel accesses to a huge common read-only Python data structure? I have such a structure which I buried in a zope process which keeps it in memory and is accessed through http requests. This was done about 8 years ago, and I

a huge shared read-only data in parallel accesses -- How? multithreading? multiprocessing?

2009-12-09 Thread Valery
Hi all, Q: how to organize parallel accesses to a huge common read-only Python data structure? Details: I have a huge data structure that takes >50% of RAM. My goal is to have many computational threads (or processes) that can have an efficient read-access to the huge and complex data structure.

Re: Problem with multithreading

2009-06-25 Thread MRAB
Jeffrey Barish wrote: [snip] Lou Pecora wrote: Try putting a flush in after the 2nd print statement in case the output is left in some I/O buffer when the thing terminates. e.g. import sys try: print 'in try" sys.stdout.flush() I was hoping for some suggestions of things

Re: Problem with multithreading

2009-06-25 Thread Jeffrey Barish
Lou Pecora wrote: > In article , > "larudwer" wrote: > >> "Jeffrey Barish" schrieb im Newsbeitrag >> news:mailman.2091.1245902997.8015.python-l...@python.org... >> > Jeffrey Barish wrote: >> > >> >> I have a program that

Re: Problem with multithreading

2009-06-25 Thread Lou Pecora
In article , "larudwer" wrote: > "Jeffrey Barish" schrieb im Newsbeitrag > news:mailman.2091.1245902997.8015.python-l...@python.org... > > Jeffrey Barish wrote: > > > >> I have a program that uses multithreading to monitor two loops. When >

Re: Problem with multithreading

2009-06-25 Thread larudwer
"Jeffrey Barish" schrieb im Newsbeitrag news:mailman.2091.1245902997.8015.python-l...@python.org... > Jeffrey Barish wrote: > >> I have a program that uses multithreading to monitor two loops. When >> something happens in loop1, it sends a message to loop2 to have

Re: Problem with multithreading

2009-06-24 Thread Scott David Daniels
Jeffrey Barish wrote: Jeffrey Barish wrote: print "about to try" try: print "in try" As I ponder this problem, I am beginning to believe that the problem is not related to multithreading. If the problem were due to a collision between the two threads then

Re: Problem with multithreading

2009-06-24 Thread Jeffrey Barish
Jeffrey Barish wrote: > I have a program that uses multithreading to monitor two loops. When > something happens in loop1, it sends a message to loop2 to have it execute > a command. loop2 might have to return a result. If it does, it puts the > result in a queue. loop1, meanwhile

Re: Problem with multithreading

2009-06-24 Thread Lie Ryan
Jeffrey Barish wrote: > I have a program that uses multithreading to monitor two loops. When > something happens in loop1, it sends a message to loop2 to have it execute > a command. loop2 might have to return a result. If it does, it puts the > result in a queue. loop1, meanwhile

Problem with multithreading

2009-06-24 Thread Jeffrey Barish
I have a program that uses multithreading to monitor two loops. When something happens in loop1, it sends a message to loop2 to have it execute a command. loop2 might have to return a result. If it does, it puts the result in a queue. loop1, meanwhile, would have blocked waiting for something

Re: multithreading in python

2009-05-12 Thread Almar Klein
See the standard help on the threading and thread module. Almar 2009/5/12 shruti surve : > hi, >  how to do multithreading in python??? Like running dialog box and running > xml rpc calls simultaneously??? > > > regards > shruti > > -- > http://mail.python.or

multithreading in python

2009-05-12 Thread shruti surve
hi, how to do multithreading in python??? Like running dialog box and running xml rpc calls simultaneously??? regards shruti -- http://mail.python.org/mailman/listinfo/python-list

Re: Multithreading / multiprocess

2009-04-12 Thread TennesseeLeeuwenburg
On Apr 12, 2:59 am, a...@pythoncraft.com (Aahz) wrote: > In article > <57065c62-2024-47b5-a07e-1d60ff85b...@y10g2000prc.googlegroups.com>, > > tleeuwenb...@gmail.com wrote: > > >Is there anyway to begin a thread and execute a finite number of lines > >of code, or a finite amount of time within it

Re: Multithreading / multiprocess

2009-04-12 Thread TennesseeLeeuwenburg
On Apr 11, 10:39 pm, "Diez B. Roggisch" wrote: > tleeuwenb...@gmail.com schrieb: > > > Is there anyway to begin a thread and execute a finite number of lines > > of code, or a finite amount of time within it? > > > For example, say I create three child threads and I want to guarantee > > equal tim

Re: Multithreading / multiprocess

2009-04-11 Thread Aahz
In article <57065c62-2024-47b5-a07e-1d60ff85b...@y10g2000prc.googlegroups.com>, tleeuwenb...@gmail.com wrote: > >Is there anyway to begin a thread and execute a finite number of lines >of code, or a finite amount of time within it? > >For example, say I create three child threads and I want to gua

Re: Multithreading / multiprocess

2009-04-11 Thread Diez B. Roggisch
tleeuwenb...@gmail.com schrieb: Is there anyway to begin a thread and execute a finite number of lines of code, or a finite amount of time within it? For example, say I create three child threads and I want to guarantee equal timeshare between them, can I specify a quanta (say 400 LOC although I

Multithreading / multiprocess

2009-04-11 Thread tleeuwenb...@gmail.com
Is there anyway to begin a thread and execute a finite number of lines of code, or a finite amount of time within it? For example, say I create three child threads and I want to guarantee equal timeshare between them, can I specify a quanta (say 400 LOC although I know that is pretty small) to exe

Re: Will multithreading make python less popular?

2009-03-05 Thread Hendrik van Rooyen
"Aahz" wrote: > In article , > Hendrik van Rooyen wrote: > >If Aahz was trolling, then he got me. I know about William of Occam, > >after whom the language was named, and his razor, but did not make the > >association, and answered seriously. > > Not trolling, but making a joke. Not always eas

Re: Will multithreading make python less popular?

2009-03-05 Thread Aahz
In article , Hendrik van Rooyen wrote: >"Ben Finney" wrote: >>a...@pythoncraft.com (Aahz) writes: >>> In article , >>> Hendrik van Rooyen wrote: Occam was the language that should have won the marketing prize, but didn't. >>> >>> It wasn't simple enough. >> >>*bdom-tsssh* http://en

Re: `high overhead of multiple Python processes' (was: Will multithreading make python less popular?)

2009-02-21 Thread Paul Rubin
Joshua Judson Rosen writes: > > Right, that's basically the issue here: the cost of using multiple > > Python processes is unnecessarily high. > What cost is that? The cost of messing with the multiprocessing module instead of having threads work properly, and the overhead of serializing Python

Re: `high overhead of multiple Python processes' (was: Will multithreading make python less popular?)

2009-02-21 Thread Joshua Judson Rosen
Paul Rubin writes: > > Right, that's basically the issue here: the cost of using multiple > Python processes is unnecessarily high. If that cost were lower then > we could more easily use multiple cores to make oru apps faster. What cost is that? At least on unix sy

Re: Will multithreading make python less popular?

2009-02-20 Thread rushenaly
I want to correct my last post where i said that there is not any intend to remove GIL from python. There is an intend actually i wish from a wizard :). On the pypy blog there is an explanation about gil and pypy "Note that multithreading in PyPy is based on a global interpreter lock,

Re: Will multithreading make python less popular?

2009-02-20 Thread Mensanator
On Feb 20, 4:36�am, sturlamolden wrote: > On Feb 20, 12:19 am, Mensanator wrote: > > > What am I actually seeing? If Python only uses one of the cores, > > why do both light up? > > Because of OS scheduling. You have more than one process running. The > Python process does not stay on one core. T

Re: Will multithreading make python less popular?

2009-02-20 Thread sturlamolden
On Feb 20, 12:19 am, Mensanator wrote: > What am I actually seeing? If Python only uses one of the cores, > why do both light up? Because of OS scheduling. You have more than one process running. The Python process does not stay on one core. Try to put CPython into a tight loop ("while 1: pass")

Re: Will multithreading make python less popular?

2009-02-20 Thread rushenaly
On 20 Şubat, 01:20, Paul Rubin wrote: > I would say, slow execution is a drawback that we put up with in order > to gain benefits of Python programming that are mostly unrelated to > the causes of the slowness.  The slowness itself can be addressed by > technical mea

Re: Will multithreading make python less popular?

2009-02-20 Thread Hendrik van Rooyen
"Steve Holden" wrote: > Perhaps it's time Python stopped being a dictatorship? This will need a wholesale switch to the worship of Freya - It is rumoured that She is capable of herding cats. - Hendrik -- http://mail.python.org/mailman/listinfo/python-list

Re: Will multithreading make python less popular?

2009-02-19 Thread Steven D'Aprano
Steve Holden wrote: > What Guido doesn't seem to have accepted yet is that slowing [C]Python > down by 50% on a single-processor CPU will actually be a worthwhile > tradeoff in ten years time, when nothing will have less than eight cores > and the big boys will be running at 64 kilo-cores. Ten ye

Re: Will multithreading make python less popular?

2009-02-19 Thread Steven D'Aprano
Paul Rubin wrote: > How old is your computer, why did you buy it, and is it the first one > you ever owned? > > For most of us, I suspect, it is not our first one, and we bought it > to get a processing speedup relative to the previous one. My computer is about eight months old, and I bought it

Re: Will multithreading make python less popular?

2009-02-19 Thread Steven D'Aprano
Steve Holden wrote: >> It's only an error if it gets in the way. It's the experience of a lot >> of programmers that it doesn't, so it's not an error. >> > And it's not a feature of the language, rather of one or two > implementations. Neither JPython not IronPython use a GIL to the best of > my

Re: Will multithreading make python less popular?

2009-02-19 Thread Tim Roberts
Paul Rubin wrote: > >C is basically never appropriate. C should be outlawed by Congress >with the ban enforced by roving pie-throwing squads . One of my favorite quotes: The last good thing written in C was Schubert's Ninth Symphony. -- Tim Roberts, t...@probo.

Re: Will multithreading make python less popular?

2009-02-19 Thread Benjamin Kaplan
On Thu, Feb 19, 2009 at 7:16 PM, Paul Rubin wrote: > Terry Reedy writes: > > > The slowness itself can be addressed by technical means, such as > > > native-code compilation and eliminating the GIL. > > > > Given that the GIL remains to make Python run faster in the usual (up > > to now, at leas

Re: Will multithreading make python less popular?

2009-02-19 Thread Steve Holden
Mensanator wrote: > On Feb 19, 7:18 pm, Steve Holden wrote: >> Mensanator wrote: >>> On Feb 19, 2:18 pm, Paul Rubin wrote: >> [...] >>> When I run I Python program, the Windows task manager shows both >>> cores running (usually a 60/40 split) for an overall 50% usage

Re: Will multithreading make python less popular?

2009-02-19 Thread Christian Heimes
Mensanator wrote: > I thought of that, but the usual Windows crap accounts for only a > couple percent prior to the Python program running. Christian Heimes > answer sounds more realistic. > > But what do I know? Be happy that your program makes use of both cores? :] You can restrict your progra

Re: Will multithreading make python less popular?

2009-02-19 Thread Mensanator
On Feb 19, 7:18 pm, Steve Holden wrote: > Mensanator wrote: > > On Feb 19, 2:18 pm, Paul Rubin wrote: > [...] > > When I run I Python program, the Windows task manager shows both > > cores running (usually a 60/40 split) for an overall 50% usage. > > > What am I actu

  1   2   3   >