Write a program that creates a certain number of sellerthreads that attempt to sell all the available tickets. There is a global variable numTickets which tracks the number of tickets remaining to...


Write a program that creates a certain number of sellerthreads that
attempt to sell all the available tickets. There is a global variable
numTickets which tracks the number of tickets remaining to sell.
We will create many threads that all will attempt to sell tickets until
they are all gone. Each thread will exit after all the tickets have
been sold.
E.g. if we have 4 tickets and 2 sellerthreads then output should be like
Seller #1 sold one (3 left)
Seller #0 sold one (2 left)
Seller #1 sold one (1 left)
Seller #0 sold one (0 left)
Seller #1 noticed all tickets sold! (I sold 2
myself)
Seller #0 noticed all tickets sold! (I sold 2
myself)
Done


Do this using semaphores and c++ linux based



Jun 06, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here