Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #22735
| From | Roedy Green <see_website@mindprod.com.invalid> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: synchronized methods "under the hood" |
| Organization | Canadian Mind Products |
| Message-ID | <gbdej8tqq2qa7qtq05hqo7mpobs3tkvplc@4ax.com> (permalink) |
| References | <7d23ce84-c209-43a2-bf88-2d112ce21a2e@googlegroups.com> <fpkcj8l7bqvg5qoki7m0b4dom3ha0qfp0f@4ax.com> <apnan8FdajU1@mid.dfncis.de> |
| Date | 2013-03-06 04:28 -0800 |
On Tue, 05 Mar 2013 23:44:34 +0100, Sven Köhler <remove-sven.koehler@gmail.com> wrote, quoted or indirectly quoted someone who said : >Such test and set methods are implemented in Java's Atomic* classes >(e.g. AtomicInteger). However, you need more than that to implement a >proper mutex. What I would call a proper mutex puts a thread to sleep, >if it cannot lock the mutex. To do that, you need to tell the kernel >that the thread is suspended I thought he was asking about what happens at the hardware level. Thread context switching I think is still done with software. Back in the 1990s I wrote a package in C to allow threads that ran on a single CPU. Threads had to be well behaved and call "have a conscience" periodically. It was remarkably simple, just save and restore contexts. It is quite bit more complicated when you can interrupt threads in mid instruction or when you have multiple CPUs. -- Roedy Green Canadian Mind Products http://mindprod.com One thing I love about having a website, is that when I complain about something, I only have to do it once. It saves me endless hours of grumbling.
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