Đồng bộ hóa tiến trình
Tiến trình ghi P: while (true) { while (counter==SIZE) ; buf[in] = nextItem; in = (in+1) % SIZE; counter++; } buf: Buffer SIZE: cỡ của buffer counter: Biến chung Tiến trình đọc Q: while (true) { while (counter==0) ; nextItem = buf[out]; out = (out+1) % SIZE; counter--; } Đây là bài toán vùng đệm có giới hạn