有趣的Thread问题# Java - 爪哇娇娃
g*y
1 楼
想不到Mars计划就是因为这个BUG.
Importance of Understanding Scheduling
Consider a system which uses preemptive scheduling with the
following four threads:
MD runs infrequently for a short time with a low priority.
It writes to a shared memory buffer as follows:
lock buffer
write to buffer
unlock buffer
IB runs frequently for a short time at a high priority. It
removes items from the shared buffer as follows:
lock buffer
read from buffer
unlock buffer
CT runs at a medium priority, is long running and does no
Importance of Understanding Scheduling
Consider a system which uses preemptive scheduling with the
following four threads:
MD runs infrequently for a short time with a low priority.
It writes to a shared memory buffer as follows:
lock buffer
write to buffer
unlock buffer
IB runs frequently for a short time at a high priority. It
removes items from the shared buffer as follows:
lock buffer
read from buffer
unlock buffer
CT runs at a medium priority, is long running and does no