Ngày tải lên: 06/11/2013, 03:11
Phương pháp giải các bài toán động lực học vật rắn khóa luận tốt nghiệp
Ngày tải lên: 27/09/2014, 00:13
Các bài toán đồng bộ
... mutex = 1; /* Semaphore for the number of waiting customers * This lets the barber go to sleep when there are no customers */ Semaphore customers = 0; /* Number of waiting customers in the barber ... 1; } /* Barber loops within this function */ void barber() { while( ) { /* Go to sleep if there are no customers */ wait( customers ); // protect access to shared variables with semaphore mutex ... variables with semaphore mutex wait( mutex ); /* take customer out of a chair */ waiting_customers -= 1; signal( mutex ); /* cut hair of the current customer */ cut_hair(); /* Let the customer go...
Ngày tải lên: 15/10/2012, 08:57