Overview of Java Synchronization (Part 1)

preview_player
Показать описание
This video presents part 1 of my lesson on Java synchronization, which gives an overview of the topic and outlines the four main categories of synchronization mechanisms in Java.
Рекомендации по теме
Комментарии
Автор

Nice explanation Prof Doug. I had the impression that synchronizers(locks) are needed to maintain the invariants post method calls, but after watching your video came to know that locks are required to prevent other threads accessing the object so that they don't observe the object in inconsistent state.

SanjeevKumar-hjfb
Автор

0:44 synchronization does
0:46 help to ensure that interactions between computations don't corrupt shared data
0:58 interactions between threads and computations occur in the right order, at the right time, under right condition
1:20 important thing with respect to synchronization
1:24 ensure *mutual exclusion* in *critical section* to ensure key properties
1:31 property 1: atomic ordering - operations are going to occur all at once or not at all
3:10 if you are using primitive data types, you don't get atomicity out-of-the-box without synchronizers
3:30 property 2: avoid *race condition* with mutual exclusion
3:40 race condition occurs when a program depends on the sequence or timing of threads for it to operate properly
3:56 example of race condition - *read/write conflict*
4:02 If one thread reads while another thread writes concurrently, the field that is read may be inconsistent
5:03 another example of race condition - *write/write conflict*
5:54 reason why race condition can happen
6:02 in multi-processor system, esp. multi-core multi-processor systems, 6:07 to get the hardware work as efficiently as possible, the hardware and the memory management mechanisms typically use *weak memory ordering*
6:19 the way to think about this: 6:21 when you've got caches, then often times the way the caches are managed and flushed back to the main memory that they are caching, 6:31 it may end up with out-of-order operations for loads & stores (instruction) where it becomes non-deterministic what value you should get unless you use *synchronizers*
6:45 non-volatile: things that can be stored in cache memory
6:49 the visual flow of non-volatile from main memory to cache and eventually to thread (weak memory ordering)
8:56 coordination
9:07 in the right order
9:39 at the right time
10:05 under the right condition

17:49 categories of Java synchronization features and libraries
17:58 atomic operations
18:10 mutual exclusion
18:26 coordination
18:35 barrier synchronizer

ruixue
Автор

Is this a new mooc? Where can I find it?

SergeiMikhailov
Автор

don't corrupt shared data & occur in the right order, at the right time, & under the right conditions

americannumber