HomeDigital EditionSys-Con RadioSearch Java Cd
Advanced Java AWT Book Reviews/Excerpts Client Server Corba Editorials Embedded Java Enterprise Java IDE's Industry Watch Integration Interviews Java Applet Java & Databases Java & Web Services Java Fundamentals Java Native Interface Java Servlets Java Beans J2ME Libraries .NET Object Orientation Observations/IMHO Product Reviews Scalability & Performance Security Server Side Source Code Straight Talking Swing Threads Using Java with others Wireless XML

Broad ranges of deployment choices are available to developers as they engage in new projects that will leverage the power of wireless communication platforms. While deploying services through third-generation (3G) and second-and-a-half generation (2.5G) wireless terminals presents challenges that are quite different from those encountered in personal computers and servers, many familiar environments have been adapted to resource-constrained devices.

This article discusses the practical integration of Java-oriented technologies and 2.5G/3G platforms and what you need to know when dealing with resource constraints and the management of software components through development, testing, deployment, and maintenance.

Communication handsets already offer functions similar to those available on desktop computers, including Internet access. While handheld devices are becoming more capable and powerful with each generation of products, they continue to be resource constrained compared to their desktop brethren. Limited amounts of memory, processing, and battery power are realities for the wireless developer.

These hardware limitations must be compensated for by smart application development and tight middleware integration. Rather than just acting as browsers for reformatted Web content, 3G handsets have the potential to host application software specifically built to implement client and service aspects of a solution. Since developers are no longer restricted to "thin-client" approaches, components installed directly within wireless devices have greater access to device features, sensors, and actuators. Clearly, developers will need access to a new generation of end-to-end tools that work within an open, universal tools integration platform. These will help address the special needs of multi-language, multi-platform, and multi-vendor development environments.

The challenge is to combine flexibility and broad functionality with the demands for very limited memory, processing, and battery power. 3G handsets will be built on a component base that provides the robust and reliable platform on which applications can be hosted. 3G is where the phone world meets the computing world. Voice communication will continue to be central while multimedia, secure e-business transactions, and data services will provide differentiation. A 3G handset will need to have the same reliability as a phone, but the same functionality as a computer, and still be small and power efficient.

Let's use an example to illustrate the reality of merging voice, data, and communications onto modern-day devices (cellphones, PDAs, and handheld computers) and enabling a new dynamic e-business application model. A technician on a service call uses a handset to view a full-motion video on how to remove a part from a photocopier. Using the same handset, the technician submits an order for the part and receives verification that the part has been reserved for his customer. Using location-based services, the server application, determining that there is a delivery van with the part on board in the neighborhood, uses a cellular SMS message to divert the driver to the technician's location.

As applications are extended to mobile devices, new technologies will be required to provide productivity to the end users while shielding them from the inherent complexities of integrating local and remote services. Local services such as bar code scanning, scalable vector graphics, full-motion video, and voice navigation will be required on the device. Remote services residing within the service infrastructure, such as location-based (GPS), transactional, and messaging services, will need to be accessed wirelessly by the device.

All these technologies exist today. To successfully integrate and deploy them on a constrained handset is a "simple matter of programming." To get there faster requires two things: the right platform and the right tools.

The role of Java in these systems is hidden from the end user, but it will play an important role for the developers of the wireless terminals and infrastructure equipment.

Next Generation Communication Systems
What are the reasons for using Java in 3G/2.5G terminals and infrastructure? Java will be successful within the communication segment for the same reasons it's successful in the IT segment: (1) time-to-market through productivity, and (2) flexibility and stability through open standards.

Shifting market demographics, global competition, and significant development and maintenance costs have reinforced the need for increased flexibility and productivity. No one application or service is going to meet all needs, and as a result service providers must have the ability to quickly and efficiently deploy new applications. This drives the fundamental idea of building a general platform with predefined capabilities and shared services that can be configured in real time with applications and add-ons, resulting in differentiable end products. The J2ME specifications provide a definition of such a platform for devices of varying capabilities. Developing applications according to these J2ME specifications:

  • Ensures application compatibility and portability with device capabilities
  • Reaps the productivity benefits of the Java programming model and accessibility to a continually growing base of skilled developers
  • Simplifies the integration of applications and services that reside in both the handset and infrastructure sides of the wireless link

    Selecting the best J2ME implementation is important, as it's the implementation of the "platform" the underlying real-time operating system (RTOS) and virtual machine that provides to a varying degree:

  • A safe and secure programming environment that protects the system from faulty add-ons that could corrupt the system
  • A layered software design with isolation mechanisms that prevent direct access to hardware and RTOS services
  • A fast and reliable execution environment with minimal memory consumption and efficient power usage that enables applications to take full advantage of available hardware resources in order to produce high quality service
  • Tested and certified, not just compatible, implementation against the J2ME specifications' "Java-powered" runtime environment
  • An extensible platform for connecting applications deployed on the handset with data and applications within the infrastructure
  • Runtime downloading (and unloading) capabilities of both Java applications and native system components
  • Efficient and intuitive programming tools for all of the above

    In the following section, OSE Systems and IBM describe how the integration of RTOS and J2ME-certified runtimes can be optimized for the wireless handset market. Experience is taken from their recent efforts in integrating OSE Systems' RTOS OSE and IBM's WebSphere Micro Environment.

    Development took place in an integrated tools platform with development tools based upon the open source Eclipse platform, an open universal tools integration environment. Development tools that are powered by Eclipse technology such asIBM's WebSphere Device Developer (an offering specifically targeted to embedded platforms) are also discussed as examples of the tooling needed for embedded Java applications.

    The Right Platform Not All J2ME Implementations Are Created Equal
    J2ME is a direct response to the recognition that not all devices are created equal. It provides a means for defining various device classes and a minimum level of capability and services that can be guaranteed on compliant devices. It does not, however, specify how well those services will perform. The devil is in the details of the platform's design, functionality, and implementation how the individual components of the platform, the RTOS, and the virtual machine are designed and implemented, what capabilities they have, and collectively how they are integrated.

    General Performance
    Footprint and Memory Costs

    One of the largest costs in a 3G handset is the memory. Designing a device with loads of expensive RAM and high-performance flash is not an option for many manufacturers. The right platform will be based on software specifically designed from the ground up to be small, scalable, and configurable, not carved down from an enterprise implementation.

    The RTOS plays an important role in saving memory, not only by providing a scalable, small footprint solution, but also by implementing memory-conserving features such as:

  • Limiting the amount of RAM consumed during execution
  • Preventing memory fragmentation
  • Supporting persistent memory types and enabling flash memory to function as the work memory, including "instant-on" execute-in-place (XIP) features that allow platforms to execute code directly from the flash memory without prior loading into a RAM buffer
  • Supporting dynamic remapping of applications' memory pages between RAM and flash

    Building on a strong RTOS, J2ME platforms at the simplest level assist in reducing the memory footprint for small devices by specifying the set of services available to an application on a compliant platform. This allows these services to be implemented once and then be shared by each application. In the wireless domain this also means improved performance as only the application, not the core services, need to be deployed over the wireless connection.

    At a deeper level, developers also need to look at the overall memory of an application as it runs on the device. Some virtual machines grab small amounts of memory up front (to reduce the initial footprint), and incrementally grab memory as it's needed (costing in terms of speed). Others grab more memory up front, but less over time (up front memory hit, but faster over time). The ideal solution is a virtual machine that is customizable and tunable. With J9, the virtual machine inside WebSphere Micro Environment, initial and incremental memory heap space can be set to meet the specific service needs and device capabilities.

    Finally, once the application has been designed and optimized, there are benefits to be realized in how it is deployed to the device. Depending on the type of application and the characteristics of the device, it may be more beneficial to execute the application out of flash rather than RAM. This could be to minimize RAM requirements or to provide the application with an "instant-on" capability.

    The execution speed of applications on these consumer handsets will continue to be an important success factor. Java applications have previously suffered a bad reputation because of their interpretive nature. While it's true that interpreters will generally run slower than compiled applications, the difference at the application level is not necessarily noticeable; in situations where it is noticeable, there are optimized runtime options such as ahead-of-time (AOT) and just-in-time (JIT) compilation.

    Just-in-time (JIT) compilation is a runtime option that uses a compiler within the virtual machine to translate Java bytecodes into native machine language for a specific device. A cache of memory contains compiled machine language prepared "just in time" for use. Execution of recurring bytecodes is then handled directly from the machine language in cache. After the initial "compilations," JIT technology improves performance at the cost of increased memory and start-up time.

    Ahead-of-time (AOT) compilation is an option that converts Java bytecodes into native machine language for the specific device at deployment time. Unlike JIT, compilation occurs on the development host. The result can be packaged "ahead of time" into a compact executable for direct loading and execution within the virtual machine environment. AOT compilation can be extremely effective when applied selectively to application hotspots. It can provide near JIT performance without the start-up time penalty and at a fraction of the memory costs.

    The J9 virtual machine was designed first and foremost to interpret bytecodes quickly. Building on this strong foundation, the JIT and AOT compilers provide the application developer with options for managing the speed versus memory cost trade-off. The significance of this flexibility is considerable given that the J9 virtual machine can execute applications deployed as bytecodes, AOT or JIT compiled machine code, and, most important, any combination of the three.

    Application Security and Continuity
    While ensuring reliability of standalone software applications, it's equally important to design a device with system robustness in mind. Downloaded applications and services cannot be allowed to corrupt the system. Separation of system-critical and noncritical software is essential and the operating system in the device should provide isolation mechanisms and memory protection for this purpose. For example, in the case of OSE's dynamic loading/unloading capabilities of native software (C/C++), special protection mechanisms have been introduced to ensure that loaded modules will be memory protected when taking advantage of a hardware MMU.

    Introducing a Java runtime environment that takes advantage of the RTOS' inherent security in a 3G handset has the great benefit of providing a secure and protected environment for application software, which is often written in Java. The handset's native environment (C/C++) that controls the device will be protected from the Java application environment. In system architectures that would benefit from greater separation, multiple virtual machines could exist on the handset and can be started and stopped independent of each other. In addition, when the RTOS supports native runtime downloads, even new, updated Java Virtual Machines can be dynamically installed after a handset is produced and deployed.

    Deterministic Real-Time Behavior
    Deterministic real-time behavior is a requirement in today's 2G mobile phones. To wirelessly deliver your voice to any location in the world within fractions of a second, 2G platforms include software that must control radio components, digital coding and decoding of voice, the relationship with base stations, and setup facilities that connect and disconnect calls. Moving to 3G handsets will not change the requirement for deterministic real-time behavior. Users will not accept calls suddenly being disconnected or the other party's voice sounding slow and distorted.

    The challenge will be to keep today's excellent performance and reliability, while introducing the new services that high-speed, packet-based data transmission enables. For multiple Java applications to coexist in a resource-limited device, the Java runtime environment needs deterministic real-time behavior.

    The design of the virtual machines has also moved forward to allow for deterministic execution. One specific area is in the garbage collection of the virtual machine. To illustrate, the IBM J9 virtual machine inside WebSphere Micro Environment has the following features to assist in the development of deterministic applications.

  • Real-time systems need to recover memory efficiently. Look for features such as precise garbage collection (GC) as opposed to conservative garbage collection. GC should also be incremental, so the virtual machine is not locked during GC.
  • In the most serious of deterministic cases, GC should also allow interrupts. This stops GC immediately so critical events can be processed at the highest possible priority. An example of this would be receiving an incoming phone call while gaming.

    Having a virtual machine implement deterministic functions has limited value if the underlying RTOS does not predictably implement real-time elements. Operating systems such as OSE are an example of a true embedded real-time system, designed from the ground up for demanding needs like determinisms, reliability, and robustness. Besides the classical features such as preemptive scheduling, lightweight processes, small footprint (measured in tens of kilobytes), scalability, efficient interrupt handling with short interrupt latency, and an interrupt-centered device driver model, there are other features to look for in an RTOS:

  • Message-based architecture to ensure ease-of-use, high performance, advanced debug capabilities, transparent IPC in distributed systems, and memory-protected systems
  • Memory management with a focus on performance even when using low-performance memory types, efficient prevention of memory fragmentation, and multiple memory pools to allow robust system design
  • Automatic error handling with a multilayered error handler approach
  • Process supervision and automatic resource cleaning, which enables a system to be self-recoverable

    The Right Tools The Java Developer Is Efficient
    As the 3G handset becomes a deployment platform within an overall pervasive computing context, tools to manage the end-to-end project life cycle will be needed. It will be customary to establish new development relationships as part of these projects. Often several companies or departments will need to collaborate on solutions that deploy across deeply embedded controllers, handsets, personal computers, servers, and even mainframe systems that handle millions of devices concurrently. The development life cycle starts with managed requirements, then progresses to modeling, code development, debugging, installation and management tasks, and testing. Testing takes on new aspects as multiple handset platforms, deployment networks, Web services servers, and service providers must be accommodated. Tools that manage all of these aspects of project development and deployment must integrate together well if developers are to progress efficiently.

    As in the device runtime discussion, it will be important for the Java and native (C/C++ and assembler) tooling environments to be well integrated. Being able to switch between task-aware freeze-mode and run-mode debugging is important in real-time systems as certain bugs cannot be found unless parts of the system can execute while others are frozen.

    Traditional source code debugging needs its complement in system-level debugging where events can be traced and analyzed, and design flaws can be found. Advanced system-level debugging is possible when the system design is based on a message-passing architecture with automatic resource cleaning, like OSE enables. Profiling of the CPU and memory usage as well as postmortem debugging are other needed debugging tools. The OSE Illuminator debug tool suite is implemented in Java, which provides for easy integration with a Java development environment like Eclipse-based WebSphere Studio Device Developer.

    While Java's portability and productivity benefits are well known, tooling designed for the embedded developer will need to provide several features above and beyond those found in a simple IDE. Real productivity is achieved with the following:

  • The ability to develop and debug in both on-host emulation environments and the actual on-device environment
  • The ability to develop and debug mixed mode, Java, and C/C++ applications
  • Execution analysis tools that operate on the device and highlight application bottlenecks by profiling memory, stack and thread usage, and priorities
  • Setup and configuration wizards that ensure applications are developed against the desired J2ME configuration or profile and for the desired target hardware
  • Wizards for recommending which portions of the application should be compiled as Java bytecodes, AOT, or JIT executables
  • Wizards that package an application for execution out of flash memory (XIP)
  • Wizards for packaging applications for deployment within an OSGi or enterprise side service
  • Ability to seamlessly create new custom tool features or to integrate new or better tool capabilities from third-party providers

    There are a large number of competing and complementary operating platforms and middleware technology offerings available. New project and business relationships may mean that a developer needs to bridge between multiple tools and collaboration environments. Since projects will often need to address additional deployment environments, including creating and managing metadata for complex middleware, multiple compatible development offerings may need to be considered. When an open, extendable integration framework like Eclipse is the basis for tools, it becomes easier to accommodate multiple-platform, multiple-language, and multiple-vendor development tasks.

    Part of the challenge for developers working to deploy solutions across server and wireless handset platforms involves collaboration and team coordination. A universal tools integration platform like Eclipse is equally at home in supporting a variety of development languages (Java, AspecJ, C/C++, Cobol, and Smalltalk, for example) and a broad range of enterprise and embedded deployment platforms. Eclipse supports all these environments through common access to modeling tools, testing environments, and concurrent access to multiple source code repositories. Several vendors are now offering solutions that integrate their areas of specialization with the Eclipse platform.

    Offerings like QNX Momentix and TimeSys TimeStorm use the same Eclipse platform and provide speciality tools for working with QNX Neutrino and TimeSys Linux in C and C++ language environments. Source code control and management offerings from Computer Associates (All Fusion), MERANT (PVCS), Rational (XDE), Borland (Together Control Center), MKS (Source Integrity), Serena (Workbench), LogicLibrary (Logidex Asset Expert), Eclipse (CVS), Starbase (StarTeam), Telelogic, and Instantiations (CodePro Studio) let you plug in access to a variety of VCM and source code management systems. Offerings like IBM's WebSphere Studio Application Developer extend Eclipse to include visual editors, development of enterprise services, middleware access, and more. Organizations like Quest Software, Parasoft, JUnit.org, and Scapa Technologies have provided test extensions.

    3G handsets will need to combine phone reliability and real-time requirements on small and resource-constrained devices with ever-changing application functionality. J2ME specifications provide definitions of general platforms for devices of varying capabilities and will serve as the basic software building blocks for these devices. Successful implementations of the J2ME platform will require an RTOS and Java runtime environment that focus on deterministic real-time behavior and low memory usage. Successful projects will need to efficiently integrate and work with tools from multiple vendors for multiple development and deployment platforms and in multiple languages. The combination of J2ME technology and Eclipse-based tools is the key to powerful solutions.

    Author Bios
    Eva Skoglund is a product marketing manager for wireless systems for OSE Systems, a real-time operating systems company. She holds an MS in computer science from the Royal Institute of Technology in Stockholm.

    Bryan Hartlen works in business development, product marketing, and IP licensing areas and manages IBM's family of embedded Java products. Previously, he developed or managed software developers on platforms that ranged from mainframe applications to shop floor control systems to PCMCIA cards.

    Marc Erickson has been a key participant in several international innovations from IBM including workflow technology and service support center development. He is now on assignment as the communications manager for Eclipse.

    Angus McIntyre is the director of business development for embedded technology at IBM and has spent his entire career on application development tools (OTI, IBM Canada Lab, VisualAge for Java, VisualAge Micro Edition). He holds a BS in computer science and statistics and an MBA. [email protected]

    All Rights Reserved
    Copyright ©  2004 SYS-CON Media, Inc.
      E-mail: [email protected]

    Java and Java-based marks are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries. SYS-CON Publications, Inc. is independent of Sun Microsystems, Inc.