473,398 Members | 2,404 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,398 software developers and data experts.

Re: GIL cpu multi core usage problem

En Mon, 09 Jun 2008 15:26:09 -0300, Pau Freixes <pf******@gmail.com>
escribió:
Surly this is a recurring theme into python dev world, but I need your
help
for confirm if the follow image it's really

http://www.milnou.net/~pfreixes/img/cpu_usage_gil_problem.png<http://www.milnou.net/%7Epfreixes/img/cpu_usage_gil_problem.png>

I'm writing a brief article for my blog and I need to make sure about the
current problem with GIL and multi core environments, this picture try to
explain with images the problem for scheduling multiple threads running
python code of same interpreter into multiple cpu cores. Can anyone
confirm
to me this picture ?
Yes, if both threads are executing pure Python code, they can't run
simultaneously.

Note that:
- C extensions (usually) release the GIL when they don't call into any
Python code
- The interpreter also releases the GIL before any I/O operation
If the process is I/O bound then the GIL is not so important, and if it's
CPU bound you may benefit from reimplementing the critical parts in C (by
example, using NumPy for a number-crunching process). Another alternative
is to use multiple processes with some form of IPC instead of multiple
threads.
These are the usual arguments against "fear of GIL". You should consider
your specific application to see if the GIL is actually a problem in your
case or not.

--
Gabriel Genellina

Jun 27 '08 #1
0 1070

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

Similar topics

37
by: ajikoe | last post by:
Hello, Is anyone has experiance in running python code to run multi thread parallel in multi processor. Is it possible ? Can python manage which cpu shoud do every thread? Sincerely Yours,...
4
by: Martinfnp | last post by:
Hello all, I'm completely new in theory of C compiler and it's support for multi-core hardware. Does anybody know whether compiler for multi-core and SMP/AMP/BMP does need some special internal...
3
by: Doug | last post by:
I'm having problems w/ the VS2005 debugger with C#. It blows past any breakpoints in even the simplest "Hello World" console application. I can't do any step-by-step debugging. I've provided the...
5
by: shumaker | last post by:
I just read an overview of C# 3.0, and it occured to me that some of these features could make it much easier to write programs that automatically make use of multi core processors. After reading...
5
by: Coaster | last post by:
I am designing a process which will spawn a good number of threads and some of them will execute a c++ process which is quite memory intensive (although not multithreaded). This will run on a 2 cpu...
0
by: Sabri.Pllana | last post by:
We apologize if you receive multiple copies of this call for papers. *********************************************************************** 2008 International Workshop on Multi-Core Computing...
3
by: 06michwats | last post by:
hello i have a windows vista pc with a dual core pentium 1.8ghz processor and 2 GB of ram some times randomly when i'm working the cpu usage will change to 50% all on one core (so one core is at...
3
by: Fred | last post by:
We all agree that multi-core is where the industry is headed. Can the .NET framework take advantage of multi-cores? are the programs written in .NET multi-threaded by default or is additional...
1
by: =?Utf-8?B?U29sb1NFTw==?= | last post by:
Windows Vistaâ„¢ Ultimate 32BIT Version 6.0.6001 Service Pack 1 Build 6001 System Manufacturer HP Pavilion 061 System Model EG194AA-ABA A1250N System Type X86-based PC Processor AMD Athlon 64 X2...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.