ALLInterview.com :: Home Page            
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
Google
   
 
Categories >> Software >> Operating Systems >> Operating Systems AllOther
 
 


 

 
 Windows interview questions  Windows Interview Questions (340)
 Linux interview questions  Linux Interview Questions (451)
 Unix interview questions  Unix Interview Questions (458)
 Solaris interview questions  Solaris Interview Questions (781)
 RTOS interview questions  RTOS Interview Questions (43)
 Bulnex interview questions  Bulnex Interview Questions (4)
 Operating Systems General Concepts interview questions  Operating Systems General Concepts Interview Questions (261)
 Data Structures interview questions  Data Structures Interview Questions (67)
 Operating Systems AllOther interview questions  Operating Systems AllOther Interview Questions (48)
Question
What is a semaphore?
 Question Submitted By :: Operating-Systems-AllOther
I also faced this Question!!     Answer Posted By  
 
Answer
# 1
Semaphores r software, blocking, OS assistance solution to
the mutual exclusion problem .It is
basically a non-negative integer variable that saves the
number of wakeup signals sent so they are not lost if the
process is not sleeping

another interpretation is that the semaphore value
represents the number of resources available
 
Is This Answer Correct ?    100 Yes 34 No
Swetcha
 
Answer
# 2
A semaphore, a new variable type.
A semaphore could have the value 0,indicating that no
wakeups were saved, or some positive values if one or more
wakeups were pending.
a semaphore s is an integer variable that apart from
initialization, is accesssed only through two standard
atomic operations, wait and signal. these operations were
orignially termed p(for wait to test) and v(for signal to
increment).
The classical defination of wait in psedocode is
wait(s)
{
while(s<=0)
;// no-op
s--;
}
The classical defination of signal in psedocode is
signal(s)
{
s++;
}
Modification to the integer value of smaphore in wait and
signal operations must be executed individually.
that is, when one process modifies the semaphore value no
other process can simultaneously modifiy that same
semaphore value.
 
Is This Answer Correct ?    67 Yes 11 No
Jethva_trupti
 
 
 
Answer
# 3
Semaphore is a machanism to resolve resources conflicts by
tallying resource seekers what is the state of sought
resources, achieving a mutual exclusive access to resources.
Often semaphore operates as a type of mutual exclusive
counters (such as mutexes) where it holds a number of access
keys to the resources. Process that seeks the resources must
obtain one of those access keys, one of semaphores, before
it proceeds further to utilize the resource. If there is no
more such a key available to the process, it has to wait for
the current resource user to release the key.
 
Is This Answer Correct ?    66 Yes 25 No
Kwrtos
 
Answer
# 4
In computer science, a semaphore is a protected variable or
abstract data type which constitutes the classic method for
restricting access to shared resources such as shared
memory in a multiprogramming environment. A counting
semaphore is a counter for a set of available resources,
rather than a locked/unlocked flag of a single resource. It
was invented by Edsger Dijkstra. Semaphores are the classic
solution to preventing race conditions in the dining
philosophers problem, although they do not prevent resource
deadlocks.
Semaphores can only be accessed using the following
operations. Those marked atomic should not be interrupted
(that is, if the system decides that the "turn is up" for
the program doing this, it shouldn't stop it in the middle
of those instructions) for the reasons explained below.
P(Semaphore s) // Acquire Resource
{
wait until s > 0, then s := s-1;
/* must be atomic because of race conditions */
}

V(Semaphore s) // Release Resource
{
s := s+1; /* must be atomic */
}

Init(Semaphore s, Integer v)
{
s := v;
}
 
Is This Answer Correct ?    29 Yes 12 No
Sagarika Mishra
 
Answer
# 5
Synchronization tool that does not require busy waiting
Semaphore S–integer variable
Two standard operations modify S: wait()and signal()
Originally called P()andV()
Less complicated
Can only be accessed via two indivisible (atomic) operations

wait (S)
{
while S <= 0;
// no-op
S--;
}
&#61548;signal (S)
{
S++;
}
 
Is This Answer Correct ?    23 Yes 11 No
Chinnadurai.s
 
Answer
# 6
"semaphore " is an integer value that provide signalling
among the process
and it is an synchronization tool
semaphores are proposed by "DIJKSTRA"
generally semaphores are divided into 2 types
they are 1.General semaphore(or)counting semaphore
2.Binary semaphore(or)Mutex
in general semaphores 2 primitives are used they are
1.semwait(s)
2.semsignal(s)
semwait() checks decrements the semaphore value if the value
becomes negative then the process executing the semwait()is
blocked other wise the process continues execution
semsignal() increments the semaphore value if the value is
less than or equal to zero then a process blocked by a
semwait()operation is unblocked
 
Is This Answer Correct ?    18 Yes 9 No
Mahi 27
 
Answer
# 7
->synchronization tool that does not require busy writing.
->semaphore S-integer variable
->can only be accessesd via two indivisible(atomic) operations
wait(S):while S<=0 do no-op;
S:=s-1;
signal(S):S+1;
semaphores are of two types

COUNTING SEMAPHORE-integer value can range over an
unrestricted domain.

BINARY SEMAPHORE-integer value can range only between 0 and
1;can be simpler to implement.

can implement a counting semaphore S as a binary semaphore.
 
Is This Answer Correct ?    10 Yes 6 No
Kondepati
 
Answer
# 8
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
Thangavelu T
 
Answer
# 9
Semaphore is a variable which ios used to provide mutual
exclusion. It has two operations namely wait() and signal()
 
Is This Answer Correct ?    15 Yes 14 No
Gaurav
 
Answer
# 10
Semaphores are devices used to help with synchronization. If
multiple processes share a common resource, they need a way
to be able to use that resource without disrupting each
other. You want each process to be able to read from and
write to that resource uninterrupted.

A semaphore will either allow or disallow access to the
resource, depending on how it is set up. One example setup
would be a semaphore which allowed any number of processes
to read from the resource, but only one could ever be in the
process of writing to that resource at a time.
 
Is This Answer Correct ?    3 Yes 2 No
Ragavendran
 

 
 
 
Other Operating Systems AllOther Interview Questions
 
  Question Asked @ Answers
 
i want information about real time operating systems because i have an interview tomoorow in valeo company.   1
MY system is showing "BOOT FAILURE:SYSTEM HALTED" after restarting the system please give me the solution for this problem thanking you........... ITC-Infotech 3
In the process table entry for the kernel process, the process id value is a) 0 b) 1 c) 2 d) 255 e) it does not have a process table entry IBM 4
What operating systems provide threads?   5
One Gigabyte =?( 2 power30 , 2 power 20 ,2 power 10 none) Mascot 4
Can I install the Operating System in USB Poratable Drive in 250 or 120GB? IBM 6
give the exact definition of operating system is it necessary to load OS in every system to run any program if so, why?   1
Method used for Disk searching.. a.linked list b.AVL c.B-tree d. binary tree Hughes 3
Assume that passwords are selected from four-character combinations of 26 alphabetic characters. Assume that an adversary is able to attempt passwords at a rate of one per second. a) Assuming no feedback to the adversary until each attempt has been completed, what is the expected time to discover the correct password? FCI 2
what is live lock,race condition,starvation?how it work and explain brifly?   3
Virtual memory size depends on [a] address lines [b] data bus [c] disc space [d] a & c [e] none Wipro 15
How to Compare Windows OS with OOPs concepts.....?? TCS 3
 
For more Operating Systems AllOther Interview Questions Click Here 
 
 
 
 
 


   
Copyright Policy  |  Terms of Service  |  Articles  |  Site Map  |  RSS Site Map  |  Contact Us
   
Copyright © 2013  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  KalAajKal.com