Professional Documents
Culture Documents
ROSALES - 04 Quiz 1
ROSALES - 04 Quiz 1
Platform Technology
Instructions: Analyze the given concurrency mechanism figures and answer the corresponding questions
for each type. Use 3-5 sentences in answering. (6 items x 5 points)
2. How does the structure of counting semaphore primitives differ from binary semaphore
primitives?
- Because the counting semaphore can complete the job more quickly than the binary
semaphore, I realized that the two primitives were different. While binary semaphore is straightforward,
the word binary only has two possible values: 0 and 1. He can carry out various activities that binary
semaphore cannot due to the words "count" and "universal semaphore."
2. Briefly explain the purpose of the semWaitB and semSignalB functions in Figure 2.
- The semaphore's value is decreased by one via the semWaitB procedure. The semaphore is
decremented once its value rises over zero. The semSignalB function will carry out a SIGNAL
action on the supplied semaphore. To be more precise, if the process's value is zero (zero), it
will be halted and unable to move on. However, if the process value is 1, the process will
carry on. In semSignalB, the semaphore value is set to 1, but it is blank in semSignalA. If not,
one is added to the queued processes for the ready list. For instance, the process must be
set to 1 in order to process a request if the queue is empty.
4. Based on Figures 1 and 2, which semaphore structure is easier to implement and why?
- My opinion is that the binary semaphore is easier to use than the counting semaphore. due to
binary semaphore's limited support for 0 and 1 values. The binary semaphore value can only be either 0
or 1, so to speak. The wait action is successful when the semaphore is equal to 1, and the signal
operation is successful when the semaphore is equal to 0.
5. Deduce at least one (1) characteristic of a monitor based on Figure 3. Elaborate on your
answer.
- The line for entering processes, which is where the process makes its grand entrance, is one of
a monitor's properties. Without this property, the process cannot enter the monitor, and the monitor
concurrency does not exist.
6. Would you agree that a monitor, as a concurrency mechanism, can support process
synchronization? Why or why not?
- Yes, as mutual exclusion within programming language processes is carried out using the
monitor. Although the processes running outside the monitor are unable to access its internal variables,
they are able to call its procedures. Additionally, only one process at a time can run the monitors' code.
As a result, monitors make parallel programming easier to manage and less error-prone than
semaphore-based approaches.