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

describe the situation in which priority inversion can occur

911


Which is your favorite editor, shell, programming shell and why?

2073


What is the difference between wget and curl?

555


What is the meaning of slosh login in nfs?

2095


How do I clean up and speed up my laptop?

487






Do simultaneous downloads take longer?

544


i want information about real time operating systems because i have an interview tomoorow in valeo company.

2911


Is system restore bad for your computer?

528


What is gnu os?

549


What is the most powerful server in the world?

559


Does redhat use yum?

506


What is the difference between concurrency and parallelism?

551


Can I factory reset my laptop without a recovery disc?

537


What is the g in gnu?

541


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....?

2036