Tuesday, November 11, 2008

Design like you'll be there in 10 years

I probably blogged about this a long time ago. I remember watching the news conference for the landing of the Mars Spirit rover. I had watched the landing live over the web and remember the jubilation of the team members as they received the first signal alerting to the safe landing. At the news conference one of the project managers mentioned he had been working on the project for 10 years (through one previous cancellation that is, but still pretty darn good). He was beaming to see the success. And it was well deserved.

That idea entered into my book of software design philosophy: design like you'll be working on the project for 10 years. Think of the responsibility that would mean. In 10 years, you'll be paying for the short cuts and short sightedness. So don't.

Well preparing for my talk on static analysis and refactoring for Eclipse Summit Europe next week (yeah a bit of a late start, it'll be great, though), I finally have my own version of this story to tell.

6 years ago, my good colleague and friend, John and I started down the road of building a C++ parser for the CDT. My mentor at the time thought it was a crazy idea but we had a feeling that we could do it and we plowed ahead and actually got it to work. The parser allowed us to build a more accurate way of populating the Outline View (via the CModel). It then lead the way to indexing to allow for C/C++ Search and Open Declaration to work well. It was tough and we fought the performance battles for most of it, but we soldiered on.

Somewhere along the way we started dreaming of C/C++ refactoring a la JDT. Everyone thought that was a crazy idea (despite secretly wanting it too). With all the madness of the C preprocessor mucking with the source code before it gets to the parser, how could you properly create the TextEdits that the LTK (which the JDT guys generously pushed into a common plug-in, BTW), needed to do the refactoring?

Well John put in a lot of effort and forethought and created a way to map AST nodes to location objects which allowed you to unravel where all the text came from to create the node. It wasn't perfect, but it was a start. And unfortunately due to the untimely end of our funding, we never got to finish it.

Well, I finally got a deep look at the work that Emanuel and is team at the HSR Hochschule für Technik Rapperswil have done on the CDT refactoring engine and early refactorings. Following it through the debugger, I hit it, IASTNodeLocation - that work that John had started years ago but never got to see in action for what it was intended for. It's been fixed up by Emanuel and CDT Indexer Master Markus, but it was doing what we had dreamed about many years ago. Weird, but it actually brought a tear to my eye.

But it really does prove the point. Design as if you'll be working on a project for 10 years. Even if you end up not being there, someone will be, and your work will live on, and it will be much appreciated.

Friday, November 07, 2008

Cross Compiling Fun for EclipseCon

It's been a busy couple of weeks for me as we get our commercial Eclipse p2-based installer into product testing. It's looking good but there's always those last minute fires (i.e. bugs) to fight.

In the background I've been trying to set up an environment that will allow me to use the CDT to build Linux applications from my Windows box, and then run and debug those applications on a customized version of the Qemu emulator that is also built using the CDT. Once I get this environment together, I plan on presenting how to do it at EclipseCon as either a tutorial or long talk. It's a great demonstration on how well the CDT works for multi-platform development.

My first step was to put together a cross compiler. The gcc compiler suite is great at it, but it's not obvious how to do it on Windows. Most GNU packages are hard to build on Windows, even with the MSYS environment from the MinGW gang, or Cygwin.

I first tried with MSYS. I copied over the C library headers and libraries and then tried to build binutils to get the assembler and linker, and gcc itself for C and C++. I was generally following the instructions here. I got really close, but unfortunately I ended up with a linker error when creating the gcc compiler support library (libgcc). Grrr.

Thinking about my reference article a little more, I remembered that even the MinGW developers build MinGW on Linux. I then discovered that the Linux distribution I am using (Debian lenny) already has the MinGW cross-compiler and libraries as a package. So I installed that and I suddenly had the ability to build Windows executables on Linux. So given that, I built binutils and gcc on Linux so that it would run on Windows to build executables for Linux. Wow. That's quite a few levels of indirection. But it worked!

Now all I need to do is build a CDT integration that puts the i686-linux-gnu- prefix on gcc and puts the location of the tools in the PATH and I'm ready to build Linux apps from my Windows laptop.

I'm looking forward to showing this off at EclipseCon. It's talks like this that show practical uses of the CDT and extensions people can build for it that we really need to highlight to the community at EclipseCon. Mine is only one, we need a few more. So if you have an idea, feel free to go to the EclipseCon site and submit a proposal.

Sunday, October 26, 2008

Why a good platform can't be free

I sure am having fun thinking about OpenConsole, i.e., a Linux based set top box that plays in the same space as Microsoft and Sony and Nintendo, but is really an evolution of the Home Theater PC (HTPC) into gaming, but all using open licensing so you don't have to pay the big boys to write applications for this platform. The underlying technologies are pretty cool as I play with adding OpenGL graphics to the qemu emulator. But the business side of it is interesting as well.

In particular, my thoughts turned to multimedia support on open platforms. This is where the insistence on Linux being free is really biting the hand that feeds you. Not all good software can be free. We do live in a world of patents and a lot of the key technology that goes into a multimedia system is protected by patents and require a license to legally distribution implementations of that technology.

You know, I have no problem with that. As I've stated in the past, complex algorithms are hard to get right and multimedia is complex to get good quality results. And I don't blame the creators of this work wanting to get something out of it. If they didn't, they probably wouldn't have created it to begin with and we'd be waiting for some kind soul to donate this for free. Wishful thinking I'd think.

But you know, the costs aren't that bad. One I was looking at was the DVD format licensing. There is a company in Japan that controls this and their pricing information is here. It's about $5K for the book (under NDA), $15K for the license, then another $10K or so for verification. That's not too bad if you're selling thousands of units. But it's also not zero. And the NDA also prevents the implementation from being open source to begin with anyway.

And there are similar fees for the very popular MP3, (minimum $15K). Blu-ray is similar. And some of these are yearly fees. So as you can see, if you want to produce a multimedia platform you can redistribute, the costs are non-zero. So why do people expect these platforms to cost zero...

Friday, October 24, 2008

BMW wants to go open

Ian Skerrett, our fine director of Marketing at the Eclipse Foundation, pointed out this article from MotorAuthority.com. BMW apparently is feeling out the market to see if there is an appetite by tier one manufacturers to work together on an open source stack for in-car infotainment systems.

The concept BMW has in mind reminds me a lot of Google's Android who just recently released all the source to the Android platform for cell phones. Android is Google's attempt to open up the software stack for much the same reason BMW wants it for automotive, to ensure leading edge software applications can be built for those platforms with minimal obstacles. We'll see how well the master plan works, but I like the concept.

That would be quite a twist from the current proprietary mindset that these guys have today, and I'm not sure they are ready for the co-opetition this would take. Of course, we're pretty used to it at Eclipse where platform vendors fighting in this space work together on open source tools. That's fine, since that isn't our core competency and we're building a much better IDE together than we could independently. But that's where we draw the line.

Ian concluded his blog entry by inviting BMW to the Automotive Symposium at Eclipse Summit Europe (I am looking forward to ESE as well!) But this brings up a sore point that we often talk about but one that seems impossible to solve. If they want the software stack to be completely open like Android, then they aren't doing it at Eclipse. The Eclipse Board forbids GPL code within it's walls. But I would think such a stack really could only be done on Linux and that's a non starter. You could look at Symbian which will be EPL in the next few years, but I'm not sure Symbian is the right choice for this, especially if they want to link up with Android.

And this bugs me to no end. We are seeing some serious investment happening in open source platforms, the whole platform. The culture of commercial co-operation on open platforms at Eclipse makes it a natural to host such endeavors, which in turn would raise its profile immensely in the embedded and mobile community. Too bad the Eclipse Board shoots itself in the foot on this.

Monday, October 20, 2008

Fun with RSE

I love my home office setup. I still have an @work office that I go to, but with an Autistic son who's home schooled, I never know when I need to work at home for a day or two so it's good to have something setup so I can continue working when I do. In the office, I have a TV which I'm using to watch the great baseball playoffs happening right now and I'll watch hockey whenever I get the chance too. And while doing that, I get to play on my laptop, like writing here in this blog.

At any rate, tonight I thought I'd try hooking together the virtual machines running in my Windows environment. One is qemu running my simulated OpenConsole thing to which I'll be adding OpenGL support. The other is VirtualBox running a desktop version running the same distro, i.e. Debian, where I'll be building the device driver and app prototypes. VirtualBox has nicer desktop control than plain qemu.

The question comes: how do I get the stuff I'm building on the dev machine to the target. I thought of NFS, which is probably the best choice, but I'd need to spend time figuring out how to set up NFS for this. Instead, I thought I'd try an Eclipse solution, the Remote System Explorer, and hook up everything using SSH.

First, I had to redirect a port on my laptop towards the qemu SSH port 22. The qemu option '-redir tcp:2222::22' did nicely there and I was able to use it to log into my qemu using PUTTY on my laptop. I also decided to forward another port, 2345 to the same port on qemu to allow gdb on my dev machine to talk to a gdbserver on the target using that port.

I then set up the SSH connection in RSE on the dev machine. I used the 'router' address so that the dev machine would connect to Windows on my laptop, which then forwarded the SSH connection to qemu. It was tricky to figure out how to set the port number to 2222 instead of 22, but I found it and it worked like a charm. I used the Terminal view to log into the qemu session from VirtualBox. Cool!

I then tried the C/C++ Remote Launch feature that uses the RSE connection to download and launch into the CDT debugger. When I first tried, the executable on the target didn't have the execute permission set, but once I fixed that, the debugger launched fine. Very cool.

Apart from being fun and interesting, this OpenConsole thing is giving me some real experience on using Eclipse tools to do embedded development with Linux and exercise all that it offers. I am very pleased with it and I think we really need to get the word out how well it does, like a Webinar or something :)

BTW, Go Rays!

Friday, October 17, 2008

Open Console you say

Linux powers "cloud" gaming console.

More info here.

I hate the term cloud, but this is close to the internet appliance/open gaming console I have been thinking about. Specs are damn close too. Although I'm not sure the ATI HD 3200 class graphics (I assume it's the 780G chipset) will do a good job at the games. But it's good to see someone with money came up with a similar idea and has made this concept a reality, or at least is marketing it.

Update

Looking closer to the EVO website, this thing isn't as open as I was thinking. Game developers have to sign and NDA to get the SDK. Odd. They do mention proprietary features that are only in their version of the Linux. What I had more in mind was an open distro that ran on specific hardware specs, but was truly open. Looking at the games they have listed on their web site, they are all open as well that can run on any Linux distro that has OpenGL support and drivers. You don't need to be proprietary...

Windows as a host for Linux development?

Here's something I'm trying to decide as I work through the ultimate development environment for a Linux based "OpenConsole" (and to be clear, I'm talking about set top box class consoles, not mobile). As I mentioned in previous blog entries, I've figured out how to extend qemu to do OpenGL calls on the host and present a PCI interface to the guest to make those calls. All I need is a Linux driver and user space library to use that interface and present the OpenGL (or OpenGL ES) interface to applications that can do games, or what have you.

I figure Linux is a natural host development environment for the device driver. You need to reuse the kernel build system to build it and from what I understand, that build system doesn't work on Windows, not even with Cygwin. So that's a lock, and I can use the Linux version of CDT to build it.

But when it comes to applications, I am wondering how many developers would prefer to use Windows as their development host. From what I understand (again, and I keep guessing here), most game development is done on Windows, even when targeting the "closed" consoles. Actually, XBOX development is obviously done on Windows. But I believe the others have Windows hosted SDKs and tools as well.

However, as with device drivers, Linux should be an obvious choice for application development targeting Linux. This is especially true when targeting PC-type platforms since the host tool chain can actually be used to target the console, and even more true when you're actually using the same run-time lineup.

I get the feeling that there's more to life than writing your Linux targeted application. If, as the developer, you're still relying on a lot of Windows tools or you just plain prefer Windows as a work environment, you would probably want to write your application on Windows as well.

It's funny how we sometimes forget history and the fact that we abandoned our Unix environments for Windows because it had much better tools. And as I (and many others) have discussed, Linux hasn't caught up yet to make us want to go back. So I firmly believe that Windows is an expected host development environment for Linux development, especially embedded. And with the help of gcc's cross compilation abililty and the gcc support in the CDT, it's shouldn't be that hard to put together.

Monday, October 13, 2008

It's all about the Stack

Someone recently pointed me to a presentation that Tim Sweeney (Mr. Unreal engine) from Epic Games gave at POPL (Principles of Programming Languages) 2006. The focus of the presentation was on "The Next Mainstream Programming Language" where he discussed the challenges game developers have with performance and quality and what the next generation language needs to have to help with their problems. I truly believe game developers are at the forefront of software engineering and have the heaviest requirement set for IDEs. And that's why I'm trying to figure out how they work.

Tim's slides talk about the technologies that went into the game "Gears of War" and it's a very interesting mix. While the bulk of the code is C++, there is extensive use of scripting languages as well. And, of course, most modern games make extensive use of Shading languages to manipulate vertices and pixels using the almost teraflop class GPUs we have today. So they could really benefit from an IDE that did more than just C++ or more than just scripting while integrating shader development into the fold.

The other interesting point I got out of Tim's slides was the breadth of software libraries that they were using - DirectX for 3D graphics, OpenAL for sound, Ogg Vorbis for music, wxWidgets for 2D widgets, Zlib for compression, and the list goes on. Apparently they used a mix of 20 libraries to build Gears of War. And it only makes sense as the quality of the software components out there removes any need to build the same functionality yourself.

And I think this is another area where IDEs could improve on, integration of SDKs and automatic setup of build and indexing environments. We do a bit of that in the CDT, at least on the indexing front. And it is something we've talked about on the Build side but we've never really come up with a generic mechanism that would allow you to add SDKs to a project.

Building an IDE to help game developers be more productive would be beneficial to all users of the IDE as I think all developers run into these issues. Maybe not to the same scale but I can see how everyone would benefit from multi-language and software component management support. And, of course, I can't see a better platform to build this other than Eclipse. If we look hard, we'll see that we have lot of this already.

Saturday, October 11, 2008

On the Future of C++

There's been talk for a number of years now on the decline of C++ and the rise of virtual machine and scripting language. But certainly from where I sit, the C/C++ community is still very strong. In fact, I still see many more C applications than C++, especially in the Linux and embedded worlds. Though, everyone agrees, for large applications, doing them in C++ instead of C makes sense.

But I have to admit, for desktop applications, I'm not sure C++ is the right answer like it was in the 1990's. We're certainly seeing Java, with the help of Eclipse, and C# on the .Net side, take a much bigger chunk of the pie chart. And I think that's the right approach. The richness of these environments naturally enables a developer to be much more productive than in the C++ world, especially when dealing with the user via graphical interfaces. I'm pretty much ready to concede this space to those languages. Sad, but true.

But there are a few areas where I don't think C or C++ will every go away. And that's the areas where the developer has the need for speed and where they want to work close to and take advantage of the native processing hardware underneath their application. I often hear from people who would know, that modern Java VMs can actually do better than C/C++ in performance, thanks to run-time optimizations. But projects like LLVM which provides similar optimizations to native applications, may balance the scale there. And at any rate, out of the box, native applications will start with the better performance.

When your writing a high performance application, like 3D gaming, or scientific simulations, or if your working on mobile applications where you need to balance CPU cycles versus battery life, C/C++ will always be the obvious choice. There may be exceptions to the rule, and Microsoft with .Net Compact and OSGi for Java are trying to make a splash, but C/C++ will be difficult to replace.

Thursday, October 09, 2008

OpenGL 3.0 or OpenGL ES 2.0?

First, I have to admit, I'm a newbie at this whole 3D programming world. I watch from a far with a lot of interest but no real experience working in that world. So I apologize ahead of time if this is a stupid question. But I know a lot of CDT users are using the CDT to work with 3D graphic APIs and game engines so I thought I'd bounce this off you.

It was interesting to watch the response to the release of the latest major version of the OpenGL spec. The reception from the game development community was especially interesting. They were furious, at least according to Slashdot. But I can see disappointment in other articles I've read. The question came up: do we declare Microsoft the victor in the OpenGL versus DirectX wars? To which I add, does this spell the end of the dream of gaming on Linux?

From what I gather, there were a couple of issues with the OpenGL 3.0 release. One, the group writing the spec disappeared behind closed doors and sprung it on the world when they were done without really getting the ordinary game developer's input. And in the end, it appears a lot of compromises were made to keep the non-game developer, the big CAD companies from what I hear, happy. So despite discussion of big architectural changes to compete with DirectX, it ends up not even worthy of the major version number.

It highlights the problem of trying to be everything for everyone and how that is impossible in many situations. Maybe the game developers need a special version of OpenGL spec'ed out just for them. If not, they're all jumping on the DirectX bandwagon and see you later.

But that got me taking another look at OpenGL ES, the OpenGL APIs reduced for embedded applications and gaining wide acceptance in the smartphone market. It was interesting to see that the Playstation 3 uses ES as one of it's available 3D APIs. And reading a few forums I've seen comments from experts who think OpenGL ES, at least the 2.0 version centralized around shaders, is OpenGL done right. The drivers are a lot easier to write and the API cuts out almost all the duplication and focuses on efficiency. It does make one think.

For the future of Linux gaming then, should we be looking to OpenGL ES? I don't know how many OpenGL experts read this blog but I'd be interested to hear your comments on this. I recently bought a book on OpenGL ES programming to see what it was all about and it started to make sense to me that maybe this is the right direction. Heck, it almost seems like Khronos's master plan...

Sunday, October 05, 2008

What would I do without CDT

While waiting for my VOBs to sync from Salburg to Ottawa, I thought I'd poke around qemu to figure out exactly what I would need to do to add a PCI device. Apparently, there's very little, if any, documentation on how to do that. And I even saw one response to a similar query that told the guy to go look at the source. So I did.

I started by grabing the source for the latest qemu release 0.9.1. I created a CDT Makefile project and untared the release into the project directory. I created an External Tool to run configure with the options I wanted and then I did a project build which ran the resulting makefiles. So far so good. Looking at the Includes folder on the project, I see it caught the mingw gcc standard headers as well as my project as an include path.

So off I went. First I looked for things beginning with pc_ in the Open Element dialog (Shift-Ctrl-t). There I found the pc init code and went looking there for PCI devices. I found the LSI SCSI device init and hit F3 to go look at the implementation. There I started seeing some generic PCI type things. To see what other PCI devices I could look at, I selected the call to register a PCI I/O region and did a search for references. In the Search results view I quickly saw other PCI devices - VGA displays, the IDE device, some networking things, USB. All good examples.

It wasn't long before I figured out what I needed to do. It got me thinking. How did I ever do this before the CDT and how are the poor guys still stuck in the command line world doing stuff like this. I guess I used to do the same thing but used grep which does simple text searches. But there's no way I could do the same navigation with the same speed. And things like Alt left and right arrow to go back and forth along my path doesn't happen in that environment.

No, CDT rocks. I hear a lot lately about how there are still many people hesitant to leave the safety and comfort of the command line world. I think that's too bad. They're missing out on some real productivity gains.

Saturday, October 04, 2008

QEMU Manager

Shh, I'm supposed to be working, don't tell my boss ;)

I wrote in a previous entry about the VirtualBox SDK, and the potential for using that SDK to add 3d graphics support. I was pretty excited. All I needed to do was create a DLL that could be loaded into the VirtualBox I used for running Linux on my Windows laptop. Well, I tried a simple example, but could never get the DLL to load. Looking at the source code for VirtualBox, I noticed that there's a "hardened" mode for building it. For security, it prevents rogue DLLs from getting loaded. I guess my DLL looked pretty rogue :(. And the complexity of building VirtualBox myself scared me off.

I've also been a pretty big fan of the Qemu emulator, especially for emulating mobile devices. But you can use it for emulating a PC and there is an accelerator driver that apparently makes it fast. So I guess I could give that a try. I've mucked around in the qemu source in the past and I have an idea on how to add a device. It's not as clean as the VirtualBox SDK promised, but it could be done.

Along the way, I found Qemu Manager, a nice GUI that manages virtual machines and launching them on Windows. Very cool. And it's extensible so that if a new version, or a cleverly hacked version, of qemu comes out, you can have it manage launches for them as well.

So this weeks "Open Source Tools Kudos" go to David Reynolds for building the Qemu Manager. Very cool and thanks!

Friday, October 03, 2008

Another Awesome CDT Summit

I just realize I haven't blogged about our CDT Summit last week. Shame on me, because it was a great three days. It was smaller than previous summits, only 16 people. But this time, we didn't have the guys there that were just lurking in person. Everyone was there representing real Eclipse contributions. So we ended up getting a lot of real work done.

We started on the first day by updating eachother on what we were planning for the next release, Galileo, which we determined by the end of the week will be CDT 6.0. It's much more of a marketing number since I don't anticipate huge API changes, but there will be some, especially in the build area.

We then talked a lot about development process and how we can improve the way we work on the CDT. It's a challenge since many of us are only part time on the CDT. But we all agreed that becoming more formal in the way we do things is necessary and we have plans on doing just that.

The next day we broke up into two groups to do some deep dives into specific areas. One group dove deep into indexer issues. They talked a lot about some of the tougher areas that the CDT index and parsing technologies need to deal with, like C++ templates. The biggest new thing from them was discussion on how to represent inactive code, i.e. code that is ifdef'ed out given the current configuration. They settled on starting with doing so in the Outline View at least. Any more is a research activity.

The other group talked about debug. The biggest move there is the integration of the Debug Service Framework from the Device Debugging project into the CDT. I anticipate DSF will be the future standard debugger integration point for the CDT, and maybe even for the Platform. At the same time we will continue to support our existing CDT Debugging Interface (CDI) integrators. I'm also excited about the potential disassembly debugging editor that should hopefully make it easier to look at the object code being debugged.

On the last day we talked about e4 resources and the start of my straw man proposal I have put together. We also talked about the CDT build system, and in particular, the CDT project model that serves as the common model for them all. We've unfortunately lost the main developer of this work before it finished and we need to take another look at it and hopefully simplify it. It's a good lesson that you shouldn't be hands off if you totally depend on an open source component. The people working on that component may vanish and you have no way of getting fixes in.

I really wasn't sure what to expect from this year's summit. In many ways, the CDT is feature complete. And the plan will show that. But we still have a lot of usability and quality issues to address and the team is committed to focusing on that this year. And that will help solidify the CDT's place on the developers desktop. And that was exemplified by Red Hat's presence there. They are committed to making Eclipse the Visual Studio for Linux development. And that's a good place to be.

Saturday, September 20, 2008

A cool multi-platform CDT use case

I previously blogged about the VitualBox SDK and the capability it provides to build some really interesting emulation environments, 3D graphics being the one I'm most interested in at the moment. And this is something I'm seeing in the embedded industry a lot lately. Hardware is expensive. These boxes we have on our desks are very powerful and relatively pretty cheap. Being able to emulate hardware during the software development phase of a project gives the developer the ability to get his code up and running much earlier.

So looking at how I'd build an emulator for a Linux set-top box that had 3d graphic capabilities, it quickly became apparent again how the multi-platform capabilities of the CDT gives me an top class C/C++ IDE to do work on all of the components. Here's what they would include:

  • The 3D graphics emulator is a shared library that VirtualBox loads and, of course, runs on the host. I would start with doing it on Windows since that's my main environment. I'd use either MinGW gcc or the Visual C++ compiler. CDT has support for building both but only debugging with gcc at the moment. But shared library debugging on Windows has always been trouble with the CDT so that might not be important. In the long run, I'd probably also want to do this for a Linux host environment.

  • The box would run Linux, of course. I'd need to be able to build the drivers that talk to the emulated 3d graphics thing. And I'd need to be able to build a bootable image with the kernel and the drivers and any core utilities I would need. Again CDT comes to the rescue, but I'd probably pick a commercialized version that automates Linux kernel development such as Wind River's Linux platform builder. And I'd have to use my Ubuntu development environment on VirtualBox to run it since Linux is the only environment that really supports building the Linux kernel.

  • For the actual user space programs that provide the content, I can use the CDT again. This is the main environment that is used by the community building stuff for the box. gcc's great cross compilation support makes it less obvious whether you'd do this on Windows or Linux. Linux would be a favorite since you can easily share your development workspace with the target using NFS. Something not as easy on Windows.

For me, this is the big advantage of the CDT. You have yourself doing host and target development on Windows and Linux, and even Mac if you wanted to, all using the same tools that have the same UI and keyboard shortcuts. Now, where's that cloning machine so I can actually go build this thing...

Tuesday, September 16, 2008

Another legend has eyes on the future

I just finished reading an interview with another legend of the game programming industry, Epic's Tim Sweeney (Mr. Unreal). First it was John Carmack from id (Mr. Doom) wondering how game developers will be able to harness multi-core technologies to improve game performance. Now I see Tim has a very interesting vision for how these technologies are going to change the industry.

It looks like both of them agree, multi-core general purpose processors will make graphics specific processing units obsolete, at least the fixed function parts of those graphics processors. But Tim seems to have a grasp of what that environment will look like. And it's both exciting and liberating.

Essentially, he sees the return of software rendering, just like we had before the 3d hardware accelerator industry kicked in. Software rendering gives game programmers the freedom to implement whatever algorithms suite their needs, and they aren't tied to the DirectX and OpenGL APIs which Tim says is really tying their hands. They can create whatever data structures they need to represent a scene and do whatever they want to slash that scene onto the pixels.

And he sees building that future with general programming languages and C++ in particular, instead of custom, hardware specific languages. Using C++, you have a shot at simplifying the programmers life, using the same technology for everything compute intensive. Game algorithms essentially come down to doing as many floating point operations at the same time as you can. Of course, this can be done in C++ with the right libraries, or even if necessary, a good compiler that can optimize your code to take advantage of whatever vectorizing capabilities your hardware has.

I anticipate this will be an exciting time for game engine developers. Certainly Tim seems pretty excited about it (and I highly recommend reading this article to catch some of that excitement.) And the good news is that we don't need to invent new technologies to make it happen. C++ will do just fine (with a little help of the CDT, of course ;)

Saturday, September 13, 2008

VirtualBox 2.0 gains an SDK

When you're an Eclipse developer like I am who is taking advantage of Eclipse's cross-platform capabilities, you need to have a bunch of platforms to test your work on. The incredible growth of virtualization on the desktop over recent years has been a huge help for us who don't necessarily want their offices filled with a dozen machines.

I've tried them all and settled on VirtualBox, which was recently bought by Sun, as my Windows Laptop solution (I use KVM on my Linux desktop box). It has the best handling of screen resizing I've seen and thanks to the great support for this in recent Linux distros, the window for the VM flows nicely into my daily workflow.

VirtualBox released their 2.0 version last week. The big news is support for 64-bit hosts and guests (yeah, old news for other solutions, especially given VirtualBox still doesn't support SMP :( ). But what caught my eye was that extra download labeled 'SDK'. Nothing get's me more excited than an extensible platform (well, there are some things...). So I was quick to unwrap their new gift.

The SDK mainly covers APIs they've exposed to build VM management tools, similar to libvirt that's used on Linux platforms. It lets you create, configure, and launch VMs. Cool, and maybe it'll lead to better UIs for this, mind you the one they have is already pretty good.

The more interesting part of this was the last chapter of the SDKRef PDF file. It talks about the mechanism they use to allow communication between the guest operating system and the host. It allows you to create your own drivers that communicate through a virtual PCI device to a shared library on the host. Now the header files weren't shipped as part of the SDK, but they are part of the open source parts of VirtualBox. At least the doc shows you how. Very cool.

Now this comes to one of the most pressing things I wished virtualization could do, use the 3D graphic chips on the host. If I want to experiment with some of the ideas I have for 3D Linux UI frameworks, and still use Windows for my day job, I need something like that. And with this capability opened up for us to use, I can quickly imagine how I could get OpenGL calls from a guest OS out through this mechanism to the host OpenGL libraries. And I guess I'm not alone. In the list of built-in users of this mechanism is a mysterious service called VBoxSharedOpenGL.

Wednesday, September 10, 2008

Time ripe for a Linux console?

I was watching my son the other day on our XBOX 360 that's tucked nicely in our cabinet under the TV with our DVD player, digital cable box, and receiver. He was playing Halo 3, which looks great on our LCD HDTV, BTW. He'd break out once in a while and go back to the Dashboard and send a text message to a buddy then go back into the game and use the headset connected to his controller to talk about his school day with another buddy he was shooting at. It's incredible how far consoles have come from the old Atari boxes we had when we were kids. Now they're these multi-processing entertainment centers and communication devices that hook our kids up to the rest of the world.

It's also interesting how he's migrated away from our PC over to the XBOX. That could be because our PC is getting old and the 360 is actually a more powerful machine. But, still there are still things you can't do on it. That would probably be solved if it had a web browser built into it. But for some reason, and correct me if I'm wrong on this, there doesn't seem to be a web browser available for the 360. Weird. Too bad this is a closed platform that makes it really hard to get open source software, like the Webkit browser engine, ported to it.

So that got me thinking in the context of Linux. Why isn't there a Linux console? Linux is slowly getting better for the desktop and it's about to break out huge in the mobile space, wouldn't it also work well in a box I can put under my TV and use with a wireless keyboard, or game controller with a headset, or with the controllers we have for Guitar Hero and Rock Band? I don't see why not.

Googling the idea, you see the GP2X WIZ handheld I've blogged about in the past, and the sad story that was Indrema that rose with the hype of Linux in 2000 and crashed with the market realities of 2001. And yeah, Linux probably wasn't ready in 2000. But nothing seems to be happening now.

And I'm sure there are economic roadblocks to making it happen. The companies in this industry are huge and are still selling the boxes for less than it costs to build them. Having an open platform makes it pretty difficult to collect the license fees that subsidize the hardware and platform development costs. You'd need a big player with big friends, similar to one of the Linux handheld alliances, to even think of making this happen.

But if it works for handhelds, why not on the TV. At least there it would have a bigger screen...

Tuesday, September 09, 2008

Get out your lambdas - C++0x

I saw a video of a talk by Bjorn Stroustrup, Mr. C++, who people I work with know I call "Barney", affectionately, of course. In the video, he mentioned how badly he wanted to keep the name of the next major version of the C++ standard as C++0x and not have it slip into the next decade. Well, 2008 is almost over so it's going to have to be C++09 if it's to make it. But they are trying hard and making some progress.

And hopefully it does. C++ is due for a good shot in the arm, something to get people excited about. Working every day in Java as I do, and yearning for my C++ days, there are a few features in Java that would be exciting to have in C++. Not many, but there are a few :).

And one of them appears to be ready to be included in the standard, lambda expressions. Now Java doesn't have pure lambda expressions, but the inner class support comes close. And with C++0x support for more general lambda expressions, I think we have a winner on our hands. Here's an example:

int x;
calculateWithCallback([&x](int y) { x = y; });

This ain't your father's C++. To explain what's happening, we're passing an anonymous function that takes a parameter y, and we pass along with it a closure which passes on some of the context with the function, in this case a reference to x. Later on the calculateWithCallback function does something and then calls our function with a parameter value for y. We then execute and assign the value to our x and return.

Anyway, very cool. Callbacks is a very popular design pattern and we use it all the time when programming Eclipse plug-ins. Being able to do something like this in a concise manner in C++ will be very useful and help bring C++ into a new decade, or whenever they get the standard ratified.

Wednesday, September 03, 2008

exit() is your friend

I was just reading the Google Chrome cartoon book (an interesting way of presenting designs). One of the things they talked about was how having browser tabs in separate process helps with memory consumption because memory gets cleaned up with the process exits. Otherwise, the constant malloc/free cycle ends up with memory fragmentation that is hard to get rid of.

That brought back some memories. In my early work on a code generator, I used the same philosophy. I created a pretty big object model in memory after I parsed the input, but I never implemented any of the destructors and never called delete. Didn't need to. It was a short lived process and the call to exit() at the end freed up all the memory anyway. And it's pretty fast! Lot faster than calling delete for each object I created.

Anyway that worked great. Until another team decided they liked my object model and wanted to use it in the main tool. Unfortunately that tool was a long running process and they had to add in the memory management to survive. So much for exit() is your friend. Worked for me, though.

Of course all the garbage collector languages deal with this for you. Makes me wonder why GC in C++ hasn't become more popular. There are C++ garbage collectors like the one from Hans Boehm. But I guess if you're moving to that paradigm, you might as well use Java.

Tuesday, September 02, 2008

Coming Live from Google Chrome

Well, it's live and I've downloaded it and am using it to write this blog entry. It's Google Chrome. It's a beta, but from what I've seen in the couple of minutes I've used it, it's delivering as promised. Very fast and smooth, even typing here. Better than Firefox? Seems like it, but maybe it's the chrome blinding me. And given the news volume about it, there's a lot of people speculating about what Google is trying to accomplish with this thing.

At any rate, if it is about making the Web the OS as we've been trying to do for centuries now, what does it mean to C++ application developers? How do they make their applications relevant in this new world? Is it all over? Do we throw away our C++ compilers and pick up a book on PHP?

I strongly believe there will always be a role for a close to the silicon programming language like C++. Whether it's for resource constrained devices like mobile platforms, or whether it's for high performance apps like image processing or simulations, there's still that need.

What may change is how these C++ apps communicate with the user. I can easily imagine a Web-based UI for C++ apps, similar to other Web 2.0 platforms. Who says the server side needs to be Java or PHP? It could easily be a C++ app. What we need, though, is a clean way to program such a UI. C++ widget programming has always been a challenge, but wait until you change the paradigm like this.

This is one reason I'm keeping an eye on the "Webification of SWT" part of the Eclipse e4 project. The lessons learned and the technology choices made there should be portable to a similar effort in C++. Maybe there's already a C++ widget set out there that we could use to start, like wxWidgets, maybe something else, maybe something new. Either way, it's time for C++ developers to start thinking about what this all means to them.

Monday, September 01, 2008

Google has their own browser!???

Apparently the word leaked on an unofficial Google blog site and they followed up with an "oops" official blog post. Either way, the word is out and the web browser "industry" is in for a shake up. Google is releasing their own web browser called Google Chrome. Apparently it includes pieces from Webkit (I'm guessing the browser part) and Firefox (I'm guessing the chrome part) and will be developed as an open source project.

The first beta will be released tomorrow (Tuesday). I've heard rumors but always dismissed them. Why would they do that when we have a handful of pretty good browsers already. I guess the rumors were true and given the beta comes out now, it's been in the works for a while.

But still, you've got to ask why. Why couldn't they just contribute the stuff the felt was important to Firefox or Webkit. I'm going to guess that it's because sometimes getting your ideas into an open source project is hard. Everyone with a few open source miles under their belt knows how hard it is to influence a community at times and this isn't exactly the first fork in the industry. And when you have the resources and experience Google has, I guess it made more sense for them to fork.

My favorite quote is from the cnet news article where I first stumbled on the news: "Open sourcing the code is a smart way to avoid the 'Google wants to take over the world' fear, but it seems that Google has ambitions to create a comprehensive Internet operating system, including a browser, applications, middleware and cloud infrastructure."

Very intriguing. And this is one of the reasons I'm very interested in Android. Because that's what it is, an internet operating system for mobile. It isn't much of a stretch to take it beyond the cell phone so it'll be very interesting to watch where this goes. (And, yeah, I think Microsoft should be paying attention to this.)

Friday, August 29, 2008

Where's Wascana 1.0?

For those who haven't heard of Wascana, it's a lake in the center of my birthplace, Regina, Saskatchewan, Canada. It's a beautiful oasis in the middle of the bald Canadian prairies and my last trip there inspired me to name my Eclipse CDT distribution for Windows desktop programming after it.

Around this time last year I realized that school was about to start and I rushed out the first release of Wascana 0.9.3. To date I've had almost 9,000 downloads of it showing me that there is interest and a need out there for such a package.

My plan was to get Wascana 1.0 ready for this school year. But my summer has been very busy and I haven't had a chance to work on it. But hear me now and believe me later (I'm sure that was in an old Saturday Night Live sketch somewhere), it is still on my roadmap. For one thing, I really want to make it a showcase for the Eclipse p2 provisioning system showing how you can build a feature rich install and update environment for your whole IDE, not just the Eclipse bits.

Aside from that I want to add the boost C++ libraries to the package. Boost is a very full C++ template library that gives you a lot of the library functionality that makes Java so good, and it's often a showcase for new technologies that end up in the C++ standard anyway.

I'm also waiting for an official release of gcc 4.3.1 for MinGW, to give us the latest and greatest compiler technology from GNU with super good optimization and support for OpenMP for parallel programming. There's also the newest gdb debugger that gives pending breakpoint support so we can get rid of a lot of the kludges we had to put in place to support this kind of thing in the CDT. Unfortunately, Windows debugging for MSVC support isn't as complete as I'd hoped, but there has been progress as part of the Target Communication Framework (TCF) work at Eclipse, so we will get there sooner or later.

And, of course, there's Ganymede, including the latest CDT 5.0.1 which will be coming out with the Ganymede SR1 in a couple of weeks. CDT had some really awesome improvements, including new refactoring support, in the 5.0 stream.

So for those waiting, I'm glad your a patient bunch. The wait will be worth it for this critical piece of my continuing effort to get the grassroots C++ programmers and hobbyists, many of whom are working on Windows, into the Eclipse world.

Tuesday, August 26, 2008

Open Source Handhelds

Quite a while ago now I posted about the open source gaming device from Korea know as the GP2X. At the end of the day, it ended up with a storied history and while I love the concept of a handheld mobile device for which you can write your own applications, their execution as a company out side of Korea wasn't that great and only a distributor in the UK was able to make any kind of splash with it.

At any rate, I found on Slashdot that they have announced a new generation of the product called the Wiz. The links lead you to the UK site and a big JPEG of the brochure in English. The specs look pretty good, ARM9 processor at 533MHz, 3D accelerated graphics, Linux of course, and support for audio and video making it a pretty cool multimedia gaming machine, for which you can write your own applications. And hopefully they'll be a bit more successful at delivering it than the last one.

But there are other choices for such open handheld devices. One of the commentors on Slashdot pointed to another one called OpenPandora. It has better specs, including the TI OMAP3 which is a monster ARM Cortex-A8 processor with full OpenGL 2.0 ES (i.e. with programmable shaders) graphics. It comes at what I believe will be a higher price point than the Wiz, but it is more powerful and has a QWERTY keyboard.

Looking at this in combination with the Linux mobile phone thrusts going on reminds me of the early days of the PC. Lots of different platforms doing specialized things that beacon the hobbyist programmer to come play - VIC 20, Commodore 64, Trash-80, ... The PC is relatively boring today, but maybe these devices can bring in a new generation of programmer that loves to play like we did "back in the day".

Android SDK goes beta

Well, if you follow the embedded industry even from a distance, the news that the Android SDK has gone beta is old news by now. I've been so busy p2-izing our upcoming Wind River products that I haven't had time to write here. Time to get my priorities straight :).

Any whoo, there's a lot of competition all of a sudden for mind share in the mobile Linux game. Android has been pretty quiet lately but they've clearly been busy beavers and a real Android-based device seems imminent, so it's time to take them seriously.

The only thing I'm really waiting for from them, however, is open sourcing of their Dalvik VM technology (can't call it Java since it's not Java, but it's Java...). For Java to truly take off in the embedded space, we need a good VM that works in resource constrained environments and runs well on relatively slow processors. Oh, yeah, and it has to be freely available for the kids to play with it. It's there in the Android SDK, but it would be cool to have the source to see how hard it would be to port to other mobile Linux platforms.

Because there are other players in this game and they actually seem to be ahead at this point. OpenMoko has already shipped a new version of their Neo FreeRunner phone. LiMo has a healthy stable of partners with a number of them already shipping devices as well.

So is there room for all of them? No. There is not. As Donald Smith conjectured recently, mobile is becoming more about the software stack than the hardware. Luckily we have more hardware than stacks at the moment, but not by much. We need to see some consolidation here soon so that application developers can start building those killer apps without having to port them to umpteen different environments.

BTW, Equinox running on Dalvik would be very cool. I'm guessing it's not easy. But is this in the works by anyone?

Saturday, August 16, 2008

Eye Candy on the Linux Desktop

My crusade for a better Linux desktop continues. After reading a recent rant from someone at the Inq and recent predictions on what Linux will look like in 4 years time, I thought I'd give another shot at improving my Linux desktop. I've been using it heavily from the command line for manufacturing media for upcoming Wind River product using our Eclipse p2 based installer/generator and for mucking around with ClearCase. I can do all that from putty on my Windows machine. But it would be easier if I could just do it and everything else I need to do right on the Linux desktop.

What I was really after was the 3D effects offered by the Compiz Fusion compositing window manager for my GNOME desktop. After a recent bad experience installing a security upgrade for Fedora 9 which totally killed my machine (no boot up for you), I'm back on Ubuntu 8.04. But, alas, I had to install the proprietary drivers for my ATI video card before I could turn on the effects, which is another can of worms I'll leave for now. But once I did, I was up and flying with some wobbly windows and spinning cubes and windows flying all over the place.

I haven't used Mac OS X or Vista seriously, but I can't imagine any eye candy they would have that Compiz doesn't have. So in that sense, I get the feeling that Linux is making huge strides forward. I still haven't figured out how to get fonts as crisp as I get on Windows but I imagine it could be done. It does indeed appear we're not that far away from a champion desktop for Linux (sorry, watching too much Olympics and I'm finding too many parallels between Linux desktop and the ability for Canadian athletes to win medals, 4th place is great, but...).

But I really liked what the guy said in the article about Linux in 2012. He predicts we will get there, but that it's going to take "for pay" distributions of Linux to take us there. Free software isn't going to do it. And there's good reason. Windows and Mac look so good because of the proprietary software that makes it happen. If we want that on Linux, we're going to have to pay for it, just like we do for Windows and Mac OS X.

We're going to have to pay for the licences to the software that legally plays MP3s and shows DVDs and cleans up my fonts and for someone to make it all work on our laptops without having to edit anything in /etc. That's just the economic reality of it. And I for one have no problem with that. Because I believe you get what you pay for. Free software is great for commodity software like kernels and windowing systems and IDEs written in Java ;) where there's lots of people to help build them. But it takes rare skill to make a great desktop environment. And the guys with those skills hold the cards and probably want to profit from their fortune. To get a great desktop on top of that great OS, it's worth it.

Monday, August 11, 2008

How many threads? No way!

Well, I thought I was being sneaky when I googled for the Intel Larrabee paper that is being presented tomorrow at SIGGRAPH and thought you had to be an ACM member to get a copy but then found it on the Intel site. Everyone else seems to have found it too. To save you the hastle, here it is. I found the link today on Wikipedia so apparently it's no longer secret.

Anyway, I'm more curious about it than anything. And I guess the biggest question I had was how many cores the thing is supposed to have. This will help me measure how pressing the need is to figure out how to program many threaded applications without Joe programmer's head exploding.

Well there's no actual product announcement in the paper, which I guess is the right thing since it's a conference paper aimed at getting graphics programmers interested in their architecture. But the performance charts give a hint. They show the number of cores needed to make some of the popular recent games hit 60 frames per second where you generally need between 24 and 32 cores. They then show some charts showing scalability up to 64 cores. Given that, I think it's safe to say we'll see 24-32 core Larrabees in the not too distant future and grow from there.

But wait, there's more. Each core has 4 threads of execution to help ensure that the cores are kept busy while waiting for cache and memory and I/O and stuff. That gives you up 256 concurrent threads in the 64-core monster and 128 in the regular 32-core machine. That's a lot of threads. And, yes, it'll be hard to write applications that can get the maximum performance from these.

One other thing I found interesting is that their performance tests were done with the cores running at 1 GHz. That's pretty slow by modern standards. And it explains why they are focusing on graphics co-processor applications where programmers are already trying to figure out how to make things more parallel. If you don't, you're single threaded application running at 1 GHz will be pretty slow (trust me, I have a 667 MHz Pentium III at home, brutal). So until multi-threaded programming becomes more mainstream, don't expect to see one of these things running your Office suite or Eclipse - even though it could.

Friday, August 08, 2008

Carmack the Magnificent

(BTW, the title of this blog entry is a spin on one of my favorite TV personalities from many years ago, Johnny Carson)

I just finished reading an interview Tom's Games did with John Carmack, the mastermind behind id Software. I love hearing from him. He's very respected in the gaming industry, is a really smart guy, is totally a geek, but has a good eye on the industry. You learn a lot about where gaming is going technology-wise and business-wise by listening to him.

A couple of things he mentioned interested me. He did bring up multi-core computing and how gaming programmers are still trying to figure out how to take advantage of all those extra concurrent threads. As with everything, it's going to really change the way programmers think. In what I'm sure was a Freudian slip by the writer, he used the word "paralyze" instead of "parallelize". I think that's exactly what's happening. Programmers are paralyzed as they try to figure out what to do. It goes against everything they've been trained.

On the good news front, though, I've been playing a little with the dataflow programming paradigm and I'm liking the way it makes me think. Essentially you have huge number of processes that have data streams between them. You're program becomes a network of co-operating virtual machines. Makes sense to me but it needs to be tried out on a real application. And I think gaming is that perfect application.

As a side note, John also talks about the iPhone and how it can be a great gaming platform. His wife says it's a terrible phone, which I'm sure it is, but using these things as phones is becoming secondary to the other applications that can run on them. I'm pretty sure that's where the future of mobile devices is headed. Forget the phone, they're just great little network appliances.

Wednesday, August 06, 2008

How's build working for you?

It's been a crazy couple of months for me. The list of things I need to do has been badly encroaching on my time for Eclipse community work. But it's all been good and we're working on some really cool stuff with p2 internally here at Wind River which should turn into community work as well anyway.

But it's getting time to start my work on e4 and the Eclipse resource model. We've talked a lot in the past about the need for flexibility there and to support other resource models that don't necessarily map to the underlying file system. Even in the last few days we've received inquiries on the cdt-dev list about supporting Visual Studio-style projects in this manner (from a guy with an e-mail address of nvidia.com - quite interesting). So this is what we've meant by flexible resources and what we plan on addressing.

The question I'm starting to ask myself is whether we should be looking at the build side of the resource model as well. If you come from the Makefile centric view of the world, the Eclipse build system is very bizarre indeed. I'm not sure of the history of how it got to be that way, but it was our first real interaction with the Eclipse Platform team, to somehow get Eclipse to build CDT projects correctly. There's still a lot of magic there that probably could be simplified if we made the build model more flexible as well.

Also we have a hell of a time co-ordinating loading the CDT build model data from our magic .cproject file at the right time and in a scalable and non-deadlockable way. Sometimes I just wish that the .project file and the code that manages it was more flexible as well so I can have our build data loaded at the same time the rest of the project information is loaded. (Yes you can do a little of that now but not easily with the complex data we have for our build configurations, tool chains, option settings, etc).

Anyway, I don't know how many people are building IncrementalProjectBuilders out there (and, yes, the weirdness does start there). But I was wondering if other plug-in developers are also facing issues like this.

Monday, July 28, 2008

Going with the data-flow

I've just been reading articles in Wikipedia on dataflow programming. This programming paradigm captures what I think is the greatest need we face to built the multi-threaded applications of the future. It also explains where a lot of the concepts in UML Actions and Activities come from.

From what I understand most of the dataflow languages are visual languages. The SynthMaker tool that came with my Fruity Loops is like that. The page also lists the hardware description languages, Verilog and VHDL, in this category. I think they've left out SystemC since it fits into that mould as well.

But even if dataflow programming is the big new paradigm, I firmly believe that any new paradigm will only be mainstream if it's familiar to developers. There's been some great programming languages over the years that you would swear are much better than C (Ada comes to mind, Pascal was really good too), but if you look at the most popular languages in use today, C-like languages, and C++, Java, and C# in particular, win by a land slide.

So it comes back to what I was mentioning earlier. SystemC is a great example of a C++ library and run-time that implement a different programming paradigm but let you reuse all the skills you've learned with other C++ applications. And, it's an example of a language that supports dataflow programming which we need for massively multiprocessing applications. It's definitely a source of inspiration.

Wednesday, July 23, 2008

Who's leading anyway?

The LinuxHater linked off to Christopher Blizzard's (from OLPC fame and now at Mozilla) blog on the current state of affairs with the GNOME project. He gives some very eye opening insight into what's happening there and the potential future directions for GNOME, GTK, and friends. It's not pretty, literally.

GNOME is getting big in the mobile space, or at least the number of contributors from that space is starting to dominate the GNOME project. And as we all know in the open source world, the contributors are the leaders and get to make the decisions. What this likely means and what blizzard is afraid of is that the GNOME desktop is not going to get the attention it needs to compete with the modern interfaces it competes with. The commercial interest just isn't there to make it happen like it is with GNOME mobile.

He explicitly spells out Qt and Apple as leaders in making good user experiences and developer friendly APIs. My favorite quote of his: "If in a platform-driven market and a platform-driven world you’re not the #1 or #2 player it’s going to be very difficult to make a dent in the market. (This is especially true if Nokia decides to fix the Qt licensing.)" I agree on both fronts. I can't see how GNOME is going to grow without serious innovation. And I hope that Nokia fixes the Qt licensing (wink, wink, nudge, nudge).

Being CDTDoug and focused on embedded and mobile at Wind River and on the success of CDT for Windows development with Wascana, why do I care so much about the Linux desktop? Well I think it's the missing piece in the open source success story. We have Linux as an overwhelming favorite in the server market and it's growing in great strides in the embedded space. But without success on the desktop, my Mom isn't going to care. Which means Microsoft and Apple and closed source technologies as still seen as the right path to innovation by the general public. And until "I am a Mac" dukes it out with "I am a Linux PC", there will always be doubts on whether open source can compete with the big boys.

Monday, July 21, 2008

LinuxHater, a touch of tough love

From now on, I defer all my opinions on the quality of the Linux desktop and the open source projects that work on it to this guy, the LinuxHater. I started reading this blog after I ran across this article on the 'Z' via the 'dot' written by a guy from Google. It really hits home what both of them have to say.

The hater shares some really honest opinions using some very colorful language (warning - if you're sensitive to that kind of thing) on everything from how hard it is for his grandmother to get into Linux, to how all the forking and duplication that's going on FOSS community is doing some serious harm to our ability to build up the Linux desktop to compete with Mac and Windows. It's a really funny read. And I have to agree with the Google guy. Given how much the hater knows about what he's writing about, he's really a Linux lover who desperately wants Linux to succeed but is loosing his cool in frustration.

And it's hard to argue with what the guy says. Open source is about freedom, freedom of the developer to build whatever he wants, however he wants it. And if he doesn't like working on a project, he can start his own, and even fork the code. What he can't do, however, is fork the developers. And that's what's killing the Linux desktop. Too much duplication is watering everything down. Everyone's so focused on building the best framework, they're forgetting about the average end user who doesn't care, or have the capacity to care, and just wants something that's easy to use and works.

With Eclipse, we're making conscious efforts to avoid this problem. At almost every project creation review someone asks whether the project is duplicating some other project and, if so, we work hard to get everyone to work together to resolve it. I think it helps that Eclipse is very much commercially driven. We understand the economics of open source development. We have very limited resources to invest, and it's so critical to work as a team with other companies, even if we compete in the marketplace. If we can get over that, why can't Linux desktop projects, who don't even have a financial vested interest in succeeding, do the same?

But there's a lot of politics in open source, especially with projects close to the Free Software Foundation. I'm not sure how we get out of it. Hopefully, those involved can see through the sarcasm and listen to the message. Linux rocks as an operating system, it really needs a desktop to match, and the community needs to unite to provide the sufficient resources to build it.

Friday, July 18, 2008

Important safety tip

So when you go to redefine the key sequence in Eclipse to do 'Build All' make sure you're hitting the Ctrl key and not the Shift key. It explained why I couldn't define the CXXFLAGS macro in my Makefile. Instead of Ctrl-X Ctrl-M for build all, I had accidentally defined it as Shift-X Shift-M. Weird (that it let me), Cool (that I could do it), but took me a little while to figure out that's what it was and not something wrong with my keyboard when Shift-X didn't do anything :)

BTW, thanks out to the guys who are contributing to the Emacs key bindings. I'm loving it! All I need to add is this Build key sequence, which Emacs doesn't define either anyway.

Thursday, July 17, 2008

Now where's that include file?

Yeah, C++ refactoring is our biggest achievement for CDT 5.0. But here's one I found probably more useful in my day to day use of the CDT (which is getting more and more lately which is awesome).

I have a burning need to learn GTK development. I have a little dialog based app that needs to run on Windows, Linux, and Solaris. I have the Windows version done using MinGW's support for win32 programming (now there is an experience for you). Now I need to implement the same thing in GTK for Linux and Solaris.

So I'm going through the GTK 2.0 tutorial on the GTK web site and the first thing it get's me to type in is:

#include <gtk/gtk.h>

The first thing the CDT does is throw up a warning marker on the line complaining that the CDT indexer couldn't find that include file. Being suspicious, I did a build and sure enough the header file wasn't found. With all the great work the indexer team is doing I really should trust what it's telling me.

So I fired up the Ubuntu package manager and found out that the GTK devel package is indeed installed. What's up?

Then I remembered one of the new CDT features I stumbled across in my 5.0 testing that we really should tell people about more. I went back to the #include statement and after <gtk, I pressed Alt-/ (I use the emacs key bindings, Ctrl-Space for the rest of you). And sure enough, content assist offered me all the include files and dirs that being with 'gtk', including the one I needed, gtk-2.0.

It's just a little thing, but one of the great examples of the information that the CDT can gather for you to help improve your productivity. And it's time to tell people about it...

Tuesday, July 15, 2008

A tribute to ObjecTime

As I mentioned recently, I've been thinking of how you could program UML-like actions using C++ in a manner similar to SystemC. As I worked through the workflows of how actions could receive data and signals on input pins and send stuff on output pins, and how they all hook up together, I started to get a deja-vu feeling.

It brought back a lot of good memories from my years at ObjecTime. You know, we had a lot of this stuff back in the 90's. Mind you, it was almost totally focused on state machines that communicated with eachother using messages, but it had a lot of the multi-threading, action oriented development that we need for multi-core systems.

It was a fun time back then. We were a company of 150 or so working on something we were all very passionate about. It was one hell of a team. And we had some big customers but not many of them. When Rational bought us we saw it as a good thing that would lead our work to greater exposure and a bigger sales force. It didn't pan out that way, but the team lived on and a lot of them are still working on modeling tools for Rational which is now a division of IBM.

But one area where I think we failed was in adoptability. We had some passionate early adopters as customers but there are only so many of those. You certainly don't want to build a business with only that. And it was hard to get the code centric guy to trust the modeling and code generation tools. Let's face it, when it comes to crunch time, you'd rather be in with the code with age old and trusted tools and the modeling tools easily fall by the wayside.

Anyway, that's why I work on the CDT now. Code rules, at least for now. But as we try to introduce complex programming paradigms to facilitate multi-threaded development, I got to wonder if there isn't another ObjecTime out there. We where years ahead of the industry and we knew it. I had feared that the time would never come, but maybe that's not true after all.

Monday, July 14, 2008

The word with Mark Shuttleworth

I ran across (with the help of slashdot :) this interview with Mr. Ubuntu, Mark Shuttleworth, and found it very interesting. It's a good insight into how a commercial entity is successfully, or hopefully successful, working with the open source community to make things better. I've complained a lot here about the Linux desktop experience and Mark feels the pain and is trying to do something about it.

A couple of interesting points he brings up. One is on the Gnome/GTK versus KDE/Qt battle that's been going on for years, and for years too long IMHO. And he mentions the point that I think is really underlying the issue and that's licensing. GTK is popular because it's LGPL which allows for software using it to pick their own license. Qt is technically and aesthetically better, but sorry, unless it's commercially friendly in a free form, it's going to lose the battle. And apparently it is losing from what is stated in the article.

And as long as the battle continues and the Linux community spend their limited resources on two desktops, the Linux desktop user community is going to pay the price. Mark discusses why he sees Mac OS X as the biggest winner lately in the desktop wars. It's because of Apple's dedication to providing an innovative user experience. That's going to be hard to achieve with Linux without the community rallying behind fixing it, or a major vendor stepping up and investing in it. It sounds like that's what Mark is going to do with Canonical, but they aren't really a major vendor with big pocket books, at least not at this point.

Anyway, an insightful read. A lot of the discussion should be familiar with the Eclipse contributor community. Working and influencing open source is a difficult task and requires some specialized talents. And apparently that bodes well for those that figure it out.

Friday, July 11, 2008

A lesson on SystemC

Here's a quick look at an example of SystemC code, you're traditional NAND gate:

SC_MODULE(my_nand) {
sc_in<bool> a, b;
sc_out<bool> f;

void run() {
f = !(a && b);
}

SC_CTOR(my_nand) {
SC_METHOD(run);
sensitive << a << b;
}
};

It looks like some of hardware description languages I've seen such as Verilog. It lets you model inputs and outputs and a process here named run that takes the inputs a and b and does a nand to produce the output f. And it's all continuous. The module will change the output value as the input values change.

The crazy thing is that this is C++ code. SystemC is a collection of header files that define the templated classes, such as sc_in, and some macros, such as SC_MODULE, as well as a runtime library that models the continuous nature of electronic signals and calls the process methods, such as run in our example, to execute the behaviors at the right time. Very cool use of C++ IMHO.

Now UML Action Semantics isn't that much different than the behavior and structure modeled here. You have actions that have input pins and output pins and a behavior that runs when all the input pins are ready. All actions run in parallel. It's a discrete event system as opposed to continuous, as software tends to be as opposed to hardware. But I wonder whether we can use C++ in a similar way to program action semantics.

With a runtime that uses the underlying OS threading system supporting multi-core systems to run the actions in parallel as much as possible and the familiarity of C++ and existing C++ tools, like the CDT :), but used to program a paradigm very different than traditional sequential C, it has me intrigued...

Wednesday, July 09, 2008

All eyes on Larrabee

There's been a bit of talk on the web-o-sphere about a report out of the German tech magazine Hiese.de that claimed that the Larrabee multi-core processor that Intel was working on will contain 32 original (well, second generation, but still 20 years old) Pentium cores. In the end, it appears to be just speculation and Intel was quick to squash the rumors. But the logic behind the speculation seems plausible.

The old Pentiums where 3 million transistors and with the new GPUs coming out with over a billion, you pack a lot of cores onto one of those. And I like the concept. Something old is new again. Simplify and multiply. There are a lot of transistors in modern CPUs just to handle out of order execution and try to do as many things at once at the instruction level. But that's pretty complicated but made it simple for the programmer. We've gotten pretty good at doing the simple things, why not just take a step back and use what we know. But, of course, you still need to software to take advantage of it.

Reading the discussions really opened my eyes a bit more. This 32-core thing really is possible and will happen within the next year or so. Are we ready to build software applications that can do 32 things at once in an organized fashion. Thinking about it a bit over my holidays here, there is some existing technology we can use and it'll be pretty familiar. I'll blog more about it in a couple of days or so, but think C++, generics, SystemC, UML action semantics. Mix them all in a pot and I think we can come up with some "soup for the multicore programmer's soul"...

Wednesday, July 02, 2008

Are you ready for 1000 cores?

Massively parallel computing is something I've been interested in for a while and have blogged about a few times in the past. This blog entry by an Intel Researcher made me think about it again. He continues to proclaim that the future isn't that far away and we had better start designing our software so that it can run on machines with thousands of cores. He worries that we're aren't ready yet and we need to start getting ready. And he's right.

Being a tools guy, I think this is the next big paradigm that the tooling industry needs to address. Object-oriented programming and design was a godsend when machines started scaling up in the size of memory and storage and our programs began filling that with data. We built a lot of tools to help with that. Programming languages and compilers are obvious examples. But so is the JDT and CDT, with their code analysis to show type hierarchies and help you easily find classes. Not to mention all the object modeling tools for drawing pictures of your classes.

Coming up with the languages and compilers and other tools necessary to deal with thousands of concurrently running threads is our next great challenge. This is why I keep one eye on the Parallel Tools Project at Eclipse. They're already in this world dealing with the thousands of processors that run the super computers they work with. This effort is a research project in itself (quite literally if you notice who participates in this project :).

But as the Intel researcher warns, this stuff is going to hit the mainstream soon. We're starting to see that with OpenMP parallel language extensions supported in almost all recent compiler releases, including gcc. And I'm convinced it's an area where modeling can help since you really need to think of your program in multiple dimensions, which is something modeling is good at.

I think it's a matter of time before we're at the head of a new paradigm. I remember the fun we had when object-oriented programming hit the mainstream. I think this one will be just as fun.

Saturday, June 28, 2008

Bye Bill. You will be missed

Reading the news I see that today was Bill Gates last day at Microsoft. Apparently, they held a tearful farewell in Redmond for him. And it really does mark a significant moment in the history of our industry and a time to reflect.

If I had a dime for every time I read someone say that Bill Gates crashed their machine or was someone personally affecting their life in some negative way, I'd be as rich as he is (well, maybe not). But as much as you may hate Microsoft and the methods they've used to drive their vision, you have to take a good look at what Bill Gates and company have done and how they've succeeded.

The biggest thing I learned from watching Microsoft is how important it is that you keep focus on software as a business. You may have the coolest widget or the cleanest framework or the fastest algorithm, but unless you have a business story and good business people around you to help sell it, it won't matter as much as it could.

And Bill Gates knew that. Surround yourself with good business people and you give yourself a chance. I've seen it too many times, great technology that has floundered because the team focused too much on the technology and forget to bring the marketing guys into the team, if they had marketing guys to begin with. And it's frustrating to see.

So on this day, even though I'm trying to build a C/C++ Development environment with the CDT that can beat Microsoft Visual Studio at it's own game, I pay tribute to Bill for all he's accomplished and all he's taught this industry. He doesn't hate you, he's just following his business plan.

Wednesday, June 25, 2008

CDT 5.0 for Ganymede, Come get Some

CDT 5.0 is out the door and available at your friendly Ganymede update site. I'm sure the Eclipse servers will be busy the next few days. The Eclipse community is vast and they love trying out the shiny new features that we've worked hard on all year to make.

I'm especially proud this year with CDT 5.0. With my new job at Wind River working on a p2 based installer, I've finally have a real reason to use it to write the JNI code that I need for some of the computation intensive parts of it. BTW, I now have proof that the Java version of an algorithm is much, much more compute intensive than a C version, check out the LZMA SDK from 7-Zip.

I'm really enjoying the experience. When I first imported the LZMA SDK into my C project, the first thing I needed to find out was where the main() function was. Let's try the Open Element dialog (Shift-Ctrl-T), typed in main, and there it was! A couple of Open Declarations (F3) later, and I was able to find the implementation of the decode function I needed to use. Awesome and I didn't even notice the Indexer running to find all this stuff. And everything else looked clean and worked well.

So yeah, the JDT guys are probably laughing since they've had all that stuff working well for a few years now. JDT has always been our bar (along with VisualStudio which I think we reached a while ago). But watch out. We may just make the CDT so good that people will wonder what the hype about Java was all about :)

Tuesday, June 24, 2008

:-O Nokia buys Symbian to EPL it

Wow. In case you missed it, Nokia bought up the rest of Symbian (it was already a major investor there) and have united with a number of Symbian stakeholders to form the Symbian Foundation to which Nokia will be contributing the Symbian OS. And from there, they will be working to provide an open source, EPL licensed, version of it.

Wow. We have CDT committers from both Nokia and Symbian and they are a great bunch. I still haven't figured out whether this is a good thing or not, but it certainly stirs up the pot as far as open source mobile platforms go. I think it also helps secure the future of the Symbian OS as a technology. It's hard to compete against the hype of Google Android and at the very least this will give Symbian some attention.

It'll also be interesting to see what kind of community evolves for it. They've certainly seeded it with companies that have a vested interest in Symbian's success. That'll give them a good start. As we all know in Eclipse-land, it's a lot of work to grow a community. But maybe growth isn't the prime objective here. We'll have to wait and see what the pundits say, but going open seems to be the most popular strategy these days to help ensure sure your platform matters. Mind you that may be the Google-envy speaking ;)

Tuesday, June 17, 2008

Back on Linux

I don't know why I get the urge to blog about my Linux journey. I'm sure it's not very interesting. But after a few days of working hard trying to set up ClearCase the way I want it so I can generate p2 repositories from our Wind River product release views, I've gotten back to why I was a *nix guy back in the day before Windows became a much better desktop.

I guess when you find a use for cpio, you are clearly destined to be a Linux junky. I've also fallen in love with NFS automounting (shh, don't tell my wife, she'll find that weird). When I can go 'cd /net/yow-dschaefe-linux' and get to my Linux box from anywhere on the WAN, that's pretty cool, not to mention handy. Doing a 'cpio > /net/yow-dschaefe-linux' from a ClearCase view on a Linux machine in California to my box in Ottawa and have fairly decent performance, that's the greatness of Linux file systems in a nutshell.

And using KVM to set up a virtual machine to run the version of ClearCase I need and from there to NFS mount a directory from my real hard drive and then to do a ClearCase view export back to my real machine so I can run the generator at full speed, it just rocks. It's not for the meek and it has taken me more time that I wanted to figure it all out, but Google is your friend and now that it's set up, I'm ready to go.

So, yes, I still think Windows is the better desktop, but for file and compute servers, Linux is clearly the champ. But of course, you all know that already :)

Friday, June 13, 2008

OSGi for native development?

I hinted at this topic in my last entry and when giving my crazy thought of the day last week. It's another Friday, but judging from the comments to those blogs and my gut, I'm convinced now that an OSGi implementation for native development isn't really that crazy.

Everyone has heard of the Microsoft Component Object Model (COM). Even if you don't chances are you've used it. It's now getting long in the tooth but it was a critical technology that led to the success of the Windows platform starting with Windows 95. It was a great way to build up frameworks with plug-ins and to write components that used the services of other components, e.g. a Visual Basic script that ran inside Excel.

But of course, COM is very specific to the Windows platform mainly because of it's reliance on the Windows registry which provided the directory to find the COM classes and objects you need. It also had some weird tricks with threading models and some wacky things called thunks to help to help performance when we were running Windows 95 on our old i486 machines.

But it's been done and there's lots of things we can learn from that, and from the limitations of some of the others, like CORBA. Using C++ as the core technology is one thing we would need to avoid. Different compilers have different ABIs, like how virtual function tables are laid out. As much as we try to evolve, at the end of the day, C is still the best language for interoperability and almost every language provides a way to call C functions.

There was some discussion in the OSGi community around something called Universal OSGi lead by Peter Kriens who is also involved in Eclipse. If anyone knows the status of that I'd be happy to take a look. It shouldn't be too difficult to start with the OSGi APIs that make sense and start implementing a framework to support it.

Thursday, June 12, 2008

Are you situationally aware?

Part of my trip through geekdom lead me to Microsoft Flight Simulator. I've dreamed of becoming a pilot but never had the resources or eyes to do it for real. FS gave me a chance to play and get some sense of what flying is like, mind you without the inner ear working for you, it's certainly nowhere near the same.

Part of the thrill of FS for us geeks is the ability to add your own plug-ins to implement your own instrument gauges and your own airplanes. The gauge SDK was particularly interesting to me and lead me to ponder whether one could create a reasonable flight navigation system with maps and data, much like is common place with modern GPS systems. I think I had enough info to pull it off, but of course, never got the time to do it.

That investigation did help me cross paths with Garmin. They are the leaders in flight navigation systems for general aviation aircraft. They have some pretty sophisticated software and some pretty solid hardware to make it easy to navigate an aircraft through the airways. And they keep getting better, going from simple textual lcd screens, to two dimensional graphical displays showing maps in 2D. And the displays kept getting bigger and contained more and more information to help a pilot with his situation awareness, a key to survival in the cockpit.

And now, they've added 3D display of the terrain and obstacles and other aircraft in your vicinity. Here's a video of a reporter talking to a Garmin rep. It's like the world coming full circle. Instead of trying to figure out how to make a video game more real, they're trying to make reality more like a video game! The reporter asked the right question, aren't pilots going to be more interested in watching this wicked cool technology than look out the airplane like they're supposed to? I know I would.

Anyway, I hope this is the leading edge of what we'll soon see in embedded devices where it makes sense, i.e., more use of 3D graphics. I think it really helps the user experience be more real. We're seeing it already with Mac and Vista. And with announcements like Nvidia's Tegra and seeing what the Garmin has done with their system, I can see it useful for devices as well.

BTW, speaking of the FS SDK, when I mentioned OSGi for C++ the other day, that SDK came to mind and is a great example of how to build a simple component model with interfaces for providing services into a common framework. There are certainly other examples and makes me think standardizing on one at least similar to OSGi, might really be a good idea. More on that later...

Friday, June 06, 2008

Crazy thought of the day

It's Friday. It's been a pretty busy and long week. Got lots done. Working on lots of Eclipse related projects both internal and external. The Red Wings won the Stanley Cup (although I'm very proud of the Pittsburgh fans for their behavior after their team lost at home, they're real hockey fans). I bought a new car (a little Mazda 3 Sport, love it! but hate car shopping). So I think I'm allowed to think some crazy thoughts once in a while.

This one sprouts from a couple of different triggers. First, the latest Emacs discussion and how it would be nicer if we could integrate Eclipse better in a command-line environment. Second, comes from my interest in GUIs for embedded systems. Flash is one idea and trying to figure out how you'd hook a C/C++ app on a device to a Flash-based UI. Third comes from a bit of OSGi envy in that it would be a huge help to C/C++ developers if we had a component system like it.

So the crazy idea is this. Rewrite Eclipse in C++. Maybe rewrite isn't the right word since I hear there are people out there who actually like Java ;). But start producing C++ components that look a lot like Eclipse. I'd start with SWT which is a layer over top of some C and C++ code anyway. Shouldn't be that hard. You could then look at a C++ implementation of OSGi. Bundles would be easy to make, just use DLL/so's instead of jars (of course, I'm missing the point on other componentization issues that OSGi deals with but I can't be that far off). Then continue to add things as they make sense or people have a need.

I did a quick search, since I'm pretty sure the C++ SWT idea had been thought of before. I found a company, PureNative Software, that has actually done it. Mind you, they are using their proprietary Java to C++ compiler to do it, and I would think that leaves in a lot of the glue that SWT uses to bridge the Java/C++ world. But they do have a compelling story.

So I'm going to try and contact myself in a parallel universe to start working on it. Or maybe it'll just remain a dream. But I'll throw it out there to see whether you think it's such a crazy idea or not.

Wednesday, June 04, 2008

Eclipse versus Emacs, a battle unfinished

I was watching a presentation and someone was talking about integrating gdb with Emacs and showed a screenshot of it in action. I was at the back of the room and I had to squint, because when i first saw it, I swore it was Eclipse.

In this day in age of Eclipse having every feature of Emacs, save a good scripting and keystroke record/playback story, why would anyone still be using Emacs?

Well, of course, you'd be foolish to think that everyone using Emacs is just going to drop it and jump on the Eclipse bandwagon. And there are still some major technical hurdles that force you to be sympathetic with them.

And this is the challenge we face, especially in the technical and embedded space where the CDT is most popular. Eclipse is too big, too slow to start, and the UI too complex and unless we start addressing some of this, it's still going to be a fight to get these users to buy into our story. There is a lot of value to the extensibility and integration story we are selling, but if the barrier to get Joe and Jane developer to even start the thing is too high, it's no good.

With all the talk about e4 and new architectures for the new world going on, we also really need to take a long look at how we can finally beat Emacs. Yes, I'm CDT Doug, but I still use XEmacs on Windows as my main text editor, even to look at C++ files outside of workspaces. I shouldn't have to, you'd think...

Can old NeWS be new again?

I'm going to really show my age here. Back when I was doing my Masters degree at the University of Saskatchewan (now there's a Canadian word that's hard to say even for Canadians), I was doing graphical representations of software models. Yes, my modeling roots go back 20 years. Essentially, I was trying to come up with a generalized diagramming model that could represent different modeling languages.

When it came time to do the prototype, I had a choice of windowing systems that ran on our Sun and HP boxes we had in the lab. Of course, we had X Windows, X11R2 if I remember correctly which was much better than X10.

We also had this new system from Sun called the Network extensible Window System. It was wacky but very cool and had a wacky and cool acronym, NeWS. Essentially you programmed the window server using PostScript (of all things) that was extended by Sun to handle windowing and input devices and asynchronous communication back to the client. It was quite bizarre to be writing PostScript code to do UI but it was a good way to separate UI from Core with an efficient protocol you got to create yourself to best suite the application.

Unfortunately, the implementation was very slow and awkward and the co-operative multi-tasking made it impossible to debug endless loops (but it did help me learn the Sun equivalent of Ctrl-Alt-Dlt). I eventually picked X Windows and this wacky new language called C++ and the rest is, well, even more history.

What NeWS reminds me of today is this whole concept of Web 2.0, and Flash/Flex in particular. And not because PostScript and ActionScript have the same suffix, but because the architecture is very familiar. And it made me wonder if we could use it in the same way, as a windowing system. I can't remember how I programmed the C side but if we used a similar API and protocol would it be any good? Now if I can only find some 20 year old documentation to find out.

Monday, June 02, 2008

NVIDIA enters the mobile space

I'm a fan of NVIDIA. I have their graphics cards in my computers at home and one of them has an NVIDIA chipset-based motherboard. I especially like their drivers both for Windows and Linux (yeah, I don't care if it's closed, it's still free). It all leads to a good user experience and a happy customer.

So when they make a big move, I pay attention. And today they announced their Tegra product line. News release is here. And a good analysis from Tom's Hardware is here.

Now, NVIDIA isn't creating anything new here. They're entering a market that's already dominated by some big players, including Texas Instruments (a CDT contributor), Freescale (another CDT contributor who's actually a committer), and others. And I'm sure these guys are saying "Big deal", been there, done that.

But the reason I find it interesting and potentially game changing is the reputation that NVIDIA brings with it as it joins in the fun. NVIDIA is known for cool products that entice excitement, especially with their video card business (just look at the flashy website they have). And I'm sure they'll bring that with them. Which, at the end of the day, will result in some really cool mobile internet devices, or MIDs as their marketing guys call them, which have some impressive video and gaming applications but with long battery life.

I'm pretty confident the other guys will spruce up their products to match, which in then end means a further invigoration of the mobile computing space. It's a fun time to be in the embedded software business.