7cb68945aa7e94360f66977fe7d524c12fac4139
				
			
			
		
	4600-project-1
Project 1 for CSCE4600, for Team G4
Build
Build with make
Run with make run
Clean with make clean
Explanation of Solution
Counting Semaphores:
This project uses four counting semaphores:
- 
sem_freelisttracks the number of blocks on thefreelist.- This prevents any thread from trying to read a nonexistent (
nullptr) block from thefreelist. 
 - This prevents any thread from trying to read a nonexistent (
 - 
sem_freelist_minus_1tracks the number of blocks on thefreelistminus 1:- This is used to circumvent a deadlock situation where Thread-1 (the producer) will eat the last block on the 
freelistand put it onlist1, where Thread-2 (the transformer) will never be able to consume it, since it's blocked on the emptyfreelist. - Without this, you'd need to check that 
sem_freelist > 1, and the project specifications only allow the use of P() and V(), A.K.A.wait()andsignal(). 
 - This is used to circumvent a deadlock situation where Thread-1 (the producer) will eat the last block on the 
 - 
sem_list1tracks the number of blocks onlist1.- This prevents any thread from trying to read a nonexistent (
nullptr) block fromlist1. 
 - This prevents any thread from trying to read a nonexistent (
 - 
sem_list2tracks the number of blocks onlist2.- This prevents any thread from trying to read a nonexistent (
nullptr) block fromlist2. 
 - This prevents any thread from trying to read a nonexistent (
 
All counting semaphores were used for thread synchronization.
Binary Semaphores:
This project uses three binary semaphores:
- 
sem_freelistguarantees mutual exclusion when accessing thefreelist.- This prevents memory corruption, as list accesses are thread-unsafe.
 
 - 
sem_list1guarantees mutual exclusion when accessinglist1.- This prevents memory corruption, as list accesses are thread-unsafe.
 
 - 
sem_list2guarantees mutual exclusion when accessinglist2.- This prevents memory corruption, as list accesses are thread-unsafe.
 
 
All binary semaphores were used for mutual exclusion.
Description
				
					Languages
				
				
								
								
									C++
								
								89.9%
							
						
							
								
								
									Makefile
								
								10.1%