Bureaucrats, cc_docs_admin, cc_staff
2,306
edits
No edit summary |
No edit summary |
||
Line 20: | Line 20: | ||
} | } | ||
}} | }} | ||
This second approach is generally the simplest to use but suffers from the drawback that Java does not permit multiple inheritance, so the class which implements multithreading | This second approach is generally the simplest to use but suffers from the drawback that Java does not permit multiple inheritance, so the class which implements multithreading is unable to subclass any other - potentially more useful - class. | ||
===MPI and Java=== | ===MPI and Java=== | ||
Line 33: | Line 33: | ||
===The <tt>volatile</tt> Keyword=== | ===The <tt>volatile</tt> Keyword=== | ||
This keyword has a sense very different from that | This keyword has a sense very different from that which C/C++ programmers are accustomed to. In Java <tt>volatile</tt> when applied to a variable has the effect of ensuring that its value is always read from and written to main memory, which can help to ensure that modifications of this variable are made visible to other threads. That said, there are contexts in which the use of the <tt>volatile</tt> keyword are not sufficient to avoid race conditions and the <tt>synchronized</tt> keyword is required to ensure program consistency. | ||
==Further Reading== | ==Further Reading== | ||
Scott Oaks and Henry Wong, ''Java Threads: Understanding and Mastering Concurrent Programming'' (3rd edition) (O'Reilly, 2012) | Scott Oaks and Henry Wong, ''Java Threads: Understanding and Mastering Concurrent Programming'' (3rd edition) (O'Reilly, 2012) |