Java synchronized mechanism: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
(Created page with "=Internal= * synchronized statement * synchronized modifier =Overview=")
 
 
(4 intermediate revisions by the same user not shown)
Line 3: Line 3:
* [[Java Language#synchronized_statement|synchronized statement]]
* [[Java Language#synchronized_statement|synchronized statement]]
* [[Java Language#synchronized_modifier|synchronized modifier]]
* [[Java Language#synchronized_modifier|synchronized modifier]]
* [[Java#Subjects|Java]]


=Overview=
=Overview=
=Inefficiencies=
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.