{"id":739,"date":"2015-02-06T12:56:36","date_gmt":"2015-02-06T17:56:36","guid":{"rendered":"http:\/\/shirishranjit.com\/blog1\/?page_id=739"},"modified":"2015-03-20T07:13:58","modified_gmt":"2015-03-20T11:13:58","slug":"java-and-threads-how-they-work","status":"publish","type":"page","link":"https:\/\/shirishranjit.com\/blog1\/java-stuff\/java-and-threads-how-they-work","title":{"rendered":"Java and Threads &#8211; how they work"},"content":{"rendered":"<p>In multi-threading, it is really important to that we have a good handle on how memory is shared across thread, how different locks can be used to solve visibility problems, and plain old current modification issues.<\/p>\n<p>&nbsp;<\/p>\n<h2>References:<\/h2>\n<ul>\n<li><a title=\"http:\/\/www.javaworld.com\/article\/2074217\/java-concurrency\/java-101--understanding-java-threads--part-1--introducing-threads-and-runnables.html\" href=\"http:\/\/www.javaworld.com\/article\/2074217\/java-concurrency\/java-101--understanding-java-threads--part-1--introducing-threads-and-runnables.html\">http:\/\/www.javaworld.com\/article\/2074217\/java-concurrency\/java-101&#8211;understanding-java-threads&#8211;part-1&#8211;introducing-threads-and-runnables.html<\/a>\u00a0&#8211; an Articles on basics of how threads work in Java JVM.<\/li>\n<li>Read every article in the\u00a0<b>Understanding Java threads<\/b>\u00a0series (Jeff Friesen, JavaWorld.com, 2002):\n<ul>\n<li><a href=\"http:\/\/www.javaworld.com\/javaworld\/jw-05-2002\/jw-0503-java101.html?\">Part 1: Introducing threads and runnables<\/a><\/li>\n<li><a href=\"http:\/\/www.javaworld.com\/javaworld\/jw-06-2002\/jw-0607-java101.html?\">Part 2: Synchronization<\/a><\/li>\n<li><a href=\"http:\/\/www.javaworld.com\/javaworld\/jw-07-2002\/jw-0703-java101.html?\">Part 3: Thread scheduling, wait\/notify, and thread interruption<\/a><\/li>\n<li><a href=\"http:\/\/www.javaworld.com\/javaworld\/jw-08-2002\/jw-0802-java101.html?\">Part 4: Thread groups, volatility, thread-local variables, timers, and thread death<\/a><\/li>\n<\/ul>\n<\/li>\n<li>For a glossary specific to this article, homework, tips, and more, see the\u00a0<a href=\"http:\/\/www.javaworld.com\/javaworld\/jw-05-2002\/jw-0503-java101guide.html\">Java 101 study guide<\/a>\u00a0that accompanies this article.<\/li>\n<li>For more information about exceptions and the run() method, read &#8220;<a href=\"http:\/\/developer.java.sun.com\/developer\/JDCTechTips\/2001\/tt0109.html#handling\">Handling Uncaught Exceptions<\/a>&#8221; ( Glen McCluskey, Java Developer Connection, January 2001).<\/li>\n<li>The\u00a0<b>Programming Java Threads in the Real World<\/b>\u00a0series uses common programming scenarios to introduce readers to programming Java threads (Alan Holub, JavaWorld.com, 1998-2001):\n<ul>\n<li><a href=\"http:\/\/www.javaworld.com\/javaworld\/jw-09-1998\/jw-09-threads.html?\">Part 1: A Java programmer&#8217;s guide to threading architectures<\/a><\/li>\n<li><a href=\"http:\/\/www.javaworld.com\/javaworld\/jw-10-1998\/jw-10-toolbox.html?\">Part 2: The perils of race conditions, deadlock, and other threading problems<\/a><\/li>\n<li><a href=\"http:\/\/www.javaworld.com\/javaworld\/jw-11-1998\/jw-11-toolbox.html?\">Part 3: Roll-your-own mutexes and centralized lock management<\/a><\/li>\n<li><a href=\"http:\/\/www.javaworld.com\/javaworld\/jw-12-1998\/jw-12-toolbox.html?\">Part 4: Condition variables and counting semaphores\u2014filling in a few chinks in Java&#8217;s threading model<\/a>)<\/li>\n<li><a href=\"http:\/\/www.javaworld.com\/javaworld\/jw-02-1999\/jw-02-toolbox.html?\">Part 5: Has Sun abandoned run anywhere? PlusThreads and Swing, timers, and getting around stop(), suspend(), and resume() deprecation<\/a>)<\/li>\n<li><a href=\"http:\/\/www.javaworld.com\/javaworld\/jw-03-1999\/jw-03-toolbox.html?\">Part 6: The Observer pattern and mysteries of the AWTEventMulticaster<\/a><\/li>\n<li><a href=\"http:\/\/www.javaworld.com\/javaworld\/jw-04-1999\/jw-04-toolbox.html?\">Part 7: Singletons, critical sections, and reader\/writer locks<\/a><\/li>\n<li><a href=\"http:\/\/www.javaworld.com\/javaworld\/jw-05-1999\/jw-05-toolbox.html?\">Part 8: Threads in an object-oriented world, thread pools, implementing socket accept loops<\/a><\/li>\n<\/ul>\n<\/li>\n<li>Learn more about Java: See the complete listing for Jeff Friesen&#8217;s\u00a0<a href=\"http:\/\/www.javaworld.com\/columns\/jw-101-index.html\"><strong>Java 101<\/strong><\/a>\u00a0series &#8212; archived on JavaWorld.\n<ul>\n<li>Also see the\u00a0<a href=\"http:\/\/www.javaworld.com\/columns\/jw-tips-index.html\"><b>Java Tips<\/b><\/a>\u00a0series: More than five years of compiled tips from JavaWorld&#8217;s expert readers.<\/li>\n<\/ul>\n<\/li>\n<li><a title=\"http:\/\/www.domaigne.com\/blog\/computing\/mutex-and-memory-visibility\/\" href=\"http:\/\/www.domaigne.com\/blog\/computing\/mutex-and-memory-visibility\/\">Mutex and Memory Visibility<\/a><\/li>\n<li><a title=\"http:\/\/gee.cs.oswego.edu\/dl\/jmm\/cookbook.html\" href=\"http:\/\/gee.cs.oswego.edu\/dl\/jmm\/cookbook.html\">http:\/\/gee.cs.oswego.edu\/dl\/jmm\/cookbook.html<\/a>\u00a0&#8211; JSR-133 Cookbook &#8211; takes about threads and memory<\/li>\n<\/ul>\n<div class=\"twttr_buttons\"><div class=\"twttr_twitter\">\n\t\t\t\t\t<a href=\"http:\/\/twitter.com\/share?text=Java+and+Threads+-+how+they+work\" class=\"twitter-share-button\" data-via=\"\" data-hashtags=\"\"  data-size=\"default\" data-url=\"https:\/\/shirishranjit.com\/blog1\/java-stuff\/java-and-threads-how-they-work\"  data-related=\"\" target=\"_blank\">Tweet<\/a>\n\t\t\t\t<\/div><div class=\"twttr_followme\">\n\t\t\t\t\t\t<a href=\"https:\/\/twitter.com\/shiranjit\" class=\"twitter-follow-button\" data-size=\"default\"  data-show-screen-name=\"false\"  target=\"_blank\">Follow me<\/a>\n\t\t\t\t\t<\/div><\/div>","protected":false},"excerpt":{"rendered":"<p>In multi-threading, it is really important to that we have a good handle on how memory is shared across thread, how different locks can be used to solve visibility problems, and plain old current modification issues. &nbsp; References: http:\/\/www.javaworld.com\/article\/2074217\/java-concurrency\/java-101&#8211;understanding-java-threads&#8211;part-1&#8211;introducing-threads-and-runnables.html\u00a0&#8211; an &hellip; <a href=\"https:\/\/shirishranjit.com\/blog1\/java-stuff\/java-and-threads-how-they-work\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":524,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-739","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/shirishranjit.com\/blog1\/wp-json\/wp\/v2\/pages\/739"}],"collection":[{"href":"https:\/\/shirishranjit.com\/blog1\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/shirishranjit.com\/blog1\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/shirishranjit.com\/blog1\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/shirishranjit.com\/blog1\/wp-json\/wp\/v2\/comments?post=739"}],"version-history":[{"count":5,"href":"https:\/\/shirishranjit.com\/blog1\/wp-json\/wp\/v2\/pages\/739\/revisions"}],"predecessor-version":[{"id":850,"href":"https:\/\/shirishranjit.com\/blog1\/wp-json\/wp\/v2\/pages\/739\/revisions\/850"}],"up":[{"embeddable":true,"href":"https:\/\/shirishranjit.com\/blog1\/wp-json\/wp\/v2\/pages\/524"}],"wp:attachment":[{"href":"https:\/\/shirishranjit.com\/blog1\/wp-json\/wp\/v2\/media?parent=739"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}