03 Activity 3 - ARG
03 Activity 3 - ARG
2. How does the structure of counting semaphore primitives differ from binary semaphore
primitives?
A process or a thread can be used to synchronize access to a shared resource,
depending on the entity making the request. By nature, binary semaphores are just
simply binary. There are only two possible values for them: one to indicate that the
important portion, which includes the code that accesses the shared resource, is
occupied and that other process or threads must wait, and another to denote that the
crucial section is free. Semaphores, on the contrary side, are counted that use more
than two values and can have any value.
3. Briefly explain the purpose of the semWaitB and semSignalB functions in Figure 2.
The “if else statement” used by semWaitB to determine if a statement is either true or
false and serves as the basis for both semWaitB and semSignalB. The function would be
zero if the value is the same as the true statement, whereas if the value becomes false,
it will halt the queue process. The second one is semSignalB, which works by moving the
process to the ready list if the statement is false.
4. Based on Figures 1 and 2, which semaphore structure is easier to implement and why?
According to both Figures 1 and 2, the counting semaphore is simpler to operate since it
employs increment and decrement. Whereas if value is intended to be blocked or
unblocked, it helps with coding. When there are resources available, a counting
semaphore can monitor the quantity of remaining resources. The semaphore counter
goes down by one when a thread accesses one of the semaphores and goes up by one
when the thread releases the semaphore.
5. Deduce at least one characteristics of a monitor based on figure 3 Elaborate on your
answer.
The fact that only one process can be operational at a time on a monitor, which is a
significant problem with monitors, undermines encapsulation. "Procedure k" The
Readers-Writers issue isolates the protected resource from the monitor, therefore it's
likely that a malicious Reader or Writer could acquire the databases without first getting
approval from the monitor.
6. Would you agree that a monitor, as a concurrency mechanism, can support process
synchronization? Why or Why not?
I agree that the process synchronization of the concurrency mechanism may be
supported by the monitor. In order to achieve mutual exclusion across processes,
programming languages are used by the monitor. The monitor's internal variables are
inaccessible to processes operating outside of the monitor, although they can invoke its
operations.