Semaphores are used to prevent multiple processes from accessing critical piece of code at the same time and thereby corrupting it. The fields in semaphores are:
count: initial value of 1,which means only one process can access this resource at any given point of time. When a process accesses the resource, the count is decreased. When a process is finished processing the resource, count is increased.
waking: The number of processes waiting for this resource to become free and thereby waiting for awakening.
wait queue: processes waiting for this resource are assigned to this queue.
lock: buzz lock used when waking field is accessed.
PS: The download link mentioned below is not working now. I will update the location soon with the script.
You can download the one line script to clean semaphores here
Grant executable privilege to the file and then run.
chmod u+x cleansema.sh






0 comments:
Post a Comment