This project implements a solution to the classic Bounded Buffer Problem also known as Producer Consumer Problem using POSIX threads, semaphores, and mutexes in C. The producer and consumer threads share a fixed -size buffer, with synchronization achieved through semaphores and mutexes to prevent race conditions.the infinite loop to simulate a server -client scenario, the consumer consumes the items in Last in First out manner (simulating a stack ).

- Multi-threaded Synchronization: Ensures thread-safe access to the buffer using mutex locks.
- Semaphore Control: Uses semaphores to manage full and empty slots in the buffer.
- Checking Buffer Status : to display the current buffer status.
producer.c: Contains theproducerfunction, which generates and adds items to the shared buffer.)consumer.c: Contains theconsumerfunction, which removes and processes items from the buffer.utils.c: Contains thedisplay_buffer_statusfunction to print the buffer's current status.main.c: Initializes semaphores, mutexes, and threads, and starts the producer and consumer operations.shared.h: Header file containing shared definitions, constants, and function prototypes.
To compile the project, use in a terminal:
gcc main.c producer.c consumer.c display_buffer_status.c -o p_c -lpthread