Breaking News: Grepper is joining You.com. Read the official announcement!
Check it out

Which two methods of Object class can be used to implement a Producer Consumer scenario?

Pragya Keshap answered on February 4, 2023 Popularity 1/10 Helpfulness 1/10

Contents


More Related Answers


Which two methods of Object class can be used to implement a Producer Consumer scenario?

0

In a Producer Consumer scenario, one thread is a Producer and

another thread is a Consumer.

For this scenario to start working, a Consumer has to know when

the Producer has produced. In Object class, there is a wait()

method. A Consumer calls wait method to wait on Producer. The

Producer used notify() method of Object class to inform Consumer

that it has produced.

In this way the processor time between produce and consume

operations is freed due to the use of wait() and notify() methods.

https://www.baeldung.com/java-producer-consumer-problem

Popularity 1/10 Helpfulness 1/10 Language java
Source: Grepper
Link to this answer
Share Copy Link
Contributed on Feb 04 2023
Pragya Keshap
0 Answers  Avg Quality 2/10


X

Continue with Google

By continuing, I agree that I have read and agree to Greppers's Terms of Service and Privacy Policy.
X
Grepper Account Login Required

Oops, You will need to install Grepper and log-in to perform this action.