Jump to content

SMPProgAdd - Application Considerations: Difference between revisions

From EDM2
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

SMP Programming Addendum
  1. How to Use the SMP Programming Addendum
  2. Introduction to OS/2 Warp Server Version 4 Advanced
  3. Platform Specific Drivers (PSDs)
  4. High Memory Support
  5. Raw File System
  6. Processor Management and Performance Functions
  7. Application Considerations
  8. Device Drivers In OS/2 Warp Server for SMP
  9. New Device Helper (DevHlp) Routines
  10. Kernel Debugger
  11. The ICAT Debugger
  12. Software Trace Facility (STRACE)
  13. View and Set Program Type For Executable File (MARKEXE)
  14. Data Types
  15. Errors
  16. Generic IOCtl Commands
  17. Sample Source Code for a PSD
  18. Comments, Please!
  19. Glossary
  20. Notices

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).