Question: Solve using pthreads not windows api!!! Problem Hw3.c code file to go finish coding #include buffer.h #include #include #include #include buffer_item buffer[BUFFER_SIZE]; void *producer(void *param);
Design and implement a solution for Producer-Consumer Problem using Pthreads library in Linux virtual machine. Steps: Download buffer.h and the incomplete version of hw3.c from iCollege Read through Programming Project 3 of Chapter 5 (Producer-Consumer Problem) in the textbook. Follow the suggestion in the textbook to complete the C program using Pthreads. Do NOT solve the problem using Windows API In addition to the requirement in the textbook, print a message every time an item is produced or consumed in your producer and consumer threads. The message should also include the thread ID of the producer or consumer. To get a thread's ID, you may call pthread_self) function and convert the result into an integer. For example, you can use printf("Consumer %u consumed %d ",(unsigned int) pthread-self(), consumed-number); for the consumer. You can use a similar code for the producer. Compile the C source file using gcc -pthread-o hw3 hw3.c Use ./hw3
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
