随笔分类 - 操作系统
摘要:1 # define N 5 2 # define LEFT (i + N - 1) % N 3 # define RIGHT (i + 1) % N 4 # define THINKING 0 5 # define HUNGRY 1 6 # define EATING 2 7 typedef in
阅读全文
摘要:1 typedef int semaphore; 2 semaphore count_mutex = 1; 3 semaphore data_mutex = 1; 4 int count = 0; 5 6 void reader(){ 7 while(TRUE){ 8 down(&count_mut
阅读全文
摘要:1 # define N 100 2 typedef int semaphore; 3 semaphore mutex = 1; 4 semaphore empty = N; 5 semaphore full = 0; 6 7 void produce(){ 8 while(TRUE){ 9 int
阅读全文

浙公网安备 33010602011771号