Archive for June, 2007

SXDE 5/07 — Solaris Express Developers Edition

Tuesday, June 12th, 2007

A new update to Solaris Express Developer Edition is out. It has the latest and greatest Solaris Nevada build, along with all the development tools you could ever want. Well, I dunno, I can want a lot, but there’s a bunch of tools in there. My favorite parts are Sun Studio 12 and Solaris Nevada, but on the same DVD you get Netbeans 5.5 fully loaded, including the Creator RAD web development tool and other goodies.

I’ll take this opportunity to review some of my own personal favorite features of Sun Studio 12 and Solaris Nevada.

Sun Studio 12

The part of Sun Studio 12 that I was most directly involved with recently is the compiler support for the dwarf debugging format. We finished support for C++ and Fortran using dwarf, and now it will be much easier to maintain compatibility between Sun tools and the gcc tool suite. Dwarf also has “location lists” which we can use in the future to support local variables in optimized code. We were hoping to get this feature in for Sun Studio 12, but it didn’t make it in time. Look for optimized locals support in a future Sun Studio Express release.

One of the most visible changes in Sun Studio 12 is the new IDE. The debugger GUI has been rewritten to use the latest Netbeans, and to be much more like Visual Studio in some ways. Boy you should have heard the discussions we had about that! But it turns out that Visual Studio seems to be geared towards beginning developers, and that’s something we need to get better at. There are lots of changes in the new version, and lots of things for us still to implement, but give it a try, and let us know what you think.

Other major new features include a new Thread Analyzer tool for finding data races in threaded programs, and the Linux version of our product now includes all the compilers! Having Linux compilers allows more people than ever to give Sun Studio a try, and see what they’ve been missing. Especially a “real” Fortran compiler!

Solaris Nevada

A lot of the Nevada features I like are also in Solaris 10 by now, but I’m not sure which. I’ve been starting to use ZFS filesystems on my group’s file server, and I just remembered one of my favorite new features. It’s the -h option. That’s it, just one option. In reconfiguring filesystems, I end up running ‘du’ and ‘df’ commands over and over and over. It’s always a pain in the butt because the output of those commands is normally in blocks. What the hell is a “block”? I never quite trusted the OS to give me an implementation independent answer. But the -h option stands for “human” format. You get size numbers displayed as 27.3K for kilobytes or 52G for gigabytes, and the number is rounded to an appropriately small numbr of significant figures. I never realized how annoying those block counts and sig figs were until I started to get used to the -h output.

I also like a lot of the Gnome desktop features in Solaris. There’s a feature called gDesklets that I was reading about the other day. I had them confused with panel applets (which are also cool), but desklets let you put clever little clocks or graphs on your background in a similar fashion to what Apple popularized with their “Gadgets” feature. You can code your gDesklets in a scripting language (python), so they should be easy to create.

Another thing that comes to mind is the remote desktop support in Gnome (aka Vino). Lots of people where I work use VNC for working from home. But if you go back and forth between home and office, it’s not really seamless to use the vncviewer program when you’re already on your local desktop. So people will shut down all their apps when they go back and forth. There’s a ‘remote desktop’ feature that allows you to start up a VNC session and transfer all your desktop windows into the remote server. Then when you shut down the VNC session they go back to being local windows. That feature makes moving between the office and another location so much easier.

Of course, these are the just some of the features. The new Network Automagic configurator, wider support for wireless drivers, Gnome 2.16, etc. For a list of lots more new stuff in SXDE, look here.

Debugging tips for threaded programs on Solaris

Friday, June 1st, 2007

Phil Harmon wrote a blog entry over a year ago ( Solaris Threads Tunables ) where he mentioned a list of tunable parameters that you can use to fiddle around with the implementation of Solaris libthread. You can fine tune the spin-lock timeouts, and other timing details. But one of the flags that he mentioned is NOT related to tuning libthread. It’s more related to debugging your program! Someone on our internal dbx-interest alias asked why their program (which had a bug) was acting different when run under dbx, and the answer turns out to be related to a “sync tracking” flag that dbx turns on by default. It causes somewhat stricter checking of mutex bugs to be turned on.

Anyway, it turns out that if you set the environment variable _THREAD_ERROR_DETECTION to 1 or 2 you can get an extra level of error checking enabled inside libthread. 1 produces warning messages, and 2 produces warning messages and a core file for inspection.

The messages look like this:

*** _THREAD_ERROR_DETECTION: lock usage error detected ***
mutex_lock(0x8047d50): calling thread already owns the lock
calling thread is 0xfeea2000 thread-id 1

Most of the implementation is in libc/port/threads/assfail.c