NonStop Server for Java 6.0 Programmer's Reference
• Pipe I/O
• TMF transactions (com.tandem.tmf package)
JToolkit provides a thread-aware API for performing I/O to Enscribe files, $RECEIVE, and Pathway
servers by using Pathsend procedure calls. For more information, see the JToolkit Programmer's
Reference.
Thread-Aware I/O Support for OSS regular files
By default, the NonStop Server for Java 6.0 enables Non-Blocking I/O for OSS regular files on
SUT versions J06.04 and greater and H06.15 and greater. This means that regular file I/O
operations on multiple OSS files can be performed simultaneously by the Java application. Therefore,
this feature is useful for multithreaded Java programs that perform regular OSS file I/O operations.
To turn the Non-Blocking I/O mode off, use the following java command line option:
-Dnsk.java.nonblocking=false.
Threading Considerations for Native Code
All threaded code should be written in Java rather than native code. If a user native library linked
into Java creates a thread, non thread-aware operations executed in the user library might impact
the operation of the Java virtual machine. If the user library creates multiple user threads, the
program needs to be all the more careful to ensure that the operations performed in the user threads
are thread-safe on the NonStop system.
You need to consider the issues discussed below when using threads in native code linked to a
Java program on a NonStop system:
• NonStop Server for Java 6.0 does not use the POSIX threads SRL.
Instead, NonStop Server for Java 6.0 contains its own version of POSIX threads. Therefore,
your code should include the Standard POSIX Threads header files shipped with NonStop
Server for Java 6.0. The header files for this version of POSIX threads can be found in the
directory:
[install-dir]/java/include/oss
where install-dir is the NonStop Server for Java 6.0 installation directory.
• Creating a thread for a task does not make the task run faster.
The NonStop system does not have an implementation of native threads; threads run at a user
level. Even on a multiprocessor NonStop system, all threads in a process are executed in the
same processor as the process. If you create a thread whose only purpose is to run a certain
task, the thread-creation overhead makes the task run marginally slower than the same task
being performed without creating the thread.
• The thread-scheduling algorithm is not preemptive.
A thread executes until it explicitly yields. For more information, see the discussion of “Thread
Scheduling” (page 47).
• In a very long-running, CPU-intensive thread, having your native code occasionally invoke the
yield() method allows timer completions and I/O completions to be detected. Invocation
of timer callbacks and detection of I/Ocompletions can be severely impacted by long-running
threads.
• Be familiar with the issues discussed in the “Application Programming with Standard POSIX
Threads” section of the OSS Programmer’s Guide.
This section contains information about the jacket routines that make many of the available
system calls thread-aware. The interfaces themselves, however, are documented in the OSS
System Calls Reference Manual.
To use these jacket routines, you need to add the following define in your native code.
50 Implementation Specifics










