I've learned. I'll share.

October 14, 2008

The manycore era is already upon us (and python isn't keeping up)

For many months, perhaps years, we as programmers have realized our trouble ahead coming with the "manycore era". The attitude seems to be "someday we're really going to have to figure this concurrency thing out". But this month I have been hit with a terrible realization: the manycore era is already upon us. Technically, it's the "multicore", not "manycore", but I think that's a small distinction.

Why the sudden epiphany? A few weeks ago, I built my self a new computer and put in an Intel quad-core CPU. My computer is much faster now, and I'm very happy with it, but after a few weeks I have realized something: I never use more than 1/4 of my CPU. I have a little graph on my screen at all times showing me the CPU usage. It goes up to 25% all of the time, but I have never seen it go higher. Ever.

On one hand this is a good thing. The new computer is so fast that everything I do is instant, and only uses a tiny bit of power. If it isn't instant, it's usually disk or network bound, not CPU bound.

On the other hand, even my own software isn't using more than 25%, and it is CPU bound at times. I'd like to fix it, but it's written in python, and the short version of a long, boring story is that python has a thing called The GIL which makes it so python as currently implemented cannot use more than 25% of the CPU except under very rare circumstances.

It seems that programming languages takes a long time to be adopted, but I think concurrency is a big enough rule changer to shake up which programming languages are dominant. In my specific case, if python doesn't fix it's concurrency problems soon, I'm going to have to stop considering it because I'll never be able to get it to use more than 1 little piece of the CPU. Right now, that's 25%, but in a few years, it will be only 3%. Either python is going to have to change, or I'm going to have to change programming languages (or use something like Jython or IronPython, I suppose).

A few weeks ago, sitting behind my single core computer, I was in the "someday, we'll have to tackle concurrency" camp. Now, sitting in front of my quad core machine, never using more than 25% of its power, everything has changed. Concurrency is no longer a question of if or when, it's here right now. If you don't believe me, get yourself a quad-core machine and watch the CPU usage graph. I think you'll be surprised.

51 comments:

  1. It's worth taking a look at the "processing" module, which was renamed the "multiprocessing" module and put into Python 2.6. It provides a concurrency model that avoids the GIL by forking and using pipes and shared memory. Sure, that's a little ugly under the hood, but (multi)processing wraps it up in a nice looking API:

    multiprocessing documentation

    ReplyDelete
  2. Mark Shuttleworth brought this up in his Keynote at Pycon UK and the reaction seemed to fall into 3 camps.

    1. Who cares?
    2. Just spawn out processes and use processing.
    3. I want threads, stop telling me how to design my app, aka Processes are too heavyweight on Windows.

    I guess there are people out there in camp 3 who need threads, not processes, and just can't live with the GIL. As Stan mentioned those in camp 2 have a solution, but it seems more like a workaround than a solution :(

    I have a recollection of a patch being posted that seemed to work on multi-core machines, but ran slower on single core machines and so was scrapped. When single-core becomes the exception, it may be that it is revisited, but who knows?

    ReplyDelete
  3. I may have to try using multiple processes. I had seen that module before but didn't realize it was so complete. Thanks for the tip.

    But can we all agree that's really a kludge? It sounds a lot like when Java people defend not having first-class functions by saying "just use an interface". Sure, it's possible. But it's ugly and no fun.

    ReplyDelete
  4. I agree, the whole multicore thing has been out for a while now and I'm yet to see anyone address it with much thought.

    ReplyDelete
  5. I just ran into this myself, I was working on a project that is very cpu bound, but also very parallel. I could run 1000 threads if my system would not grind to a halt doing so.

    But, no matter what I set the thread count to, python only uses 25%.

    I will have to continue looking into options, but I may just have to run 4 copies of the program to allow me to access the full power of my system for now.

    ReplyDelete
  6. Not to say this approach is the be-all, end-all for multi-core work, but good ol' process spawning gets a lot of real work done, fairly easily, without changing the way I have to work.

    Too bad Blogger is brain dead about pre tags, but for example here's 75% (approx) of each core being used; I think I needed to put more load on this web app to jam it up to 100% total:

    CPU %user %nice %sys
    all 60.44 0.00 13.24
    0 62.35 0.00 13.53
    1 55.88 0.00 13.53
    2 62.35 0.00 11.76
    3 60.82 0.00 14.62

    What I like about this is I can get incredible - by the standards of just a few years ago - amount of processing done, with commodity hardware, without radically changing how I have to develop.

    Again, I'm not suggesting there isn't room for improvement... and some folks will be forced to by their own needs and circumstances. But it isn't all bad that not *everyone* has to.

    ReplyDelete
  7. Shuttleworth is half-right. 2 and 3 aren't mutually exclusive.

    Threads are important when scaling vertically and specially in the cloud environment where you pay per cpu/mem it's invaluable.

    Process are better when scaling horizontally, but that's a better solution for really big applications.

    I think both are necessary and as long as there are tools that allow me to abstract the scaling strategy I'm fine.

    ReplyDelete
  8. Thankyou so much for this detailed information, keep up the good work. Here is the link of my website Modern Home Designs

    ReplyDelete
  9. 8 Ball Pool doesn't highlight lush client inerface nor reasonable sounding BGMs, however it gives the most valid pool eight ball standard gaming experience. You can play with PC in various troubles or play with online rivals, the last one requires facebook sign in. It's an allowed to play game, yet you can at present go through genuine cash to get selective tables and signals.

    ReplyDelete
  10. Pakistan has made its Kirkri by and by on the issue of Jammu and Kashmir. While supporting Pakistan, China attempted to get the help of different nations in the United Nations Security Council (UNSC) on the Kashmir issue, yet the issue didn't appear. On this bombed endeavor of China, different nations said that Kashmir is a respective issue of India and Pakistan.

    ReplyDelete
  11. Gonorrhoea Treatment for the most part happen inside two to 14 days after introduction. Be that as it may, a few people contaminated with gonorrhea never create recognizable side effects.

    ReplyDelete
  12. Buy Instagram likes from Buzzoid for as little as $1.49. Instant delivery, real likes and friendly 24/7 customer support. Try us today.

    ReplyDelete
  13. The number 1 online football betting website UFABET is the most popular service in Thailand. Official, online sports betting and all types of casinos. The entrance to UFABET can be played through the website or on the mobile phone. Iphone (iPhone) or Android (Android), which has a safe and professional, reliable and With standards to support Online football betting Through the internet and online casinos that have a variety of games to choose from to play.

    ReplyDelete
  14. 8 Ball Pool, an online multiplayer game, which was propelled in 2010, is the top netting game on Google PlayStore and IOS Appstore. It offers players a vivid gaming experience on their gadgets. At first the game was discharged for PC just, however later it was presented on cell phones.

    ReplyDelete
  15. Humbert Humbert klasik eski okul, edebiyatta beyefendi tadı ve diğer entelektüel tutkuları olan bir profesördür. Yeni bir dulla tanıştığında, genç, güzel ve baştan çıkarıcı kızı Lolita'ya yakın olmak Web siteleri için onunla evlenir.

    ReplyDelete
  16. UFA007 is one of the best online Betting Casino which can help you earn money.
    .
    You can gamble on your favorite sports such as Football, Baccarat, and more. You get all the categories games under the categories and the entire platform is supervised by UFABET.
    .
    Get your money in 24-hours with the 30-second automatic system. Meet the real players and win the game.

    ReplyDelete
  17. Looking for the Best 55 inch TV in India?
    .
    We at NiamIndia covers Best 55 inch Smart TV including the Buying Guide of the product here:- https://www.niamindia.org/best-55-inch-tv-in-india/

    ReplyDelete
  18. I am professional Gamer working for Foriza Horizon as a Senior Consultant. i love to Play Games on my PC. Here is the Best Vertical Monitor.

    ReplyDelete
  19. I am professional Gamer working for Foriza Horizon as a Senior Consultant. i love to Play Games on my PC. Here is my Blog How to Use Discord on PS4.

    https://nationalhelm.co/how-to-use-discord-on-ps4/

    ReplyDelete
  20. Are you looking for the Top Rated Bluetooth Speakers under 50? . Well,Best Bluetooth speakers under 50? Quality speakers are expensive! Having good speakers will drain my pockets. Here are the unbiased reviews and buying guide for Top Rated Bluetooth Speakers under 500.

    ReplyDelete
  21. I would like to thank you for the efforts you have made in writing this informative article , because , this post can help out to the students when they are facing a lot of troubles in their studies. Keep continue to share informative posts with us. Assignment Writing Service

    ReplyDelete
  22. Such an useful info that you shared with us.
    Indian Embassyrome/. A place to find the right choice.

    ReplyDelete
  23. Very interesting, good job and thanks for sharing such a good blog, If you wanna know Skin Care Tips check. My blog

    ReplyDelete
  24. You shared a very nice piece of information, Also check Health Club

    ReplyDelete
  25. It's great! Thank you so much for sharing! Check out Trending Winter Outfit Ideas For Men & Women..

    ReplyDelete
  26. Express yourself. It's hard to be nice if you don't feel comfortable. Shop Your Style.!!

    ReplyDelete
  27. Can I simply say what a relief to uncover a person that really understands what they're discussing on the web. You definitely know how to bring an issue to light and make it important. More and more people have to look at this and understand this side of your story. I was surprised that you are not more popular given that you most certainly have the gift.

    Buy 100 Instagram Views

    ReplyDelete
  28. Your blogs are amazing. Keep sharing. I love them Are you also searching for urgent assignment help? we are the best solution for you. We are best known for delivering the best urgent assignment help.

    ReplyDelete
  29. Good blog. I learned a lot from this blog. Are you also searching for University Assignment Help ? we are the best solution for you. We are best known for delivering cheap essays to students without having to break the bank

    ReplyDelete
  30. new computer is so fast that everything Help Me with My Homework do is instant, and only uses a tiny bit of power. If it isn't instant, it's usually disk or network bound.

    ReplyDelete
  31. 토토사이트
    배트맨토토
    토토


    i like reading.I have learned a lot which i did not know before.Keep posting more similar content

    ReplyDelete
  32. After going over a few of the blog posts on your web page,
    I honestly like your way of writing a blog. I book-marked it to my bookmark webpage list and will be checking back soon. Take a look at my
    web site too and let me know how you feel.

    스포츠토토
    먹튀검증
    토토

    ReplyDelete
  33. Does your site have a contact page? I'm having problems locating it but,
    I'd like to shoot you an email. I've got some recommendations for your blog you might be interested in hearing.
    Either way, great site and I look forward to seeing it develop over time.

    스포츠중계
    해외스포츠중계
    스포츠토토

    ReplyDelete
  34. Basically technical multicore is not manycore, but I think that's a small distinction

    ReplyDelete
  35. Good blog. I learned a lot from this blog. Please keep it up and share more content with us. I will share this site with my friends. Now it's time to avail Limo service West Palm Beach for more information.

    ReplyDelete
  36. Traffic Lawyer Manassas VA
    "The Manycore Era is Already Upon Us (and Python Isn't Keeping Up)" is a critical analysis of Python's struggle to adapt to the rapidly evolving landscape of manycore processors. The author highlights the gap between hardware advancements and Python's ability to fully leverage these capabilities. The review critiques Python's limitations, particularly in optimizing code for parallel processing, and offers valuable insights into the gap between hardware innovation and Python's capacity to harness modern processors effectively. The article emphasizes the need for Python developers to adapt and optimize their code to fully utilize the power of manycore processors, emphasizing the need for a proactive approach within the Python community. The review prompts discussions about the future of programming languages in the context of rapidly advancing hardware and urges developers and the Python community to embrace innovative techniques and explore new avenues to bridge the existing gap.

    ReplyDelete
  37. The "manycore era" refers to a time in computing where processors with a large number of cores, or processing units, are becoming increasingly common. This shift has been driven by the need for greater processing power, especially in fields like scientific computing, data analytics, and artificial intelligence. While Python is a popular and versatile programming language, it does face certain challenges in the context of the manycore era. Python is an interpreted language, which means it may not be as efficient in taking advantage of all the available cores in a multi-core processor compared to lower-level languages like C++ or Rust. Python's Global Interpreter Lock (GIL) can further limit its ability to efficiently utilize multiple cores, as it restricts concurrent execution of threads in a single Python process.
    charlottesville virginia personal injury lawyers

    ReplyDelete
  38. The manycore era" likely refers to a period in computer architecture characterized by the proliferation of manycore processors. Manycore processors have a large number of cores on a single chip, enabling parallel processing of tasks. This term is often associated with advancements in high-performance computing and the development of processors with numerous cores to enhance computational power.
    motorcycle accident

    ReplyDelete
  39. virginia beach motorcycle accident attorney
    The article discusses Python's struggle to adapt to the manycore era, highlighting its limitations in utilizing modern hardware. It emphasizes the need for programming languages to optimize for these architectures. The article suggests that specific examples or case studies could have strengthened the argument and provided more concrete evidence. It also suggests exploring alternative programming languages better suited for manycore systems. The article raises concerns about Python's compatibility with the manycore era and prompts further discussion on the future of programming languages in harnessing modern hardware's power.

    ReplyDelete
  40. Amazing, Your blogs are really good and informative. I got a lots of useful information in your blogs. It also suggests exploring alternative programming languages better suited for manycore systems. The article raises concerns about Python's compatibility with the manycore era and prompts further discussion on the future of programming languages in harnessing modern hardware's power semi truck accident attorney. It is very great and useful to all. Keeps sharing more useful blogs...

    ReplyDelete
  41. I’m sure everyone will appreciate this interesting post here. thanks

    ReplyDelete
  42. It’s very informative blog in this area. Continue writing man! Keep it up.. Thanks

    ReplyDelete
  43. I am impressed with this blog work and skill you made. Thank you so much.

    ReplyDelete
  44. Very useful post. This is my first time visit here and its nice, Keep it up

    ReplyDelete
  45. Glad that you shared this helpful info with us. Many thanks, I support you!

    ReplyDelete

Blog Archive

Google Analytics