2018329621176_曹欣然_hw05 Version 0 |
|
👤 Author: by 439731491qqcom 2021-01-05 06:18:00 |
Assume that we run a greengrocery store, the storekeeper has 1kg apples when a new day comes, the comsumer wants to buy apples and know the total quantity of the storekeeper. One inconsistency happened that the storekeeper bought 1kg apples. At the same time the consumer bought 1kg apples from the storekeeper, and he thought the storekeeper has no apples without knowing the storekeeper has already bought 1kg apples once more. And the quatity of apples that the storekeeper has is different between the storekeeper and the consumer.
do
{
waiting(finish selling out);
//critcal section
signal(complete to purchase in);
//remainder section
}while(TRUE);
Please login to reply. Login