Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Will multithreading make python less popular?

Reply
Thread Tools

Will multithreading make python less popular?

 
 
rushenaly@gmail.com
Guest
Posts: n/a
 
      02-16-2009
Hi everybody,
I am an engineer. I am trying to improve my software development
abilities. I have started programming with ruby. I like it very much
but i want to add something more. According to my previous research i
have designed a learning path for myself. It's like something below.
1. Ruby (Mastering as much as possible)
2. Python (Mastering as much as possible)
3. Basic C++ or Basic Java
And the story begins here. As i search on the net, I have found that
because of the natural characteristics of python such as GIL, we are
not able to write multi threaded programs. Oooops, in a kind of time
with lots of cpu cores and we are not able to write multi threaded
programs. That is out of fashion. How a such powerful language doesn't
support multi threading. That is a big minus for python. But there is
something interesting, something like multi processing. But is it a
real alternative for multi threading. As i searched it is not, it
requires heavy hardware requirements (lots of memory, lots of cpu
power). Also it is not easy to implement, too much extra code...

After all of that, i start to think about omiting python from my
carrier path and directly choosing c++ or java. But i know google or
youtube uses python very much. How can they choose a language which
will be killed by multi threading a time in near future. I like python
and its syntax, its flexibility.

What do you think about multi threading and its effect on python. Why
does python have such a break and what is the fix. Is it worth to make
investment of time and money to a language it can not take advantage
of multi cores?

Thank you...
Rushen
 
Reply With Quote
 
 
 
 
Andreas Kaiser
Guest
Posts: n/a
 
      02-16-2009
On 16 Feb., 10:34, rushen...@gmail.com wrote:
> Hi everybody,
> I am an engineer. I am trying to improve my software development
> abilities. I have started programming with ruby. I like it very much
> but i want to add something more. According to my previous research i
> have designed a learning path for myself. It's like something below.
> * * * 1. Ruby (Mastering as much as possible)
> * * * 2. Python (Mastering as much as possible)
> * * * 3. Basic C++ or Basic Java
> And the story begins here. As i search on the net, *I have found that
> because of the natural characteristics of python such as GIL, we are
> not able to write multi threaded programs. Oooops, in a kind of time
> with lots of cpu cores and we are not able to write multi threaded
> programs. That is out of fashion. How a such powerful language doesn't
> support multi threading. That is a big minus for python.


On comp.lang.ruby David Masover wrote this at 29 Jul. 2008, 07:55:
-----
Right now, Ruby shares a problem with Python called the GIL -- the
Global (or
Giant) Interpreter Lock. What this means is that only one Ruby
instruction
may execute at a time. So even though they're using separate OS
threads, and
even though different Ruby threads might run on different cores, the
speed of
your program (at least the Ruby part) is limited to the speed of a
single
core.
-----

Please don't mix threads and parallel processing on more then one CPU
core.

Andreas
 
Reply With Quote
 
 
 
 
Aleksa Todorovic
Guest
Posts: n/a
 
      02-16-2009
Hi, Rushen!

I'm also new to using Python but from what I've found, GIL is very
intentional decision. It is one of the features of Python which make
it so powerful. I believe that if it didn't have GIL, Python wouldn't
be half near where it is now (regarding it as a language, community,
platform support, popularity, ...).

The most important question is do you really need multi-threading for
what you do? There is lot of software which doesn't require mt at all,
or could be written without mt. Also, if you haven't learnt C++ or
Java yet, mt is not something you should be worried about in the near
future - there are lot of other, more important things, you need to
learn before opening door mt hell

Best,
Aleksa


On Mon, Feb 16, 2009 at 10:34, <> wrote:
> Hi everybody,
> I am an engineer. I am trying to improve my software development
> abilities. I have started programming with ruby. I like it very much
> but i want to add something more. According to my previous research i
> have designed a learning path for myself. It's like something below.
> 1. Ruby (Mastering as much as possible)
> 2. Python (Mastering as much as possible)
> 3. Basic C++ or Basic Java
> And the story begins here. As i search on the net, I have found that
> because of the natural characteristics of python such as GIL, we are
> not able to write multi threaded programs. Oooops, in a kind of time
> with lots of cpu cores and we are not able to write multi threaded
> programs. That is out of fashion. How a such powerful language doesn't
> support multi threading. That is a big minus for python. But there is
> something interesting, something like multi processing. But is it a
> real alternative for multi threading. As i searched it is not, it
> requires heavy hardware requirements (lots of memory, lots of cpu
> power). Also it is not easy to implement, too much extra code...
>
> After all of that, i start to think about omiting python from my
> carrier path and directly choosing c++ or java. But i know google or
> youtube uses python very much. How can they choose a language which
> will be killed by multi threading a time in near future. I like python
> and its syntax, its flexibility.
>
> What do you think about multi threading and its effect on python. Why
> does python have such a break and what is the fix. Is it worth to make
> investment of time and money to a language it can not take advantage
> of multi cores?
>
> Thank you...
> Rushen
> --
> http://mail.python.org/mailman/listinfo/python-list
>




--
Aleksa Todorovic - Lead Programmer
Eipix Entertainment
http://www.eipix.com/
 
Reply With Quote
 
Michele Simionato
Guest
Posts: n/a
 
      02-16-2009
On Feb 16, 10:34*am, rushen...@gmail.com wrote:
> Hi everybody,
> I am an engineer. I am trying to improve my software development
> abilities. I have started programming with ruby. I like it very much
> but i want to add something more. According to my previous research i
> have designed a learning path for myself. It's like something below.
> * * * 1. Ruby (Mastering as much as possible)
> * * * 2. Python (Mastering as much as possible)
> * * * 3. Basic C++ or Basic Java
> And the story begins here. As i search on the net, *I have found that
> because of the natural characteristics of python such as GIL, we are
> not able to write multi threaded programs. Oooops, in a kind of time
> with lots of cpu cores and we are not able to write multi threaded
> programs. That is out of fashion. How a such powerful language doesn't
> support multi threading. That is a big minus for python. But there is
> something interesting, something like multi processing. But is it a
> real alternative for multi threading. As i searched it is not, it
> requires heavy hardware requirements (lots of memory, lots of cpu
> power). Also it is not easy to implement, too much extra code...


multiprocessing is already implemented for you in the standard
library.
Of course it does not require heavy hardware requirements.

> After all of that, i start to think about omiting python from my
> carrier path and directly choosing c++ or java. But i know google or
> youtube uses python very much. How can they choose a language which
> will be killed by multi threading a time in near future. I like python
> and its syntax, its flexibility.
>
> What do you think about multi threading and its effect on python. Why
> does python have such a break and what is the fix. Is it worth to make
> investment of time and money to a language it can not take advantage
> of multi cores?


You can take advantage of multi cores, just not with threads but with
processes,
which BTW is the right way to go in most situations. So (assuming you
are not
a troll) you are just mistaken in thinking that the only way to
use multicores is via multithreading.

Michele Simionato
 
Reply With Quote
 
Tim Rowe
Guest
Posts: n/a
 
      02-16-2009
2009/2/16 <>:
> Hi everybody,
> I am an engineer. I am trying to improve my software development
> abilities. I have started programming with ruby. I like it very much
> but i want to add something more. According to my previous research i
> have designed a learning path for myself. It's like something below.
> 1. Ruby (Mastering as much as possible)
> 2. Python (Mastering as much as possible)
> 3. Basic C++ or Basic Java
> And the story begins here. As i search on the net, I have found that
> because of the natural characteristics of python such as GIL, we are
> not able to write multi threaded programs. Oooops, in a kind of time
> with lots of cpu cores and we are not able to write multi threaded
> programs. That is out of fashion. How a such powerful language doesn't
> support multi threading. That is a big minus for python.


In a way, you've answered your own question. Why are you learning
three languages? Perhaps you've already realised that being
Turing-complete isn't the last word in language choice; that different
languages make different compromises, so the best language for one
task may not be the best language for a different task. Ok, Python
doesn't cope well with threading. It doesn't cope well with hard
real-time, either. So what? A deep saucepan isn't much use for making
an omlette (it can be done, but it's inefficient), but it's ideal for
making soup. Just because multiple cores are available doesn't mean
they will help your program significantly. Most real-world programs
work just fine in a single core, and it usually just isn't worth all
of the extra design effort, coding effort and debugging effort of
threading to cut the user response time down from a tenth of a second
to a twentieth. For *most* applications the single-thread Python
programmer will have something written, shipped and doing the job
whilst the multi-thread programmer is still trying to debug an
intermittent livelock that goes away whenever instrumentation is
added. For those few cases where threading is a genuine advantage,
Python is not ideal. But in the real world I doubt they're enough to
make a significant dent in Python's popularity.

--
Tim Rowe
 
Reply With Quote
 
rushenaly@gmail.com
Guest
Posts: n/a
 
      02-16-2009
Hi again,

Dear Andreas

I know about GIL in ruby interpreter, they are trying to solve
problems because of GIL but it is not so important for me because i
like ruby because of its esthetic and it helps me to grasp some
programming concepts. As i know it is not so powerful language like
java. (Powerful language : rich libraries, wide community, very
variety of usage). why i want to learn python because it has syntax
like ruby but it is also powerful language, not of course as much as
java or c++

And also, i am trying to find an answer to the question mark in my
head. Is there a way to use multi cores in python as much effective
and easier as multi threading.

Dear Aleksa

Of course i have a long way to ago even if i am too old for these
things. However, i think that being able to use both cores or more is
a very big plus for execution time, speed like these. I believe many
programs will be rewritten to be able to use multiple cores.

Dear Michele

As i know every process has own hardware sources like memory and cpu
so i think it requires more source than multi threading.

Dear Tim

I want to learn python + c++ or java because of the desire of having
python's felxibility and easiness and c++ or java's stability and
speed and power together.

Thank you
Rushen



 
Reply With Quote
 
Tim Rowe
Guest
Posts: n/a
 
      02-16-2009
2009/2/16 <>:

> I want to learn python + c++ or java because of the desire of having
> python's felxibility and easiness and c++ or java's stability and
> speed and power together.


Yes, that's what I mean by different tradeoffs. Python is much easier
to program in than C++ or Java (in my experience, at least), but C++
and Java scale better and at least have the potential to be faster.
I'm not convinced that library support is significantly better for C++
or Java -- Python's libraries seem pretty rich to me. And that extra
speed might not be needed as often as you think. My postgrad
dissertation involved heavy number-crunching on large data sets, and
in my proposal I said I'd switch from Python to C++ when Python got
too slow. In fact, Python never did get too slow (I didn't even have
to switch to numpy), and plugging together ad-hoc modules, defined in
an XML script, was a dream in Python when I'd probably still be coding
it today in C++. Horses for courses. It's almost always wrong to say
that language A is better than language B; the most you can say is
that language A is better than language B for some specific task.


--
Tim Rowe
 
Reply With Quote
 
rushenaly@gmail.com
Guest
Posts: n/a
 
      02-16-2009
Dear Andrew,

I think reading "beating the averages" by paul graham before some
experience is not a very good decision.


Thank you
Andrew
 
Reply With Quote
 
Aleksa Todorovic
Guest
Posts: n/a
 
      02-16-2009
Or the other way around

Little off-topic, but...

After several months of fighting with Java threads, dead locks, live
locks, race conditions, I've rewritten my game server synchronization
so that threads are executed in concurrent way (with only exceptions
being socket sending and recieving threads), and all synchronization
is implemented on top of Java blocking structures (little blasphemy:
the way Stackless does it). After that change, the game suddenly
started working like a charm!


On Mon, Feb 16, 2009 at 13:24, <> wrote:
> Of course i have a long way to ago even if i am too old for these
> things. However, i think that being able to use both cores or more is
> a very big plus for execution time, speed like these. I believe many
> programs will be rewritten to be able to use multiple cores.




--
Aleksa Todorovic - Lead Programmer
Eipix Entertainment
http://www.eipix.com/
 
Reply With Quote
 
rushenaly@gmail.com
Guest
Posts: n/a
 
      02-16-2009
Dear Aleksa,

As you mentioned, using multi cores makes programs more fast and more
popular. But what about stackless python? Does it interpret same set
of python libraries with Cpython or Does it have a special sub set?

Thank you
Rusen
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
More Efficiency,More Benefit,Less Risk,Less Work! jiajia wu ASP .Net 0 10-01-2009 01:50 PM
More Efficiency,More Benefit,Less Risk,Less Work! lllll Ruby 0 06-08-2009 02:10 PM
More Efficiency,More Benefit,Less Risk,Less Work! 6668 Ruby 0 05-14-2009 12:33 AM
Python multithreading on cluster system? Embedding python in PVM? abhinav Python 1 02-19-2006 08:42 PM
Re: any ideas on how to make this page smaller (less bytes)? Kris HTML 1 02-06-2004 11:53 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57