What is a semaphore?

Answer Posted / thangavelu t

semaphore is integer variable that used to achieve mutual
exclusion.
it always indicates no of resource instances available.

programming example:
code
{
acquire(s);
critical region;
release(s);
}

acquire(semaphore s)
{
while(s==0);
s--;
}
release(semaphore s)
{
s++;
}
init(semaphore s,int instances)
{
s=instances;//initializes to no of resources instances
}

Is This Answer Correct ?    7 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the shortcut key to refresh laptop?

504


Can we kill init process?

587


What is the difference between concurrency and parallelism?

561


What Command To Restore Backup Of Non - Rootvg?

632


Who started gnu?

722






1) What is an Virtual memory? 2) How do we test API's in both Windows/Linux/Unix? 3) What is an IOCTL? 4) How do you open a char device through API's? 5) What is major num/ minor num? 6) What is the max num for minor num? 7) Who gives you the major / minor numbers? 8) Reverse a string using recursive func. 9) fork/vfork/clone. 10) What does fork returns? 11) What is a zombie process? 12) What happens when a child completes before parent tries to wait for it? 13) Interrupt handlers, top-hdnl....?

2047


What do you know about the latest android version Lollipop?

549


Does a disk cleanup delete everything?

587


How do you fix a crashed computer?

614


How do I clean up my computer to make it run faster?

533


What is the first operating system in the world?

558


How do you clear cache on a laptop?

539


What os is used at google?

533


How do you pronounce gnu?

555


Will disk cleanup delete my files?

515