473,804 Members | 2,109 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

(no subject)

Ype writes:
For the namespaces in Jython this 'Python internal thread safety'
is handled by the Java class:

http://www.jython.org/docs/javadoc/o...StringMap.html

which has almost all of it public methods Java synchronized:

http://cvs.sourceforge.net/viewcvs.p...re/PyStringMap.
java
Thinking about it: is this the Jython parallel of CPython's
Global Interpreter Lock, the famous GIL?


No.

The GIL has the unfortunate disadvantage that it prevents multiple
processor machines (or other modern architechures) from processing
multiple bytecodes simultaneously in different threads. Jython does
not have this limitation.

-- Michael Chermside
Jul 18 '05 #1
4 4569
Michael Chermside wrote:
The GIL has the unfortunate disadvantage that it prevents multiple
processor machines (or other modern architechures) from processing
multiple bytecodes simultaneously in different threads. Jython does
not have this limitation.


Michael,

That's the first definitive statement I've ever read about Jython not
being limited by a GIL on multi-processor machines.

Would the following statements be correct?

1. CPython has a Global Interpreter Lock (GIL), which allows only one
thread to execute python code at a time. This "macro-level" of locking
was chosen because empirical evidence from experimental
implementations (a long time ago, in a galaxy far, far, away) showed
that it gave better performance than approaches using more
fine-grained locking, i.e. object-level locking.

2. Jython is implemented on top of java, which has built-in support
for fine-grained locking of individual objects. Therefore, the jython
implementers chose not to use a GIL, but instead to rely on the
fine-grained locking facilities of the Java platform to protect object
integrity. So jython programs support simultaneous execution of
multiple jython threads on multiple processors (obviously assuming the
Java VM on which it is running is capable of migrating threads to
other processors).

I know I could find out the answer to this question by going directly
to the jython source, but I unfortunately don't have the time. Also, I
don't actually *need* to know the answer, since I haven't yet needed
the horsepower of a mutli-processor box. But the question is
theoretically interesting, and probably of practical interest to many
readers of c.l.py.

And if the above statements are true, then I'm sure we're going to see
an interesting discussion of why fine-grained locking is fast enough
in java, but not fast enough in C >;-)

regards,

--
alan kennedy
-----------------------------------------------------
check http headers here: http://xhaus.com/headers
email alan: http://xhaus.com/mailto/alan
Jul 18 '05 #2
Alan Kennedy wrote:

Would the following statements be correct?
1. [snip]
2. Jython is implemented on top of java, which has built-in support
for fine-grained locking of individual objects. Therefore, the jython
implementers chose not to use a GIL, but instead to rely on the
fine-grained locking facilities of the Java platform to protect object
integrity.


You seem to think there is a "Jython runtime interpreter" in the same
way there is one for CPython... Are you aware that Jython compiles
your Python source to Java bytecode?

-Peter
Jul 18 '05 #3
Alan Kennedy:
Would the following statements be correct?

1. CPython has a Global Interpreter Lock (GIL), which allows only one
thread to execute python code at a time. This "macro-level" of locking
was chosen because empirical evidence from experimental
implementations (a long time ago, in a galaxy far, far, away) showed
that it gave better performance than approaches using more
fine-grained locking, i.e. object-level locking.


I suspect it was done first because it was the easiest to do. Then
there was the free-threaded version, which provided the empirical
evidence.

Andrew
da***@dalkescie ntific.com
Jul 18 '05 #4
[Alan Kennedy]
Jython is implemented on top of java, which has built-in support
for fine-grained locking of individual objects. Therefore, the jython
implementers chose not to use a GIL, but instead to rely on the
fine-grained locking facilities of the Java platform to protect object
integrity.

[Peter Hansen] You seem to think there is a "Jython runtime interpreter" in the same
way there is one for CPython... Are you aware that Jython compiles
your Python source to Java bytecode?


Compiles it to Java bytecode, which makes calls against a python
runtime which has been implemented in Java .....

All calls into the jython runtime require that the code execution be
associated with a PySystemState object, which keeps track of
"interprete r state" for the context in which the code is running
.......

http://www.jython.org/docs/javadoc/o...stemState.html

So jython bytecode *is* executed by a jython interpreter, which is an
interpreter in all but name ......

The last link in the chain is the PythonInterpret er object, which
wraps the above, and provides some simple services to simplify using
the "interprete r".

http://www.jython.org/docs/javadoc/o...terpreter.html

From what I can see, jython has pretty much, class for class, the same
structure as the cpython interpreter .....

--
alan kennedy
-----------------------------------------------------
check http headers here: http://xhaus.com/headers
email alan: http://xhaus.com/mailto/alan
Jul 18 '05 #5

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

Similar topics

19
4754
by: gsb | last post by:
HOW TO: Submit a form to PHP with no return? I need to submit a form for file upload to a PHP script but do not want anything returned. That is the TARGET for the form should be like a null device. I am using a JavaScript function to submit the form. Is there a way to do this? gsb
1
3407
by: Jeff Sandys | last post by:
Can you include a subject with sendmail using smtplib? When I do this (names changed to protect the innocent): import smtplib toadr = "me@myisp.com" frmadr = "myhost@myhost.com" msg = "this is an important message." server = smtplib.SMTP('localhost') server.sendmail(frmadr, toadr, msg)
3
1726
by: Gert-Jan van Middelkoop | last post by:
Hi, I'm using an e-mailform on my website. I would like to make a dropdownmenu with several subjects, so when the e-mail arrives I can immediatly see it's subject. Therefore, this code must be changed: <input type="hidden" name="subject" value="selection of the dropdownmenu"
6
32700
by: Susan | last post by:
Is there any way to take one of the fields from the form and use that as your subject line.. right now I have a default subject line entered - but would rather have the subject be the information the user has typed into the field "store" current code: <!-- Start of FORM --> <form method="POST" action="mailto:abc@abc.com?subject=ABC Request" enctype="text/plain">
1
2468
by: kamlai | last post by:
I've written the following codes to include utf-8 wordings in both the subject and the content. $headers = "MIME-Version: 1.0\r\n". "Content-type: text/plain; charset=utf-8\r\n". "From: abc@abc.com"; mail("target@abc.com", "<some utf-8 wordings as subject>", "<Another utf-8 wordings as content>", $headers);
3
8749
by: Laangen_LU | last post by:
Dear Group, my first post to this group, so if I'm on the wrong group, my apologies. I'm trying to send out an email in Chinese lanuage using the mail() function in PHP. Subject and mailbody are stored as Unicode entities (eg. 註)
3
11037
by: b. dougherty | last post by:
Greetings all- I am trying to extract subject headers from emails that have been saved as text files. The subject headers are in MIME UTF-8 format, and so they appear like this: subject: =?utf-8?B?QVVUTyBQRU9QTEUgLS0gTWFuaGVpbeKAmXMgSmVmZiBCdW5jaCBpbiBIaWdoYmVhbXM7IExlZ2VuZGFyeSBSZWQgTWNDb21iczsgV2hv4oCZcyBTaGlmdGluZyBHZWFycz87IE1vcmU=?= What class can I use to decode the subject text?
4
8464
by: Alec MacLean | last post by:
Is anyone aware of a size limit imposed on the subject text when using the System.Net.Mail library? I'm getting problems of message not being recieved if the subject exceeds 15 chars. Thx
7
3289
by: plumba | last post by:
I am working on a html form for work, I need to make the Subject of the email which the form produces to be unique each time. The subject is currently hard coded in, in the format of:<form method="post" action="mailto:an.address@work.co.uk?subject=EnrolReq" I would like the subject to include a number at the end which will increase by 1 each time, so the subject will be completely unique each time. I'm guessing it would have to refer to...
5
1486
by: Alan Isaac | last post by:
I have two questions about the "observer pattern" in Python. This is question #1. (I'll put the other is a separate post.) Here is a standard example of the observer pattern in Python:
0
9716
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9595
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10359
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9177
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7643
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5536
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5675
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3837
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3005
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.