You are on page 1of 1

1. In your perspective, what makes counting semaphore primitives a good concurrency mechanism?

I think a counting semaphore is a good concurrency mechanism because it provides the three
operations of initialization, decrement, and increment. Providing data value is the process of initializing.
To end a process, use a decrease. The increment can be used to unblock a process.
2. How does the structure of counting semaphore primitives differ from binary semaphore primitive?
Those two semaphores differ from one another in how they work. The three actions that are
used when counting semaphore are initialization, decrement, and increment. Binary semaphore uses
the binary numbers zero and one, respectively. It is possible to block a process with no uses and unblock
it with using one.
3. Briefly explain the purpose of the semWaitB and semSignalB functions in Figure 2.
The process is stuck at the waiting stage, which is why semWaitB exists. The operation is
unblocked while it is in the semSignalB signal phase since it needs a signal to put a process on the
ready list. To block and unblock processes, the user must utilize the numbers 0 and 1.
4. Based on Figures 1 and 2, which semaphore structure is easier to implement and why?
In my opinion, semaphore counting is simpler and easier to understand. The processes can be
more easily distinct in counting semaphore. Additionally, the procedures are easier to implement
because they focus more on the input.
5. Deduce at least one (1) characteristic of a monitor based on Figure 3. Elaborate on your answer.
Synchronization is one of a monitor's attributes, as seen in Figure 3. Synchronization is
accomplished by applying condition variables that are available and kept nearby the monitor.
Condition variables are implemented by two routines: cwait and csignal. When condition C is met, a
process is stopped using the Cwait command. A blocked process can be restarted using csignal
following a cwait in the same situation.
6. Would you agree that a monitor, as a concurrency mechanism, can support process
synchronization? Why or why not?
The monitor is used in computer programming to implement deadlocks within processes, so
the answer is yes. Programs running outside of the monitor are unable to access the internal factors
of the monitor. however, the monitor's protocols could be triggered. Additionally, the code inside the
monitors can only be run by one process at a time. Monitors are more efficient than semaphore-
based systems at Benefits from parallel programming that is simpler to manage and less error-prone
are achievable.

You might also like