The Source for Java Technology Collaboration
User: Password:
Register | Login help    

Search

Online Books:
java.net on MarkMail:


The Pretender

Posted by editor on September 7, 2007 at 7:02 AM PDT

Imagining uses for multiple cores

Along with some other cleanup and infrastructure tasks, one of the things on my to-do list is to update the topics wish-list portion of the java.net Writer's Guide. There are probably a few topics that were priorities for us in the past and that just haven't attracted interested writers (e.g., the gaming API's). And on the other hand it's naturally important to maintain a current, modern view of where computing and development trends are today and where they're going, and try to get ahead of them.

On this last point, I've been wondering about developing for the new multi-core era. Oh, I know, Java has great threading, so we're fine. Yeah, to a point, as long as what you're doing is handing off servlet handlePost() calls to whichever core has the most bandwidth, and you have at least a passing understanding of your resource contention issues and concurrent programming (and recent back-channel e-mails with Java concurrency gurus have convinced me that almost nobody truly handles concurrency correctly, myself included). But overall, yeah, the major server-side frameworks can be expected to benefit from more and more cores on more and more CPU's.

But what about the desktop? I can buy an eight-core Mac Pro (well, not on my budget, but I digress...), but what good is it going to do me? Artima recently ran an item based in large part on Jeff Atwood's assessment of desktop app performance running on 4 CPU cores. In many cases, he got no improvement at all in going from two to four cores: "Beyond encoding and rendering tasks which are naturally amenable to parallelization, the task manager CPU graphs tell the sad tale of software that simply isn't written to exploit more than two CPUs."

Think of this from the point-of-view of the Swing developer. In Swing, anything you do that touches your GUI -- repainting, changing data in the models -- must be done on the AWT event-dispatch thread. Lots of developers implicitly do all their work on this thread until and unless they manage to do something that takes just long enough to cause noticeable lag in their GUI, and only then do they consider threading off the work and calling back in with a SwingWorker. Swing apps probably aren't going to gain much from multi cores because parallelization goes against many of the natural inclinations of Swing programmers.

And this, I think, would make for a good article if someone is solving these problems. Are there new approaches that would make Java desktop apps more amenable to parallelization? Rather than put all your non-EDT work in one thread, is there maybe a way you could split that work into parallelizable tasks, and then coordinate their completion? On the other hand, are there really that many desktop tasks that are really that expensive? Is the wait-grind-wait cycle actually appropriate for user-facing software architectures?

If someone's deeply invested in this topic and would like to write about it, please send me a proposal. In the meantime, it spurred the latest java.net Poll topic, which asks "How many processing cores are on the computer you're using right now?" Cast your vote on the front page, then visit the results page for current tallies and discussion.


In Java Today, the JDK community's incubated Java Native Access (JNA) project gets a starring role in extending JRuby's reach to POSIX support and native extension support. InfoQ points out how in JNA brings native code to JRuby. "The (not so) secret ingredient here is the Java Native Access (JNA) library, not to be confused with Java's JNI. While JNI provides access to native C code, it requires extra effort and glue code, such as JNI header definitions that need to be compiled, to access it." JNA, by contrast, provides an automatic mapping from a Java interface to a native function.

The latest Java Mobility Podcast is Episode 18: Learn new UI techniques with phoneME UI Labs and Java ME. "phoneME UI Labs is the one stop resource for developers to learn about the advanced UI technologies in Java ME platform. Aastha Bhardwaj talks about scalable vector graphics (SVG) in JSR 226 and JSR 287 and the demos that developers can find in UI Labs."

In their latest video interview, NetBeans.tv Speaks with Rich Unger. Rich used to work for Nuance Communications, where he added quite a bit to the NetBeans platform early on. These days, he's taking a year-long dream sabbatical with his fiancee - seeing the world and dropping in on NetBeans users along the way. See what he has to say about the forthcoming 6.0 release, the GPL announcement and flying kites in Patagonia!


Tim Boudreau is alive and has an update from the NetBeans truck in today's Weblogs. In Smooth Sailing in the NetBeans Mobile; Wicket AJAX basics, he reports, "after an initial mechanical hiccup, the NetBeans Mobile is purring along nicely. Photos from today are available . It looks like I'll be visiting with members of the Salt Lake City, Utah Java Users' Group on Friday, the Milwaukee, Wisconsin JUG on Monday and the Madison, Wisconsin JUG on Tuesday. If you're along my route, drop me a line!"

In Web Services Addressing 1.0 - Metadata is now a W3C Recommendation, Rama Pulavarthi writes, "Web Services Addressing 1.0 - Metadata specification is now a W3C Recommendation. It defines how to express abstract properties defined in the Addressing 1.0 core specification and uses WS-Policy 1.5 to express conformance to Web Services Addressing 1.0 specification."

Finally, Arun Gupta can help you Learn to REST using Jersey. "Jersey is the open source JAX-RS (JSR 311) Reference Implementation for building RESTful Web services. Paul announced the availability of 0.2.1. This blog entry describe the steps to get started with Jersey and provide useful pointers for further exploration."


In today's Forums, Hinkmond Wong is looking for feedback in Poll: Topic for phoneME Advanced Web seminar. "I'm taking a poll to see what topic would be good for a future phoneME Advanced Web seminar (tentatively Thu. 27Sep2007 @ 0800 AM, US/Pacific Time). Please log in and vote at: http://forums.java.net/jive/poll.jspa?pollID=4. Thanks."

mspetrovic is trying to do a Mac-like "drawer" in Swing, and could use suggestions in Request for feedback: implementing Swing-based drawers. "I've inherited some code to which I need to add a 'dresser drawer' like functionality. Click on a logical 'open' button and the drawer opens, revealing, or displaying as the case may be, a JPanel with more stuff in it. Click on a logical 'close' button and the drawer closes, leaving its container in the visual state in which it started. A familiar example of this effect might be something like the Mac Dock in 'auto hide' mode, where the Dock moves in and out of sight and addressability with some pointer action. The Dock is always 'there', but sometimes just not visible. So it would be with the drawer. I am wondering if a solution would be based loosely on theDrawer.setVisible(), or whether something that sets the drawer's component width or height to 0 for-hide would be more likely. Can anyone offer guidance on how to approach this using standard Swing techniques?"

Finally, Ryan J is openly considering a major design decision in Push via messaging vs pull via polling.. "I'm starting to consider how I'm going to design a portion of my application. I guess the best way to describe it would be "a queue shared between multiple application clients / users." I can think of two ways to do this... 1. Use the messaging system to publish changes relevant to the queue to subscribed application clients. 2. Have each application client poll the server (refresh) at regular intervals. I'd like to know if anyone has any thoughts / comments relating to either strategy. I have a preference, but would like to see what other people think before I start."


Current and upcoming Java Events :

Registered users can submit event listings for the java.net Events Page using our events submission form. All submissions go through an editorial review before being posted to the site.


Archives and Subscriptions: This blog is delivered weekdays as the Java Today RSS feed. Also, once this page is no longer featured as the front page of java.net it will be archived along with other past issues in the java.net Archive.



Imagining uses for multiple cores
Comments
Comments are listed in date ascending order (oldest first)