Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

[ Concurrency ] Read pages 1-9 of The Little Book of Semaphores (http://greenteapress.com/wp/semaphores/). Answer the following questions: 1. Suppose we cannot tell, by looking at

[ Concurrency ] Read pages 1-9 of The Little Book of Semaphores (http://greenteapress.com/wp/semaphores/). Answer the following questions:

1. Suppose we cannot tell, by looking at the source code for a program, which of two events will happen first. Then the two events are a) concurrent, or b) sequential?

2. What would you call an operation that cant be interrupted? a) shared, b) synchronizable, or c) atomic?

3. Suppose a semaphore is created with value 0, then two threads call wait() on the semaphore, so that the two threads get blocked, and the semaphore value is -2. If another thread now calls signal() on the semaphore, what happens? a) one of the blocked threads is unblocked, or b) nothing, because after the signal the semaphore is still negative.

4. Suppose a thread is blocked on a semaphore, and another thread then performs a signal() operation on the semaphore. What happens immediately afterward? a) the thread that performed the signal continues execution, b) the thread that was blocked will unlock and begin executing immediately, c) some other thread begins execution, or d) the programmer doesnt know which of a,b,c might happen.

5. Semaphores can be used a) in place of locks, b) in place of condition variables, or c) in place of both locks and condition variables.

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

Database Concepts

Authors: David Kroenke

4th Edition

0136086535, 9780136086536

Students also viewed these Databases questions

Question

What is DDL?

Answered: 1 week ago