Requirements for Multi-Processing
The following compatibility's requirements should be considered before running
an application in multi-processor mode:
- An application or associated subsystem must not use
the 'INC' instruction as a semaphore without prepending a 'LOCK' prefix.
On a UniProcessor (UP) system this instruction can be used as a high-performance
semaphore without calling any other operating system service if the semaphore
is free and when the semaphore is clear and there are no waiters for the
semaphore. Because the INC instruction cannot be interrupted once started,
and because the results would be stored in the flags register which are
per thread, then it could be used safely as a semaphore.
In an OS/2 for SMP environment, this technique will not work because it
is possible that two or more threads could be executing the same INC instruction,
receiving the same results in each processor's or thread's flag register
and thinking that they have the semaphore.
- A 486 or greater instruction such as CMPXCHG has the
same problem as above if a 'LOCK' prefix is not prepended before the instruction.
- An application or associated subsystem which relies
on priorities to guarantee execution of it's threads within a process will
not work in OS/2 for SMP. For example, an application may have a time-critical
and an idle thread, and may assume that while the time-critical thread is
executing the idle thread will not get any execution time unless the time-critical
thread explicitly yields the CPU. In an OS/2 for SMP environment it is possible
that both the time-critical and the idle threads are executing simultaneously
on different processors.
The above compatibility requirements apply only to multi-threaded applications,
and therefore do no apply to DOS and WINOS2 applications. However, you are
strongly encouraged to write 32-bit multi-threaded applications for better
performance and portability on OS/2 for SMP.
Given the possibility that some set of applications may use one of these
techniques, OS/2 for SMP Version 3 provides a mechanism whereby these multi-threaded
applications can execute in UP mode. Only one thread of that process would
be allowed to execute at any given time. That thread could execute on any
one of the processors. MARKEXE can be used to mark the EXE file as uniprocessor
only. OS/2 forces the process to run in the uniprocessor mode when the loader
detects that the EXE file has been marked as uniprocessor only.
Note: OS/2 Warp Version 3 (non-SMP) still ships the EXECMODE utility.
[Back: Setting Program Type]
[Next: Preprocess Message Source File Utility (MKCATDEF)]