What is Semaphore? ( SM50, sem)
What is Semaphore?
In computer science, particularly in operating systems, a semaphore is a variable or abstract data type that is used for controlling access, by multiple processes, to a common resource in a parallel programming or a multi user environment.
What do the semaphores mean in SAP?
In trace files or in transaction SM50 (process overview),
Semaphores are mentioned. How do you determine which semaphores control what?
Reason and Prerequisites ?
If a work process locks a particular resource, it sets a semaphore. Another work process that also wants to access it must then wait. In this case, the number of semaphores is displayed by SM50.
Example: if any user while login (6: ROLL_ADM (roll administration)) semaphore will be locked, semaphore 6 is set.
How to Monitor Semaphores ?
Using SM50 transaction code. Find below screen shots.
Find below screen shot , How to see all the sap related semaphores by pressing F1 key.
In Operating system level ( MMC ) also you can observe in sem column (10 & 4 )
Thanks
Shiva Kumar
very good document and useful.
regards,
meher
well - nice document!
To be added:
This document is not windows specific. Therefore I am going to move it to the appropriate area within the next days.
regards
Peter
Thanks peter
I am unable to capture those (but a process can hold more than one semaphore at a time) screen shots. I will try to capture and I will put here.
Very Good Docuemntation
Nice..
The semaphore column in SM50 / SM66 tells you whether that work process is holding a semaphore, or waiting for one, if the field is blank (which should be most of the times) then the work process is not holding nor waiting for a semaphore.
the WP requires a semaphore only when it will execute a very specific part of its code like -
for example, let us say that WP10 reached a part of the code where it will change the "roll administration" shared memory area before doing any changes, it will request semaphore 6
if it was able to lock semaphore 6, it proceeds and perform the change in the "roll adm" memory
releasing the semaphore soon after, so other WPs can get it, if / when required. But if WP could not get the lock, it will keep trying but this should be very, very fast on a normal running system, it would be almost impossible to see a semaphore in SM50
Semaphores are OS level resources that we use to protect the execution of critical code in the kernel, ensuring that only a single process is executing that code at a time
this is normally related to changing shared memory areas.
Regards,
Rahul Vhankore