SMPProgAdd - Application Considerations: Difference between revisions
No edit summary |
|||
Line 17: | Line 17: | ||
The above compatibility requirements apply only to multithreaded applications, and therefore do not apply to DOS and WINOS2 applications. However, you are strongly encouraged to write 32-bit multithreaded applications for better performance and portability on OS/2 Warp Server for SMP. | The above compatibility requirements apply only to multithreaded applications, and therefore do not apply to DOS and WINOS2 applications. However, you are strongly encouraged to write 32-bit multithreaded applications for better performance and portability on OS/2 Warp Server for SMP. | ||
Given that there is the possibility of some set of applications which may use one of these techniques, OS/2 Warp Server for SMP provides a mechanism whereby these multithreaded 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. A utility is 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. See View and Set Program Type For Executable File (MARKEXE). | Given that there is the possibility of some set of applications which may use one of these techniques, OS/2 Warp Server for SMP provides a mechanism whereby these multithreaded 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. A utility is 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. See [[SMPProgAdd - View and Set Program Type For Executable File (MARKEXE)|View and Set Program Type For Executable File (MARKEXE)]]. |
Revision as of 18:50, 18 May 2025
Reprint Courtesy of International Business Machines Corporation, © International Business Machines Corporation
The following sections discuss application considerations of OS/2 Warp Server for SMP.
Application Compatibility Requirements
These compatibility requirements apply only to multithreaded applications, and therefore do not apply to DOS and WINOS2 applications. However, you are strongly encouraged to write 32-bit multithreaded applications for better performance and portability on OS/2 Warp Server for SMP.
- 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 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 can not 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 semaphore.
- In an OS/2 Warp Server 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/thread's flag register thinking that they each have the semaphore.
- Similarly a 486 or greater instruction such as the CMPXCHG has the same problem above if a LOCK prefix is not prepended before the instruction.
- An application or associated subsystem which relies on priorities to guarantee execution of its threads within a process will not work in OS/2 Warp Server 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 that the idle thread will not get any execution time unless the time-critical thread explicitly yields the CPU. In an OS/2 Warp Server for SMP environment it is possible that both the time-critical and idle threads are executing simultaneously on different processors.
The above compatibility requirements apply only to multithreaded applications, and therefore do not apply to DOS and WINOS2 applications. However, you are strongly encouraged to write 32-bit multithreaded applications for better performance and portability on OS/2 Warp Server for SMP.
Given that there is the possibility of some set of applications which may use one of these techniques, OS/2 Warp Server for SMP provides a mechanism whereby these multithreaded 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. A utility is 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. See View and Set Program Type For Executable File (MARKEXE).