top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What is Semaphore, what is significance of .sem file created?

0 votes
547 views

Please explain with real life example?

posted Jun 22, 2014 by Amit Kumar Pandey

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

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.

When used for a pool of resources, a semaphore tracks only how many resources are free; it does not keep track of which of the resources are free. Some other mechanism (possibly involving more semaphores) may be required to select a particular free resource.

For example someone facing the error while locking the file by using the pvcs client tool. But able to lock the file using the unix command line.
here is my error receives:
Version Manager could not create the semaphore "\PVCS_CBM-CUSTOMIZING\archives\CBM-CUSTOMIZING\CbmDfa\GRAND_TOT_OUT_RES_GER.DFA-arc" for this project. The semaphore may already exist or the location may be invalid.

Here .sem file has been created in that location we need to delete the .sem there after that you can able to lock or any process on that file.

answer Jul 6, 2014 by Kali Mishra
Similar Questions
+1 vote

I need to create two child processes each of which calls its own execvp on fork and the executable share common POSIX semaphores between them.
So do I need to create a shared memory or just implement named semaphores?

+1 vote

What happens after you write “a.out” and press enter. What are the functionality performed by the OS after executable file is created of your code.

...