Java synchronized mechanism: Difference between revisions
Jump to navigation
Jump to search
Line 9: | Line 9: | ||
=Inefficiencies= | =Inefficiencies= | ||
Code written using the <tt>syncrhonized</tt> mechanism is expensive on multicore CPU systems. The [[Java_8_Streams_API|Streams API]], introduced in Java 8, removes the need of explicitly using <tt>syncrhonized</tt>. | Code written using the <tt>syncrhonized</tt> mechanism is expensive on multicore CPU systems, because synchronization forces code to execute sequentially, which works against the goal of [[Parallelism#Overview|parallelism]]. The [[Java_8_Streams_API|Streams API]], introduced in Java 8, removes the need of explicitly using <tt>syncrhonized</tt>. |
Latest revision as of 18:49, 22 March 2018
Internal
Overview
Inefficiencies
Code written using the syncrhonized mechanism is expensive on multicore CPU systems, because synchronization forces code to execute sequentially, which works against the goal of parallelism. The Streams API, introduced in Java 8, removes the need of explicitly using syncrhonized.