Question: Consider the code below of the two processes P 1 and P 2 . Which of the following initial values of S and Q may

Consider the code below of the two processes P1 and P2. Which of the following initial values
of S and Q may cause indefinite blocking for one or both processes.
(a)S=2,Q=2
(b)S=2,Q=1
(c)S=1,Q=2
(d)S=1,Q=1
(e) None of the above
Assume that a semaphore named "S" already exists. The result of calling sem_open as shown
below is
#define PERMS (mode_t)(S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)
#define FLAGS (0_CREAT)
...
sem_open ("S", FLAGS, PERMS, 2);
(a) Changing the permissions on the existing semaphore to PERMS, and setting its value to 2
(b) Ignoring PERMS and setting the value of the semaphore is 2
(c) Both PERMS and the value (that is 2) will be ignored
(d) A new semaphore with is created with the same name, and its access permissions are set
to PERMS and its initial value is set to 2
(e) None of the above
Which of the following functions is used to remove a named semaphore from the system?
(a) sem_unlink
(b) sem_destroy
(c) sem_close
(d) None of the above
 Consider the code below of the two processes P1 and P2.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!