// # include
// # include
// Add DEFINES Here
// **** error codes ****//
# define NO_ERRORS
# define ERROR_OCCURED -1
# define RESUME_ERRORxFFFFFFFF
# define SUPPEND_ERRORxFFFFFFFFhThread1;// handle to the threadhThread2;// handle to the thread
// Add Function prototypes Here
// function prototype for periodic timer function (* nContext
);
// Interrupt handler prototype (* nContext
);
11. Результати роботи
(PRODUCER) want GIVE = 3 Fuel level will be FULL, wait = 20
(CONSUMER) TAKE = 1 Fuel level = 19
(PRODUCER) want GIVE = 3 Fuel level will be FULL, wait = 19
(CONSUMER) TAKE = 1 Fuel level = 18
(PRODUCER) want GIVE = 3 Fuel level will be FULL, wait = 18
(CONSUMER) TAKE = 1 Fuel level = 17
(PRODUCER) GIVE = 3 Fuel level is FULL = 20
(CONSUMER) TAKE = 1 Fuel level = 19
(PRODUCER) want GIVE = 3 Fuel level will be FULL, wait = 19
(CONSUMER) TAKE = 1 Fuel level = 18
(PRODUCER) want GIVE = 3 Fuel level will be FULL, wait = 18
(CONSUMER) TAKE = 1 Fuel level = 17
Лістинг. 13 Результат виконання
В
Рис. 1 Результат роботи
Список літератури
. The Little Book of SEMAPHORES, Allen B. Downey, 2009