Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #22728
| From | Jan Burse <janburse@fastmail.fm> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: synchronized methods "under the hood" |
| Date | 2013-03-05 18:59 +0100 |
| Organization | albasani.net |
| Message-ID | <kh5bq8$9kj$1@news.albasani.net> (permalink) |
| References | <7d23ce84-c209-43a2-bf88-2d112ce21a2e@googlegroups.com> |
bob smith schrieb: > How do synchronized methods work "under the hood"? > > Is there some kind of byte associated with each object that acts as a semaphore? > > Thanks. > If I remember well the synchronized keyword is mapped to two things: - In reflection it is mapped to the SYNCHRONIZED modifier: http://docs.oracle.com/javase/1.4.2/docs/api/java/lang/reflect/Modifier.html#SYNCHRONIZED - In execution the invocation and return instruction is combined with a monitor enter and monitor exit. http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-2.html#jvms-2.11.10 - For static methods the monitor is the class object, for non static methods the monitor is the instance object. http://docs.oracle.com/javase/specs/jls/se7/html/jls-8.html#jls-8.4.3.6 Bye
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
synchronized methods "under the hood" bob smith <bob@coolfone.comze.com> - 2013-03-05 09:02 -0800
Re: synchronized methods "under the hood" Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2013-03-05 09:15 -0800
Re: synchronized methods "under the hood" Jan Burse <janburse@fastmail.fm> - 2013-03-05 18:59 +0100
Re: synchronized methods "under the hood" Jan Burse <janburse@fastmail.fm> - 2013-03-05 19:16 +0100
Re: synchronized methods "under the hood" Jan Burse <janburse@fastmail.fm> - 2013-03-06 15:24 +0100
Re: synchronized methods "under the hood" Roedy Green <see_website@mindprod.com.invalid> - 2013-03-05 12:19 -0800
Re: synchronized methods "under the hood" Sven Köhler <remove-sven.koehler@gmail.com> - 2013-03-05 23:44 +0100
Re: synchronized methods "under the hood" Roedy Green <see_website@mindprod.com.invalid> - 2013-03-06 04:28 -0800
Re: synchronized methods "under the hood" Jan Burse <janburse@fastmail.fm> - 2013-03-06 15:20 +0100
csiph-web