|
Go Small or Not at All
Researcher "Squawks" about Resource-Constrained Devicess By Al Riske 10.December.08 - Eric Arseneau likes to think small. Very small. "I'm trying to go to as small a machine as possible," says the software engineer. No problem. That's been the trend in technology, right? Smaller, faster, cheaper. All that must work in his favor. Not so fast. "I would like to see Java running on something that has 16K of flash memory and a few bytes of RAM," Arseneau explains. That's a much different frame of reference than someone doing, say, desktop programming. Arseneau's target? The microcontrollers embedded in all kinds of things -- wrist watches, electric shavers, toys, toasters, greeting cards, environmental sensors. "People get excited about a couple billion cell phones. Well, there's an implied limit to cell phones. Most people only have one," he says. "I'm trying to go one or two orders of magnitude beyond that. I'm trying to get Java into the things that are all around you that you might not even realize have some kind of computer in there."
Arseneau is the principal investigator on Project Squawk, which aims to bring Java software to small, resource-constrained devices. The original purpose of the project, before Arseneau took the lead, was to implement a Java virtual machine in the Java programming language, making it far easier for folks to experiment with new algorithms and make the VM faster or better in some way. "If you look at virtual machines [most are written in low-level languages such as C], they are quite hairy pieces of code," Arseneau says. "People tend not to experiment with them." His predecessors accomplished their goal, he says, but he has a new focus, and the term virtual machine no longer seems quite right. He prefers Java execution engine. "Virtual machine, for technical people, implies a fair amount, and when I say I want to run in 16K and a few bytes of RAM, they all say, 'You can't get a virtual machine in there.' And I tell them, 'I never said I'd get a virtual machine in there; I said I'd get Java in there.'"
This is where Arseneau's thinking turns highly contrarian. First, though, it may be helpful to understand a bit more about the microcontroller market, where each manufacturer tends to use its own proprietary design, programming language, and set of tools. "Embedded development is not quite as easy as doing regular development," Arseneau says. "You have to deal with some fairly hard constraints as well as some very idiosyncratic things with the languages and tools." Which makes this fertile ground for a write-once-run-anywhere technology like Java. The only problem is that even Java Micro Edition is considered too "fat" to squeeze into a microcontroller.
Arseneau, however, sees a way to get many, if not all, of the benefits of Java technology without the need for Java Micro Edition, Java Standard Edition, and Java Enterprise Edition -- without giving up any of the features that make Java appealing. "If you look at the way Java is done today, there's a Java platform that's assumed to be there and it's identical on all the desktops, for example, that we want to run on. Users have to have Java installed before they can run Java applications," he says. "I'm turning the model around a little bit where I'm basically giving the developer the capability to develop an application that runs by itself. The end output will be an executable that will stand on its own. It doesn't have to have the Java platform pre-installed."
Arseneau came to Sun five years ago because he was frustrated with Java and wanted to improve it. "What I was hoping to do was get into Sun through any means possible and then finagle my way into the Java organization to figure out a better way to do this," he says. He joined Sun Labs and ended up taking over Project Squawk. "I really bit into it hard," he says. "I love to work with what I call resource-constrained machines. The first computer I ever worked with was a Commodore PET 2001 with 8K of RAM and a 1 megahertz CPU. My brothers and I saved up for an entire year to buy a 24K expansion board and when we got to 32K we couldn't conceive of ever wanting more than that." Fast forward a few years and the numbers are now a few orders of magnitude higher. "But I think people are wasting resources. The fact that resources have gotten cheaper does not mean that you have to use them up. The fact that they've gotten cheaper means you can do more. It doesn't mean you have to be lazier about creating your applications and not worrying about resources. You should still worry about them. Maybe not as much as you would in a resource-constrained environment, but you should think about these things -- and people don't anymore." Arseneau's reasoning applies to big boxes, too, he points out. "One of the purposes of a big server is to run as many processes as possible. Well, if you want to run many processes on a CPU, you need to take extreme care about how many resources you take up. The more resources you take up, the less processes you're going to be able to run on a single machine," he says. "But people have lost that mentality. They just assume that because they've got gigabytes and gigabytes of RAM, they never have to worry about it. It's turns out that's not quite true." Indeed, he'd like to see Squawk in the service CPUs in Sun's own servers.
Right now, Squawk is the Java execution engine in Sun Small Programmable Object Technology, or SunSPOT, and the team (Arseneau and fellow engineer Derek White) are well on their way to getting it into a number of other devices they aren't able to talk about just yet.
"For us, the really cool thing is the more we enable these types of devices, like sensors, the more data people end up being able to collect and do useful things with. Well, that data has to go somewhere," Arseneau says. "When you think about the fact that people need to store the data, need to process the data, need to present it -- these are all things that involve Sun technology." Squawk, he figures, could be the catalyst for new applications, new network services, and new server and storage sales. "What Squawk brings to the table is a core set of operating system services and a way of executing Java on your device," he says. "What we're trying to bring to this marketplace -- I call it the micro-embedded market -- is the flexibility of Java, along with industry-standard libraries, tools, and practices."
Arseneau looks at a musical instrument such as a keyboard and thinks about what's inside. "That was programmed by someone and that someone was probably banging his head against the wall, not enjoying the experience," he says. Why not? Because it was probably done in a specialized language without many of the programming and debugging tools available for Java. Arseneau notes that Java is not the perfect language for every application. "From a personal standpoint, I would much prefer doing Smalltalk. At least that was my position a few years back. When I came to the Java marketplace, I realized there's much more to Java than just the language. There are the available libraries. I can go on the net and find someone has written a library that does the most esoteric thing you can imagine, so I don't have to reinvent the wheel. That speaks to time to market," he says. "Take that and add the tools that are available for Java, and wow!" But as he sees it there is still one problem, and he's trying to address it. "Write once, run anywhere means you have to adhere to the lowest common denominator. Then how do you differentiate yourself on platforms that allow native applications?" he asks. "If you have a feature phone that only allows applications to be installed that are JME-based, then everybody is playing on the same level field. But if you look at something like the iPhone, you're not on a level playing field anymore, because Java needs to compete with native iPhone applications." In fact, Java isn't really allowed on the iPhone. Not in the way most people think of Java. You are not allowed to install bytecodes or plugins on the iPhone -- and a Java Archive file, the standard distribution model for Java, contains bytecodes. Squawk is different. Squawk has a tool that converts Java Archive files into executables, which are allowed. "Now some people might say, 'Wait a second, that's going to mean your applications are going to be bigger now, because if you have more than one Java application there's going to be some duplications of services. I agree that that's the case; I just don't think it's that big of an issue because the size of our applications are in line with and equivalent to a native application that would be written for that platform anyway," Arseneau says. He also recognizes that extra work will be required to move from one platform to another, though he argues that, in his experience, that's often the case anyway. "This is where people choke, people who are what I call the Java police. They say it's not Java. Well, look, it both is and it isn't. What I'm trying to do is to enable developers to build their applications the way they want to, using tools and services that are standardized," he says. "However, if they want to be able to customize it, I think they should be able to." |
|
|||||||||||||||