Dismiss
InnovationQ will be updated on Sunday, Oct. 22, from 10am ET - noon. You may experience brief service interruptions during that time.
Browse Prior Art Database

OS/2 System Semaphore Limit Workaround

IP.com Disclosure Number: IPCOM000111408D
Original Publication Date: 1994-Feb-01
Included in the Prior Art Database: 2005-Mar-26
Document File: 8 page(s) / 259K

Publishing Venue

IBM

Related People

Lahey, LC: AUTHOR [+2]

Abstract

Disclosed is a technique to circumvent the OS/2* v1.3 system (named) semaphore limit of 256. This limit may be a problem when many instances of a program that uses system semaphores are running concurrently. For example, if an application uses 25 system sema- phores (which is a reasonable number), then the 11th (or less, depending on how many system semaphores OS/2 and other running processes use) instance of that application that is started will cause a system error that prevents it from running successfully. Also, an application that "hogs" these semaphores will keep other applications from running.

This text was extracted from an ASCII text file.
This is the abbreviated version, containing approximately 19% of the total text.

OS/2 System Semaphore Limit Workaround

      Disclosed is a technique to circumvent the OS/2* v1.3 system
(named) semaphore limit of 256.  This limit may be a problem when
many instances of a program that uses system semaphores are running
concurrently.  For example, if an application uses 25 system sema-
phores (which is a reasonable number), then the 11th (or less,
depending on how many system semaphores OS/2 and other running
processes use) instance of that application that is started will
cause a system error that prevents it from running successfully.
Also, an application that "hogs" these semaphores will keep other
applications from running.

      This technique provides a layer of software that simulates
system semaphores by creating RAM semaphores (for which there is no
system limit in OS/2 1.3) in a special shared memory area.  Once
created, all semaphore calls would work as expected, and existing
code would not have to be altered.  Each process that uses system
semaphores would simply have to call a SSEM_init routine (to link to
the semaphore shared memory area), and then all semaphore calls would
be trapped by this layer.  This new layer will perform all necessary
checks done for system semaphores, and then call the regular OS/2
semaphore handling routine to operate on a substituted RAM semaphore.

      The important aspect of this technique is that it will involve
little modification to existing code.  The only changes required
would be:

o   All code files using semaphores would have to include a new
    header file

o   All processes using semaphores would have to call an
    initilization function prior to calling any semaphore functions.

      This is a very small hit to existing code and is very unlikely
to introduce any errors (caused by mistyping, replacing semaphore
calls, etc.).  After these changes are made, a recompile is needed
and the new SSEM module would have to be added to the link of all
DLLs or EXEs that use semaphore calls.

      The SSEM module needs to provide substitute functions for all
OS/2 1.3 semaphore calls.  This module would be linked with all the
application executables that are remapping the system sema- phores.
Each C code file that uses semaphores will include a SSEM.H file
which will redefine all the OS/2 semaphore system calls (so that this
module gets called instead of the real OS/2 functions).  This file
will include the renaming macros illustrated below (in C syntax):

*  #define DosCreateSem(a, b, c)SSEM_DosCreateSem(a, b, c)

*  #define DosOpenSem(a, b)SSEM_DosOpenSem(a, b)

*  #define DosSemClear(a)SSEM_DosSemClear(a)

*  #define DosSemRequest(a, b)SSEM_DosSemRequest(a, b)

*  #define DosSemSet(a)SSEM_DosSemSet(a)

*  #define DosSemSetWait(a, b)SSEM_DosSemSetWait(a, b)

*  #define DosSemWait(a, b)SSEM_DosSemWait(a, b)

*  #define DosMuxSemWait(a, b, c)SSEM_DosMuxSemWait(a, b, c)

*  #define DosCloseSem(a)SSEM_DosCloseSem(a)

      This header fi...