Question

A semaphore puts a thread to sleep: A)if it increments the semaphore's value above 0. B)until...

A semaphore puts a thread to sleep:

A)if it increments the semaphore's value above 0.

B)until another thread issues a notify on the semaphore.

C) if it tries to decrement the semaphore's value below 0.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

If the value of counter in semaphore is 0, then the thread is put to sleep until the counter value is greater than 0.

Add a comment
Know the answer?
Add Answer to:
A semaphore puts a thread to sleep: A)if it increments the semaphore's value above 0. B)until...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • True or False shared sem = Semaphore(0); Thread A: a1;sem.signal(); Thread B: sem.wait(); b1; Here, the...

    True or False shared sem = Semaphore(0); Thread A: a1;sem.signal(); Thread B: sem.wait(); b1; Here, the prefix shared indicates a shared variable. When these two threads execute concurrently, event a1 will execute before event b1.

  • Is This Correct? semaphore fillCount = 0; // Items produced semahore emptyCount = BUFFER_SIZE; // remaining...

    Is This Correct? semaphore fillCount = 0; // Items produced semahore emptyCount = BUFFER_SIZE; // remaining space procedure producer() {    While (true) {    item = produceItem(); down(emptyCount); // emptyCount is decremented putItemIntoBuffer(item); up(fillCount); // fillcount is incremented } } procedure consumer() { While (true) {    down(fillCount); item = removeItem(); up(emptyCount); // emptyCount is incremented consumeItem(item); } } Instructions Programming Assignment Four In computing, the producer-consumer problem (also known as the bounded-buffer problem) is a classic example of...

  • I know is this posted else where BUT I NEED HELP IMPLEMENTING THE TIME DELAY!!!! I...

    I know is this posted else where BUT I NEED HELP IMPLEMENTING THE TIME DELAY!!!! I need a source comment next to the line that gives the delay so i can compare please. (Concurrency – Semaphores) 1.- In this assignment you will implement a deadlock free variant of the bounded-buffer producer/consumer using jBACI (C - -). C- - is a subset of C + + that allows you to declare semaphores and apply the operations P and V. In the...

  • A university computer science department has a teaching assistant (TA) who helps undergraduate students with their...

    A university computer science department has a teaching assistant (TA) who helps undergraduate students with their programming assignments during regular office hours. The TA’s office is rather small and the TA can help only one student at a time in the office. There are two chairs in the hallway outside the office where students can sit and wait if the TA is currently helping another student. When there are no students who need help during office hours, the TA sits...

  • 1. Analyze the following code: public class Test implements Runnable { public static void main(String[] args) { Thread t = new Thread(this); t.start(); } public void run() { System....

    1. Analyze the following code: public class Test implements Runnable { public static void main(String[] args) { Thread t = new Thread(this); t.start(); } public void run() { System.out.println("test"); } } 1. The code compiles but will not print anything since t does not invoke the run method. 2. The code will not compile since you cannot invoke "this" in a static method. 3. The program compiles, runs, and prints tests on the console. 2. What will the following example...

  • Description In this homework, you are asked to implement a multithreaded program that will allow ...

    Description In this homework, you are asked to implement a multithreaded program that will allow us to measure the performance (i.e, CPU utilization, Throughput, Turnaround time, and Waiting time in Ready Queue) of the four basic CPU scheduling algorithms (namely, FIFO, SJE PR, and RR). Your program will be emulating/simulating the processes whose priority, sequence of CPU burst time(ms) and I'O burst time(ms) will be given in an input file. Assume that all scheduling algorithms except RR will be non-preemptive,...

  • According to this cord use LongFifoWait Notify thread methord in CircularArrayLongFifo class. According to this cord...

    According to this cord use LongFifoWait Notify thread methord in CircularArrayLongFifo class. According to this cord use LongFifoWait Notify thread methord in CircularArrayLongFifo class. public class CandidateGenerator { private final LongFifo outputFifo; public CandidateGenerator(LongFifo outputFifo) { this.outputFifo = outputFifo; Runnable r = new Runnable() { @Override public void run() { runWork();}}; Thread t = new Thread(r, "CandidateGenerator"); t.start() } private void runWork() { try { outputFifo.add(2); long number = 3; while ( true ) { outputFifo.add(number); number += 2;} }...

  • Can an expert please help me solve the question above? Please show work. Glossimer Thread Company...

    Can an expert please help me solve the question above? Please show work. Glossimer Thread Company ls evaluating investment that will cost $755,000 and will yleld cash inflows of $240,000 in the first year, $340,000 In the second year, and S370,000 in the third and the final year. Use the table below and determine the internal rate of return Present value of S1: 9% 10% 11% 12% 1 n 926 0.917 0.909 0.901 0.893 2 0.857 0.842 0.826 0.812 0.797...

  • b C ER3 2 Write out your equations for the circuit pictured above, using variables for...

    b C ER3 2 Write out your equations for the circuit pictured above, using variables for current (I1, I2, 13), resistance (R1, R2, R3), and battery emf (E1, E2, E3). Capitalization matters; enter "E1", not e1". Also, don't enter an equals sign in your answer! (Notice that for all the answer boxes below, the right-hand side of the equation is already provided.) Write a formula for the current junction rule. = 0 Tries 0/8 Submit Answer Write a voltage loop...

  • X 1. Determine the truth table for the above circuit. A B C 0 0 0...

    X 1. Determine the truth table for the above circuit. A B C 0 0 0 0 0 0 1 0 0 1 1 1 0 0 1 0 1 1 1 0 111 2. Determine the Karnaugh Map for the above circuit and do both an SOP minimization (the left KAI) and a POS minimization (the right KM). Write the minimized Boolean expressions below the corresponding Karnaugh Map BC ВС 00 01 11 10 00 01 11 10 0...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT