Summarizing NM-only and CM-only Execution [ Switch Programming User's Guide ] MPE/iX 5.0 Documentation
Switch Programming User's Guide
Summarizing NM-only and CM-only Execution
Figure 1.1 illustrates the place of emulation, translation, and full
recompilation within the Native Mode (NM) operating environment. The
figure shows three processes running independently under MPE XL:
* Process 1 is a CM program (obtained from a STORE/RESTORE) running
under emulation. Emulation is a feature of the MPE XL operating
system that uses existing program files and data to produce the same
results as if the program ran on an MPE V/E-based system.
* Process 2 is a CM program that has been translated to achieve a
performance boost. This translation involves converting portions of
a CM program file to NM object code and appending that code to the
file. The performance gain is achieved by escaping from the Emulator
to this NM code during execution of the CM program. Translated
programs are still subject to all CM limitations and still execute in
Compatibility Mode.
* Process 3 is an NM program (produced by full recompilation). This
program can take advantage of the full MPE XL feature set, including
the optimizing NM compilers and the performance improvement resulting
from direct execution of the HP Precision Architecture instruction
set.
Figure 1.1. MPE XL Execution Environment
The translated program in Figure 1.1 is the result of a one-time
translation process illustrated in Figure 1.2. The translation process
is invoked by issuing the command: :OCTCOMP CMprogname.
Figure 1.2. OCT Translation Process
Mixed-mode Procedure Calling (Partial Recompilation)
Partial recompilation, possibly requiring rewriting, employs the Switch
subsystem (Switch) to make mixed-mode procedure calls. The MPE XL Switch
subsystem (Switch) provides the ability for programs executing in one
mode to call Compatibility Mode (CM) Segmented Library (SL) or Native
Mode (NM) Executable Library (XL) procedures that reside in the opposite
mode. For instance, users with high-level NM applications that call
low-level CM SL procedures (COBOL calling SPL Segmented Library code, for
example) can recompile the high-level portion using the appropriate
compiler and, using Switch, can call CM SL procedures. With this
capability, you get the advantage of Native Mode (large code and data
space and performance improvements) in the recompiled portion of your
application, without having to rewrite SL procedures in a supported NM
language.
Figure 1.3 illustrates the place of Switch in the NM environment.
Figure 1.3. Switch in MPE XL Execution Environment
Mixed-mode Overview
MPE XL-based systems provide two operating modes (Compatibility Mode and
Native Mode) and a variety of execution options:
1. You can run CM programs (directly after being restored
from your MPE V/E STORE tape), and, from that code, call
procedures that are located in a CM SL. In this
instance, all execution is within Compatibility Mode,
and no apparent mode switching on the part of your
program is involved. Figure 1.4 illustrates this model.
Figure 1.4. Compatibility Mode Execution Model
2. You can run NM programs (after full recompilation), and,
from that code, call procedures that are located in an
NM Executable Library. In this instance, all execution
is within Native Mode, and again no apparent mode
switching on the part of your program is involved. This
is demonstrated in Figure 1.5.
Figure 1.5. Native Mode Execution Model
3. When running NM code you can call procedures located in
a CM SL, or when running CM code you can call procedures
located in an NM Executable Library. These situations
involve mixed-mode procedure calls, and Switch provides
such capability. Figure 1.6 and Figure 1.7 symbolize
this mixed-mode calling feature.
Figure 1.6. CM--> NM Mixed-mode Execution Model
Figure 1.7. NM--> CM Mixed-mode Execution Model
NOTE Combinations of mixed-mode procedure calls are also possible. For
example, your NM program could use Switch to call a CM SL procedure
that, in turn, could call an NM Executable Library procedure via
Switch (NM--> CM--> NM), and so on. Conversely, your CM program
could use Switch to call an NM Executable Library procedure that,
in turn, could call a CM SL procedure via Switch (CM--> NM--> CM),
and so on. However, you should carefully consider use of this
feature since you pay an overhead penalty on every switch.
Mixed-mode Situations
If you have existing applications written in a high-level language that
call user-written CM SL procedures that are written in SPL or other
languages not supported by Hewlett-Packard in Native Mode, and you want
to recompile these applications in Native Mode, then you will need to use
Switch. To take full advantage of the features and performance of 900
Series machines, it is necessary to recompile existing applications
entirely in Native Mode. However, a number of factors may make full
recompilation infeasible. Among these are the following:
* Size of the application
* Availability of shared procedures
* Language of implementation (SPL, for example)
* Desired performance
* Resources available for migration
* Availability of source code of CM SL procedures
Such factors can lead you to split the application into two different
modes of execution, Compatibility Mode and Native Mode, and migrate by
phases, until you have migrated the entire application into Native Mode.
Or, mixed-mode execution may be your target state. You may need to make
mixed-mode procedure calls in the NM--> CM direction if your high-level
applications running on MPE V/E-based systems make calls to SPL
procedures in order to take advantage of the special features accessible
from that language. Because SPL is close to the HP 3000 architecture of
earlier series, it is able to take particular advantage of that
architecture. However, SPL is so architecture-dependent that it has not
been migrated to Native Mode. Consequently, the user of SPL procedures
is faced with two options:
1. Rewrite all SPL procedures in higher-level languages
that can be compiled directly in Native Mode.
2. If rewriting is not feasible or the procedure is not
performance-sensitive, use Switch to continue to call
such procedures but call them from code that has been
migrated to (recompiled in) Native Mode.
Other factors may motivate CM--> NM switching. A common situation
involves the most performance-sensitive portions of your application.
These are probably the first pieces of code you want to recompile or
rewrite. Mixed-mode procedure calling allows you to migrate those
portions to Native Mode to obtain the performance gains, while still
running the remainder of the application in Compatibility Mode. This
provides a continual, incremental upgrade path. Be sure that the
overhead of the Switch is outweighed by the performance advantage of
running that code in Native Mode.
Relationship to Migration
When you move your application or subsystem from MPE V/E- to MPE XL-based
systems, you can carry out this migration in a phased manner. Phased
migration refers to the ability to convert your application in steps from
100% CM execution to, potentially, 100% NM execution.
Because Hewlett-Packard has provided object code compatibility, most
applications can be restored and execute in Compatibility Mode without
changes. You can then migrate a portion of your application to Native
Mode to take advantage of increased performance and added features. You
can choose to migrate your database, application programs, or application
libraries independently of one another. It is this capability to migrate
portions of an application over time that makes up the phased migration
feature of MPE XL.
Since the HP Precision Architecture is different from that of non-MPE
XL-based HP 3000 family members, users of the 900 Series face certain
differences when migrating to the MPE XL environment. Furthermore,
migration does not end when an MPE XL-based system is installed. In many
instances, Series 900 systems will be used in both networks and
environments alongside MPE V/E-based systems. The transfer of
information between these types of systems and the attendant need to
convert between MPE V/E- and MPE XL-based data may make migration an
ongoing concern.
Cost/Performance Factors
As noted previously, you have the ability to run applications in
Compatibility Mode, Native Mode, or mixed modes. To some extent, the
choice of how to mix execution modes may involve the question of how to
achieve the best possible performance. The following recommendations are
intended to guide you in making a decision appropriate to your
circumstances:
* Find the procedure that uses the most resources.
* If that procedure is CPU-intensive (for example, doing calculations
or character comparisons), you may benefit from converting it to
Native Mode and accessing it via Switch.
* If that procedure is a special-purpose SPL technique to make your
application bigger or faster, look for an NM feature (such as the
large data space or mapped I/O) that can take the place of the SPL
procedure.
* Take measurements to be sure that the Switch overhead does not
outweigh the performance improvement you gain from converting to an
NM procedure.
MPE/iX 5.0 Documentation