Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder2.hal-mli.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.067 X-Spam-Evidence: '*H*': 0.87; '*S*': 0.00; 'algorithm': 0.03; 'suggestions.': 0.09; 'threads,': 0.09; 'languages.': 0.15; 'magnitude.': 0.16; 'partly': 0.16; 'subject:Problem': 0.16; 'threads': 0.16; 'tradeoffs': 0.16; 'wrote:': 0.17; 'implementing': 0.17; 'header:In-Reply-To:1': 0.25; 'header:User- Agent:1': 0.26; 'networked': 0.29; "i'm": 0.29; 'code': 0.31; 'running': 0.32; 'could': 0.32; 'to:addr:python-list': 0.33; 'so,': 0.35; 'pm,': 0.35; 'subject:with': 0.36; 'possible': 0.37; 'why': 0.37; 'subject:: ': 0.38; 'some': 0.38; 'sure': 0.38; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'received:192.168': 0.40; 'your': 0.60; 'different': 0.63; 'prime': 0.65; 'header:Reply-To:1': 0.68; 'received:74.208': 0.71; 'reply-to:no real name:2**0': 0.72; 'goals,': 0.91; 'processes,': 0.93; 'hand,': 0.97 Date: Wed, 19 Dec 2012 13:23:37 -0500 From: Dave Angel User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121011 Thunderbird/16.0.1 MIME-Version: 1.0 To: python-list@python.org Subject: Re: Problem with Threads References: <0c84b88a-bb71-4ccd-bd96-a3a3414a8e6b@googlegroups.com> In-Reply-To: <0c84b88a-bb71-4ccd-bd96-a3a3414a8e6b@googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Provags-ID: V02:K0:u+dgvBGEXdOjDehmYX7LN6fzWSG5FZwg8BkcSTUAaQm b7YYlPeTrSCbjAc6SxZTVHkHYF7o5mSu+zSVFiWYdanSeY4i2q gsP0RAhaWBDDXPlCX9GcKwQB5tEdRELYS1e5yaF/vqFEuONFNM NKDUc2TUu7Z28JZkY45SMidJ7ps7WU/WbfMzAB8KaKL/4QnJVb pO2vbmRAS2Drb9btLPG+y9FVYmq5EdrWxBKkTktmBOQt5agxL1 nAriULTkRtrVHLj50/ZJ/Ibhq/iGGo/cpBTd1gCKpb1JRxIc1T g/KquxJKG5/HqSEKAEJSpcSY9JWLKVv6j6nb6mKOXIiBZCdhQ= = X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: d@davea.name List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 25 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1355941437 news.xs4all.nl 6916 [2001:888:2000:d::a6]:51033 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:35146 On 12/19/2012 12:11 PM, Kwnstantinos Euaggelidis wrote: > I have this code for Prime Numbers and i want to do it with Threads.. Any idea.?? Why do you want to do it with threads? Is it to speed up the processing? (Guessing that partly because of your printing "elapsed time." Chances are running this code in multiple threads will be substantially slower. If you want speed, you could speed up the algorithm by a few orders of magnitude. Ask for suggestions. On the other hand, you might be interested in deciding/discussing the tradeoffs of implementing an arbitrary algorithm serially or in parallel, using multiple threads, and/or multiple processes, and/or multiple networked computers, and/or different possible languages. So, if you give us some ideas about your goals, I'm sure many people have ideas to share. -- DaveA