Java .NET Integration

Port business-critical applications from Windows to UNIX and Linux

Mainsoft for UNIX and Linux is an enterprise-class application porting platform for the cross-platform development and deployment of mission-critical enterprise applications. It enables developers to write C++ applications in the productive Microsoft Visual Studio development environment and rapidly deploy them natively to multiple UNIX platforms.

Mainsoft for UNIX and Linux is comprised of two main components: the Software Development Kit (SDK), a cross-platform plug-in to Visual Studio, for application development and the Mainsoft for UNIX and Linux runtime, a high-performing and robust Windows runtime on UNIX for deployment.

The latest version of Mainsoft's application porting platform, Mainsoft for UNIX and Linux 5, delivers enterprise-class performance, security and robustness, has an emphasis on enterprise technologies such as XML, DCOM and Java EE Application Servers, and forms a scalable foundation for XML Web services.

Mainsoft for UNIX and Linux components

Let's take a look at the Mainsoft for UNIX and Linux components in more detail:

  • Mainsoft for UNIX and Linux SDK: Cross-platform Plug-in to Visual Studio - The Mainsoft for UNIX and Linux SDK extends the Visual Studio user interface and functionality to support multiple platforms. The plug-in enables Windows developers with little familiarity with UNIX, to build UNIX versions of their Windows applications directly from Microsoft's Visual Studio using native UNIX compilers installed on a remote UNIX server. (See Figure 1)
  • The Mainsoft for UNIX and Linux runtime
    • Windows runtime on UNIX - includes an extensive set of Microsoft technologies such as MSXML, SSL, MSHTML, WinSock, COM/DCOM and ATL. These are based on the original Microsoft implementation, tuned for UNIX by Mainsoft. (See Appendix B)
    • Mainsoft for UNIX and Linux Core Services - The Mainsoft for UNIX and Linux kernel provides core functionality such as synchronization objects, threads and primitive graphic functionality utilized by the Windows runtime. In addition, the Core Services include Mainsoft's RPCSS service and registry services that provide the robust infrastructure required to support large numbers of Mainsoft for UNIX and Linux processes concurrently on the same machine.
    • Java EE Integration Package (J2IP) - Enables seamless interoperability between COM objects ported with Mainsoft for UNIX and Linux and Java EE Application Servers. The J2IP enables developers to leverage advanced technologies such as Java Server Pages and EJB's that can invoke COM objects ported with Mainsoft for UNIX and Linux to create end-to-end solutions combining Microsoft and Java technologies on UNIX platforms.

Focusing developers on their core competency

One of the challenges in delivering the same application on a heterogeneous set of operating systems is to manage the complexity involved with learning and using different development and deployment environments. Mainsoft for UNIX and Linux dramatically reduces this complexity by enabling cross-platform development and deployment from within Visual Studio.

  • Leveraging Windows development knowledge and experience - Development managers who have spent a considerable amount of time recruiting and building productive team of Windows developers find that rewriting a Windows application Java (often considered as an initial option for deploying cross-platform applications) may not only be time consuming and expensive, but often impossible based on the team's skill set. Mainsoft for UNIX and Linux enables development teams to leverage their core skills, and continue enhancing their products with new competitive features - not rewriting code.

  • Performance - Mainsoft for UNIX and Linux produces a native binary, linked with the highly scalable Mainsoft for UNIX and Linux runtime. The newly ported application is at least on par with handwritten UNIX code, saving developers hundreds of hours fine-tuning their implementation for various platforms. Independent Software Vendors with significant investments in Java can leverage the Mainsoft for UNIX and Linux Java EE Integration Package to implement computationally intense components of their code in Visual C++. This approach has proven to be very appealing for components (such as mapping and reporting tools) that are accessed through Web browsers and process large numbers of XML documents or are graphically intens ive, rendering thousands of data points onto bitmaps that are displayed by thin clients.

Accurate implementation of the Windows programming model

A licensing agreement with Microsoft gives Mainsoft full access to the Windows OS source code. Ported applications are assured of running exactly as they do on Windows, since Mainsoft uses millions of lines of test suites, also licensed directly from Microsoft, to ensure compatibility. This approach makes certain that ported applications maintain the all- important functional compatibility with Windows as they take full advantage of the performance and reliability of UNIX.

A decade of cross-platform development knowledge

Over the past decade, Mainsoft has helped port some of the most complex Windows applications available. These include Microsoft's Internet Explorer, Outlook Express and Windows Media Player, the Siebel eBusiness Application Suite, and CA's Ingres OpenROAD. The company's extensive knowledge and experience in solving crossplatform issues is made available to Mainsoft for UNIX and Linux customers throughout the lifecycle of their UNIX product. This starts during the early stages of the porting process with initial help planning the cross-platform development processes, delivering recommendations on porting infrastructure, porting processes, version control tools, bug databases etc. And extends throughout the porting process with assistance in analyzing porting problems and implementation issues. After the product has been deployed, Mainsoft can assist with the tracking of deployment issues specific to particular UNIX operating systems, like the runtime configuration.

Mainsoft for UNIX and Linux Platform Architecture

The Mainsoft for UNIX and Linux platform is designed to support robust and scalable applications. It provides an infrastructure that allows multi-threaded, multi-process, multi-platform, distributed applications a way to interact among themselves using a rich, object oriented interface, while preserving process isolation and promoting robustness. (See Figure 2)

Architecture overview

The Mainsoft for UNIX and Linux runtime libraries link with the application code and implement the Win32 semantics inside the process space. Win32 system kernel data (such as file handles, events, mutexes and semaphores) is stored in the application's own memory space. This yields a very high-performance implementation of kernel functionality such as threads and processes management, synchronization object management, memory management, file mapping support, asynchronous communications support and Asynchronous Procedural Calls.

Performance and scalability

  • High-performing, scalable, XML engine - Mainsoft's advanced Microsoft XML engine implementation for UNIX was designed and fine-tuned to deliver a high performance, highly scalability XML infrastructure. The result is a state-of-the-art XML implementation that provides unbeatable performance and scalability.
  • Multi-process and multi-threaded support - Full and efficient support for the Windows processes and thread API semantics is provided, including:
    • creating and terminating processes/threads
    • waiting on processes/threads
    • synchronizing between processes/threads
    • suspending and resuming threads
  • Support for thousands of concurrent connections - When designing Mainsoft for UNIX and Linux's implementation of file access, sockets and pipes, special care was taken to use highly scalable POSIX APIs. As a result - when using the WinSock APIs, Mainsoft for UNIX and Linux applications can maintain as many open socket connections and file descriptors as the application demands.
  • Minimal consumption of scarce system resources - Mainsoft for UNIX and Linux has been fine- tuned to the architecture of the underlying UNIX platforms to minimize the system resources required to support each thread. For example, the Mainsoft for UNIX and Linux kernel was designed so that there is no use of System V shared memory objects. On AIX, this saves two address space segments that consume 256 MB each, enabling thousands of threads and processes to be created and run concurrently.
  • COM/DCOM transport layers designed for maximum performance and scalability - Mainsoft for UNIX and Linux implements a specially tuned local transport layer to support COM intra-machine interaction. On Solaris, this implementation takes advantage of a Solaris-specific high-performance synchronous transport layer called DOORS. On other UNIX platforms, an alternate highly scalable multi-threaded scheme was utilized, enabling concurrent support for hundreds of clients.

Open architecture

Mainsoft for UNIX and Linux was designed using an open and extensible approach. It integrates with existing enterprise infrastructure and solutions :

  • Java-to-COM integration - The Java EE Integration Package (J2IP) included with Mainsoft for UNIX and Linux enables Java applications to efficiently invoke and interact with COM servers through standard Java class method calls. Java applications can load a COM object in-process and directly call it without the overhead of marshaling the parameters to other processes. It is also possible to access COM objects in other processes and even take advantage of Mainsoft for UNIX and Linux DCOM support to access COM objects on Windows (such as Excel, Access and Word).
  • Easy Web access to applications via Java Server Pages - The Java EE Integration Package connects ported enterprise applications to JSP pages, providing Web server and Web service support.
  • Universal Database Access - Through the ODBC add-on to Mainsoft for UNIX and Linux, applications can be vendor neutral, allowing enterprises to seamlessly select their database of choice.
  • Web Server Integration - UNIX Web servers can link with or dynamically load Mainsoft for UNIX and Linux ported DLLs and utilize them for high-performance processing of HTTP requests.
  • Interoperability with DCOM components - Integrated COM/DCOM support enables interaction with any local or remote DCOM server, including Windows applications such as Excel running on a remote Windows system.
  • Validating the ported application with standard UNIX tools - Mainsoft has made extensive efforts to ensure that ISVs can leverage standard UNIX validation tools such as Purify and Quantify to debug and fine-tune Mainsoft for UNIX and Linux ported applications.
  • Interoperability with third party libraries - Mainsoft for UNIX and Linux ported applications can link with any standard UNIX libraries, including third parties such as RogueWave's component libraries and RSA BSAFE.

Enterprise level security

  • Support for NTLM authentication and Windows integration - The Mainsoft for UNIX and Linux 5 DCOM implementation supports secure authentication through the Windows NTLM protocol. This provides interoperability with Windows DCOM components in a secure manner.
  • Support for HTTPS protocol - HTTPS support is integrated with RSA's BSAFE security package.
  • Secure Registry Access - As part of the support for multiple users, the Registry Server uses standard UNIX authentication to authe nticate users when performing registry access. This ensures that the user's Registry data is secured by the UNIX OS standards.

Mainsoft for UNIX and Linux benchmark results

Mainsoft for UNIX and Linux has been tested at Sun, HP and IBM labs on a variety of servers ranging from one to 24 CPUs. This section presents two diagrams that demonstrate the high levels of performance, scalability and robustness reached with Mainsoft for UNIX and Linux.

XML parser benchmark demonstrating superior performance and scalability

Due to XML's extensible and open nature, it is the preferred method for describing information. As Web services that make heavy use of XML technologies become more pervasive, efficient XML parsing will be critical to the overall performance of enterprise applications.

The Mainsoft for UNIX and Linux XML engine is based on the same source code as the Microsoft engine that is considered to be one of the most advanced implementations of the latest XML standards. The Mainsoft for UNIX and Linux XML engine has been tuned by Mainsoft to leverage the scalability of the UNIX platform.

Mainsoft conducted extensive benchmarking of the Mainsoft for UNIX and Linux XML engine, comparing it to the Xerces XML engine, which is recognized as the leading XML engine in the UNIX world. Xerces has been included in many commercial products, including IBM WebSphere, Sun JDK 1.4 and BEA WebLogic. The benchmark results, outlined in Figure 3, show the Mainsoft for UNIX and Linux XML engine provides better performa nce and scalability than the Java Xerces implementation. For more details about the benchmark study, please refer to Appendix A.

Web stress scalability test case

The Web stress test is one of the many stress tests designed to verify and ensure the scalability of Mainsoft for UNIX and Linux. At the foundation of this test is a server application ported with Mainsoft for UNIX and Linux. The ported server application was plugged into an Apache Web server executing on a 24 CPU SunFire 4800 machine, running Solaris 8.

The test used the Microsoft WebStress tool running from a Windows client machine to "bombard" the Mainsoft for UNIX and Linux server by simulating 100 users simultaneously issuing repeated requests to the server.

Figure 4 shows that as the number of active CPUs on the machine increases from one to 24, the Mainsoft for UNIX and Linux server utilizes the available CPUs to provide a linear increase in performance. For example, with one CPU, the Mainsoft for UNIX and Linux ported server application processed about 50 transactions-per-second. When the same machine was configured with four CPUs, the application processed about 200 transactions-per-second. Doubling the number of CPUs to eight, also doubled the number of transactions-per-second to around 400.


Mainsoft for UNIX and Linux 5.0 is an enterprise-class application porting platform that brings together more than a decade of experience in porting technologies. It is a highly productive and open porting platform that enables ISVs and IT organizations to build native UNIX and Windows applications from a single set of source-code. Mainsoft for UNIX and Linux integrates well with other UNIX solutions and delivers unparalleled performance, robustness and scalability for today's demanding enterprise applications.

Appendix A: XML Benchmark Methodology

This section discusses the methodology used in the conducting the XML benchmark, a study that included several configurations of the Xerces XML in various real world configurations.

Xerces comparison - Xerces is recognized as a leading XML engine and is included with many commercial distributions such as IBM WebSphere, Sun JDK 1.4 and BEA's WebLogic. The Apache Xerces XML engine is an open source product, based on code originally developed in IBM and Sun in two, independent projects. The two XML engines were merged by the Apache organization into one product.

XML engine configurations tested - The benchmarks compared Mainsoft for UNIX and Linux XML with both the Java and the C++ versions of Xerces 2. When testing the Java XML engine, the tests were run with the Java server runtime configuration.

Test methodology - The benchmark created 100 threads that used the different XML engines to parse and build a DOM representation of a variety of XML files ranging in sizes from small (~0.5KB) documents such as SOAP messages, through medium and large-sized documents (10-70 Kb) that may represent results of XML queries to databases. The tests were designed to ignore overheads such as the time taken to read files from the disk and the time taken to load the XML engine classes.

The Java benchmark was run repeatedly until the Java results became consistent. This enabled the Java Virtual Machine to make full use of its dynamic optimizations and excluded the startup overhead of the JIT compiler.

Overall, 540 individual tests were run. Each test executed 100 threads concurrently and each thread parsed the tested file 500 times. The tests measured the XML engine processing capacity. In other words, the results show how many Kb of XML data could be parsed-per-second.

Xerces Configuration - Xerces was linked with the Lightweight Process thread library that provided a significant performance and scalability boost relative to the default configuration of Xerces, which utilizes the POSIX thread library. In addition Xerces was linked with the standard Solaris allocator that provided better performance than the multi- threaded Solaris allocator (mtmalloc) or the Hoard open source allocator.

Results - The Mainsoft for UNIX and Linux XML implementation demonstrated linear scalability and outperformed both Java and C++ Xerces by up to five times for larger XML documents and up to seven times for smaller ones. The following charts summarize the results:

Appendix B

Below is a summary of the Windows runtime technologies supported by Mainsoft for UNIX and Linux.

Windows Primitives

  • Error Handling
  • Structured Exception Handling
  • Dynamic-Link Libraries
  • Processes and Threads
  • Synchronization
  • File I/O
  • Large Integers
  • National Language Support
  • Unicode and Character Sets
  • Atoms
  • Clipboard
  • Handles and Objects
  • Hooks
  • Pipes
  • File Mapping
  • Memory Management
  • Registry
  • Remote Procedure Call (RPC)

Visual Studio runtime support

  • ATL
  • C runtime Library
  • MFC

Web Development and Scripting support

  • XML (Extended Markup Language)
  • JScript
  • VBScript
  • Script runtime (SRCRUN)
  • Secured HTTP (HTTPS)
  • Asynchronous pluggable protocols
  • CSS
  • DHTML Behaviors
  • DHTML Scriptlets
  • Hit Logging API
  • HTML
  • HTML Components (HTC)
  • Information Delivery API
  • Internet Component Download
  • Mlang
  • MSHTML Editor
  • Open Software Description (OSD)
  • Shell Helper API
  • Tabular Data Control (TDC)
  • Timer API
  • URL Monikers
  • URL Security Zones
  • Web Accessories
  • WebBrowser Control
  • Win32 Internet Functions

Component Services (COM) support

  • COM Fundamentals
  • AciveX Controls and Property Pages
  • Automation
  • MIDL
  • OLE and Data Transfer
  • Structured Storage
  • Secured Distributed COM

Graphics (GDI) Services support

  • WGL
  • Bitmaps
  • Brushes
  • Clipping
  • Colors
  • Coordinate Spaces and Transformations
  • Device Contexts
  • Filled Shapes
  • Fonts and Text
  • Lines and Curves
  • Metafiles
  • Painting and Drawing
  • Paths
  • Pens
  • Printing and Print Spooler
  • Rectangles
  • Regions

User Interface Services support

  • Window Classes
  • Window Procedures
  • Window Properties
  • Messages and Message Queues
  • Shell
  • Dialog Boxes
  • Multiple Document Interface (MDI)
  • Common Controls
  • Animation Controls
    • ComboBoxEx
    • Controls
    • Common API
    • Date and Time Picker Controls
    • Drag List Boxes
    • Flat Scroll Bars
    • Header Controls
    • Image Lists
    • IP Address Controls
    • List-View Controls
    • Month Calendar Controls
    • Pager Controls
    • Progress Bar Control
    • Property Sheets
    • Rebar Controls
    • Status Bars
    • SysLink Controls
    • Tab Contols
    • Toolbar Controls
    • ToolTip Controls
    • Trackbar Controls
    • Tree View Controls
    • Up-Down Controls
  • User Interface
    • Buttons
    • Combo Boxes
    • Edit Controls
    • List Boxes
    • Rich Edit Controls
    • Scroll Bars
    • Static Controls
    • Resources
    • User Input