摘要: Starvation and LivelockStarvation and livelock are much less common a problem than deadlock, but are still problems that every designer of concurrent software is likely to encounter.StarvationStarvationdescribes a situation where a thread is unable to gain regular access to shared resources and is u 阅读全文
posted @ 2013-08-03 23:19 alexander.bruce.lee 阅读(1306) 评论(0) 推荐(0)
摘要: A concurrent application's ability to execute in a timely manner is known as itsliveness. This section describes the most common kind of liveness problem,deadlock, and goes on to briefly describe two other liveness problems,starvation and livelock.译文: 一个并发应用程序在时间上的执行的能力被称为活动性。这一节主要描述了活动性的问题,死锁,并 阅读全文
posted @ 2013-08-01 22:32 alexander.bruce.lee 阅读(381) 评论(0) 推荐(0)
摘要: Atomic AccessIn programming, anatomicaction is one that effectively happens all at once. An atomic action cannot stop in the middle: it either happens completely, or it doesn't happen at all. No side effects of an atomic action are visible until the action is complete.We have already seen that a 阅读全文
posted @ 2013-07-21 17:32 alexander.bruce.lee 阅读(771) 评论(0) 推荐(0)
摘要: Intrinsic Locks and SynchronizationSynchronization is built around an internal entity known as theintrinsic lockormonitor lock. (The API specification often refers to this entity simply as a "monitor.") Intrinsic locks play a role in both aspects of synchronization: enforcing exclusive acc 阅读全文
posted @ 2013-07-15 22:59 alexander.bruce.lee 阅读(353) 评论(0) 推荐(0)
摘要: Synchronized Methods The Java programming language provides two basic synchronization idioms: synchronized methods and synchronized statements. The more complex of the two, synchronized statements, are described in the next section. This section is about synchronized methods. To make a method sync.. 阅读全文
posted @ 2013-07-15 12:05 alexander.bruce.lee 阅读(663) 评论(0) 推荐(1)
摘要: Memory Consistency Errors Memory consistency errors occur when different threads have inconsistent views of what should be the same data. The causes of memory consistency errors are complex and beyond the scope of this tutorial. Fortunately, the programmer does not need a detailed understanding of . 阅读全文
posted @ 2013-07-14 21:09 alexander.bruce.lee 阅读(807) 评论(0) 推荐(0)
摘要: SynchronizationThreads communicate primarily by sharing access to fields and the objects reference fields refer to. This form of communication is extremely efficient, but makes two kinds of errors possible:thread interferenceandmemory consistency errors. The tool needed to prevent these errors issyn 阅读全文
posted @ 2013-07-11 11:19 alexander.bruce.lee 阅读(384) 评论(0) 推荐(0)
摘要: JoinsThejoinmethod allows one thread to wait for the completion of another. Iftis aThreadobject whose thread is currently executing,t.join();causes the current thread to pause execution untilt's thread terminates. Overloads ofjoinallow the programmer to specify a waiting period. However, as with 阅读全文
posted @ 2013-07-09 13:03 alexander.bruce.lee 阅读(779) 评论(0) 推荐(1)
摘要: InterruptsAninterruptis an indication to a thread that it should stop what it is doing and do something else. It's up to the programmer to decide exactly how a thread responds to an interrupt, but it is very common for the thread to terminate. This is the usage emphasized in this lesson.A thread 阅读全文
posted @ 2013-07-06 15:34 alexander.bruce.lee 阅读(700) 评论(0) 推荐(0)
摘要: Pausing Execution with SleepThread.sleepcauses the current thread to suspend execution for a specified period. This is an efficient means of making processor time available to the other threads of an application or other applications that might be running on a computer system. Thesleepmethod can als 阅读全文
posted @ 2013-06-28 20:57 alexander.bruce.lee 阅读(902) 评论(0) 推荐(0)