A multi-threaded producer-consumer program that simulates hotdog making and packing using pthreads.
gcc -std=c11 -o hotdog_manager hotdog_manager.c -lpthread./hotdog_manager <N> <S> <M> <P>- N: Total hot dogs to produce
- S: Buffer size (must be less than N)
- M: Number of maker threads
- P: Number of packer threads (max 30)
./hotdog_manager 10 5 2 3Method 1: For loop
for ($i=1; $i -le 5; $i++) { ./hotdog_manager.exe 10 5 2 3 }Method 2: Range operator
1..5 | ForEach-Object { ./hotdog_manager.exe 10 5 2 3 }Method 3: With run number display
1..5 | ForEach-Object { Write-Host "=== Run $_ ==="; ./hotdog_manager.exe 10 5 2 3 }Method 1: Brace expansion
for i in {1..5}; do ./hotdog_manager 10 5 2 3; doneMethod 2: C-style for loop
for ((i=1; i<=5; i++)); do ./hotdog_manager 10 5 2 3; doneMethod 3: While loop
i=1; while [ $i -le 5 ]; do ./hotdog_manager 10 5 2 3; i=$((i+1)); doneMethod 4: With run number display
for i in {1..5}; do echo "=== Run $i ==="; ./hotdog_manager 10 5 2 3; doneThe program generates a log.txt file containing:
- Order details (N, S, M, P)
- Production log (maker puts, packer gets)
- Summary statistics (per-maker and per-packer counts)