正在加载图片...
●●● ●●●● 6.1 Background ●●●●● ●●●● ●●0●● ●●●0 o Concurrent access to shared data may result in data inconsistency o A example: bounded buffer problem with shared data o Producer while(true)( produce an item in nextProduced * while(count== BUFFER SIZE); /do nothing buffer [in]= nextProduced; in=(in+1)% BUFFER SIZE count++.4 6.1 Background ⚫ Concurrent access to shared data may result in data inconsistency ⚫ A example: bounded buffer problem with shared data ⚫ Producer while (true) { /* produce an item in nextProduced */ while (count == BUFFER_SIZE); // do nothing buffer [in] = nextProduced; in = (in + 1) % BUFFER_SIZE; count++; }
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有