Question 12

Implemented a bounded queue:

Read:

If queue is empty, wait till it can return a value with time out

If another thread is reading from the queue then wait till that thread is done

Remove the first element from the queue and return it

Do not block if a thread is writing into the queue

Write:

If queue is full, wait till one value is read with time out

If another thread is writing to the queue, wait till that thread is done

Write the element at the end of the queue

Do not block if a thread is reading from the queue.

Ask Us How You Can Get Your First Dream Job 😉

Fill in the form below to book a 30 min no-obligation consulting session.

 

New Report

Close