Consultor Eletrônico



Kbase P115480: Why is the sem value zero on windows?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   25/04/2006
Status: Unverified

GOAL:

Why is the sem value zero on windows?

GOAL:

On Windows, the semaphore numbers are not shown in the promon sems column.

GOAL:

On unix, the semaphore numbers are shown in the promon sems column.

FIX:

The short answer is that Windows does not have semaphore sets, so the number within the set is meaningless.

From the Progress perspective always "use" semaphores irrespective of the OS or if -spin locks are inuse. The Progress Solution references below take this discussion further.

Although we use semaphores on Windows, these are internal semaphores which are entirely managed by the Windows OS and not exposed. Semaphores on Windows are only limited by the resource availability. Unlike on Unix where these are kernel settings.

On Unix the semget() function (sys/sem.h) is used to get a set of semaphores and it returns a semaphore identifier. The information displayed by promon is the semaphore id returned by that function. On Unix the semid returned by semget() is used as a parameter for other operations functions as well such as semop().

example:
promon, User Control:

Usr Name Type Wait Area Dbkey Trans PID *Sem* Srv Login Time
0 userid BROK -- 0 0 0 1108 3 0 04/21/06 16:06
5 userid MON -- 0 0 0 1309 8 0 04/21/06 16:56

Windows also provides a semaphore object with similar functionality and is created using the createsemaphore() function but instead of returning a non-negative integer id, it returns a handle to the semaphore object and one of its functions parameters is the name of that object.

Windows has its own style of interprocess communication/system calls, the name or the handle can be used later in other semaphore related operations functions, so it would not help anything to have the information about that handle on promon.

example:
promon, User Control:
Usr Name Type Wait Area Dbkey Trans PID *Sem* Srv Login Time
0 userid BROK -- 0 0 0 2024 0 0 04/21/06 16:07
5 userid MON -- 0 0 0 1836 0 0 04/21/06 17:04