[Solved]Mutex Semaphores Q1 Write Program Creates Certain Number Sellerthreads Attempt Sell Availa Q37161835

Do this using semaphores andmutex (linux based, C++)
(Mutex and Semaphores Q.1 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 Show transcribed image text (Mutex and Semaphores
Q.1 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
Expert Answer
Answer to (Mutex and Semaphores Q.1 Write a program that creates a certain number of sellerthreads that attempt to sell all the av… . . .
OR

