Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The int sem _ trywait ( sem _ t * sem ) operation blocks if ( a ) the semaphore value > 0 (

The "int sem_trywait (sem_t *sem)" operation blocks if
(a) the semaphore value >0
(b) the semaphore value =0
(c) it never blocks
(d) None of the above
Which of the following CORRECT about the sem_init function shown below.
int sem_init(sem_t *sem, int pshared, unsigned int value);
(a) It is used to initialize both named and unnamed semaphores and to assign the value
specified by the "value" parameter to the semaphore.
(b) It is used to initialized named semaphores only and to assign the value specified by the
"value" parameter to the semaphore.
(c) the pshared variable is used to specify whether the semaphore can be used within the
calling process only or it can be used by multiple processes.
(d)(b) and (c)
(e) None of the above
In the pseudo-code blow, what initial values of the semaphores S and Q will cause the two pro-
cesses to alternate in executing their printf statements such that the output is A , B, A, B, A , B, A , B,...
(a)S=0,Q=0
(b)S=1,Q=1
(c)S=0,Q=1
(d)S=1,Q=0
(e) None of the above
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Select Healthcare Classification Systems And Databases

Authors: Katherine S. Rowell, Ann Cutrell

1st Edition

0615909760, 978-0615909769

More Books

Students also viewed these Databases questions

Question

22. Determine the percent contributions of Exercise 20.

Answered: 1 week ago

Question

Under what circumstances is polygraph testing of employees legal?

Answered: 1 week ago