you will write a program that will package books published by different publishers.
You will have publisher and packager threads. After publishers publish books, packagers package the
The number of publisher types, publisher and packager threads will be given as command line
argument. (i.e. You will have n number of publisher types. Each publisher type will have m
publisher threads (at total, there will be m*n publisher threads). There will be k number of
packager threads. All these numbers (n, m, and k) will be given as command line arguments.)
Each publisher type threads will publish one type of book. The number of books that will be
published by each publisher type will be given as command line argument.
The books will be named according to its publisher type, i.e., the lth book published by the ith type
of publisher will be named Booki_l.
After publishing a new book, each publisher thread will put it in a buffer that is shared among the
same type of publisher. (Each publisher type will have its own buffer.) The buffers’ initial size
will be given as command line argument.
When its buffer is full, the publisher thread that wants to put a book will double the size of the
When each publisher thread publishes required number of books, they will exit the system.
Packagers package the books published. They will take books from the buffers (each packager
thread can take books from all buffers).