McObject’s Top Engineer Offers Portability Expertise in Dr. Dobb’s Journal
May 17, 2005 — McObject Principal Architect Andrei Gorine’s Dr. Dobb’s Journal article, “Portability and Data Management”, features the technology behind the unmatched portability of McObject’s eXtremeDB in-memory embedded database in one of the world’s preeminent programming magazines.
Gorine wrote the article to help engineers follow McObject’s example and create re-usable database code for embedded systems. It details some the key programming lessons learned in the development of eXtremeDB, as well as innovations embodied in the product’s architecture.
Some lessons apply generally to writing portable embedded systems code, while others focus on how a specific database function was built for maximum re-usability.
In the general portability vein, Gorine recommends using ANSI C as a good starting point. He also advises against building assumptions about integer and pointer sizes into software that is intended for re-use. Instead, “Defining the size of all base types used throughout the database engine code, and putting these typedefs in a separate header file, makes it much easier to change them when moving the code from one platform to another or even using a different compiler for the same hardware platform,” he writes.
Another of Gorine’s caveats is that compilers billed as ANSI C-compatible may not completely conform to this standard. For example, some recognize void but not void*. In the article, Gorine explains how to steer around this limitation. And because some compilers treat the char type in expressions as signed, while others treat it as unsigned, “portable code requires that char variables be explicitly cast when used in expressions.”
Other sections show how McObject’s engineers, led by Gorine, rejected traditional approaches to building certain database functions, in order to maximize eXtremeDB’s portability and to achieve other goals such as high performance and a small code footprint. For example, while non-embedded databases make extensive use of the C-runtime, embedded systems developers tend to avoid using it, in part because “in some embedded environment, C-runtime functions, such as dynamic memory allocations/deallocations (malloc()/free()), are implemented so poorly as to be virtually useless.”
The alternative strategy used by McObject was to build the necessary C-runtime functionality into the database runtime itself, which carries the double benefit of reducing memory footprint and increasing portability. In eXtremeDB, Gorine writes, numerous embedded memory management components are used that “neither rely on OS-specific low-level memory management primitives, nor make any fundamental assumptions about the underlying hardware architecture.”
Another fundamental database task, synchronization of concurrent database access, also required new approaches, Gorine writes. The traditional approach is to base synchronization on OS kernel synchronization objects. But these objects’ differing syntax and usage makes it “nontrivial to write portable multithreaded synchronization code.”
In creating eXtremeDB, this obstacle was overcome by “build[ing] up the database runtime synchronization mechanism based on a simple synchronization primitive—the test-and-set method—that is available on most hardware architectures,” Gorine writes.
Gorine’s Dr. Dobb’ Journals article provides code examples for this synchronization approach and for many of the other portability strategies. The issue of Dr. Dobb’s Journal containing this article is available on newsstands or from the magazine’s Web site at http://www.drdobbs.com/portability-data-management/184406108.
With eXtremeDB, McObject offers a uniquely portable database management system that meets the unique performance requirements and resource constraints of intelligent, connected devices. eXtremeDB provides critical data management features—including transactions, concurrent access, High Availability and a high-level data definition language—while maintaining a tiny code footprint (as little as 50K). As an in-memory database system (IMDS), eXtremeDB delivers the real-time responsiveness demanded by consumer electronics, network infrastructure gear, industrial control systems and other embedded systems.
eXtremeDB also provides sophisticated development capabilities, such as support for varied data and query types, a high-level data definition language, and a powerful debugging environment including a self-diagnostic API that catches a wide range of common programming errors before they slip into runtime code.
Founded by embedded database and real-time systems experts, McObject offers proven data management technology that makes intelligent devices smarter, more reliable and more cost-effective to develop and maintain. McObject counts among its customers industry leaders such as DaimlerChrysler, Peiker acustic, Tyco Thermal Controls, F5 Networks, Genesis Microchip, Motorola and Boeing. McObject, based in Issaquah, WA, is committed to providing innovative technology and first rate services to customers and partners. The company can be reached at +1-425-888-8505, or visit www.mcobject.com.
McObject and eXtremeDB are registered trademarks of McObject LLC. All other company or product names mentioned herein are trademarks or registered trademarks of their respective owners.