Machine-translated by Google. Questions are authored in English.
Top

Discussion

What is the purpose of a semaphore in process synchronization ?

  • A.To schedule processes
  • B.To control access to shared resources
  • C.To allocate memory
  • D.To handle interrupts

Answer: B

A semaphore is used to control access to shared resources.

A semaphore is an integer variable changed only by the atomic operations wait (P) and signal (V). A binary semaphore enforces mutual exclusion on a critical section, and a counting semaphore limits how many processes may use a pool of resources at once. Semaphores are also used to order events between processes.

Scheduling is the job of the CPU scheduler, memory allocation the job of the memory manager, and interrupts are handled by interrupt service routines. A semaphore does none of these.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.