Why is the word “join” is used for the Thread.join() method?












-4















I started to do research to find out why the word "join" is used for the Thread.join() method. In fact, it waits for the thread to end on which it is called and pauses the main thread to wait for it so, there is nothing to join. So, its name should be something like:




  1. Thread.pauseCaller();

  2. Thread.freezeCaller();

  3. Thread.focusThread();

  4. Thread.runBefore();


I found one simple sentence after too much research which says that:




Thread.join(); name comes from the concept of the calling thread waiting until the specified thread joins it.




I am totally unable to get this above sentence into my mind and failed to understand the background context of using the word join for this method. What does the word "join" represent in this context? There is nothing to join anything else; instead, it just pauses the calling thread to wait for the thread followed by the join(). So, can anyone tell the context of using the join word for this method?










share|improve this question




















  • 1





    "it completes the thread on which it is called" No it doesn't. It doesn't in any way affect the thread on which it is called. It simply waits for the thread to end. Which is what the javadoc says too: Waits for this thread to die.

    – Andreas
    Jan 1 at 21:59













  • I agree that it's not an intuitive name. It's a good question why it has this strange name (there is a reason, but if you don't know it it's not obvious). I don't think your proposed names get the concept right, though. Something like await() would be more natural.

    – John Kugelman
    Jan 1 at 22:02








  • 2





    The heavy downvoting is a disappointing. We shouldn't be penalizing the OP for being confused. It's better to explain the question's misconceptions in answers than to downvote it because he doesn't quite understand what joining does. If the method were named better perhaps he wouldn't be so confused. After all, it's a name that comes from UNIX. Java doesn't actually have "forking". Really, "join" isn't all that great a name now is it?

    – John Kugelman
    Jan 1 at 22:12








  • 1





    @JohnKugelman: agreed, beginner questions are ok and the history of a name may be important to understanding its meaning.

    – James K Polk
    Jan 1 at 22:13











  • @JohnKugelman Sure, Java has forking. I'm referring to the original definition from the Fork–Join model, which pre-dates the Unix implementation of forking processes. Forking is a concept, e.g. thread.start() is a fork operation, and stream.parallel() may trigger fork operations.

    – Andreas
    Jan 1 at 22:34
















-4















I started to do research to find out why the word "join" is used for the Thread.join() method. In fact, it waits for the thread to end on which it is called and pauses the main thread to wait for it so, there is nothing to join. So, its name should be something like:




  1. Thread.pauseCaller();

  2. Thread.freezeCaller();

  3. Thread.focusThread();

  4. Thread.runBefore();


I found one simple sentence after too much research which says that:




Thread.join(); name comes from the concept of the calling thread waiting until the specified thread joins it.




I am totally unable to get this above sentence into my mind and failed to understand the background context of using the word join for this method. What does the word "join" represent in this context? There is nothing to join anything else; instead, it just pauses the calling thread to wait for the thread followed by the join(). So, can anyone tell the context of using the join word for this method?










share|improve this question




















  • 1





    "it completes the thread on which it is called" No it doesn't. It doesn't in any way affect the thread on which it is called. It simply waits for the thread to end. Which is what the javadoc says too: Waits for this thread to die.

    – Andreas
    Jan 1 at 21:59













  • I agree that it's not an intuitive name. It's a good question why it has this strange name (there is a reason, but if you don't know it it's not obvious). I don't think your proposed names get the concept right, though. Something like await() would be more natural.

    – John Kugelman
    Jan 1 at 22:02








  • 2





    The heavy downvoting is a disappointing. We shouldn't be penalizing the OP for being confused. It's better to explain the question's misconceptions in answers than to downvote it because he doesn't quite understand what joining does. If the method were named better perhaps he wouldn't be so confused. After all, it's a name that comes from UNIX. Java doesn't actually have "forking". Really, "join" isn't all that great a name now is it?

    – John Kugelman
    Jan 1 at 22:12








  • 1





    @JohnKugelman: agreed, beginner questions are ok and the history of a name may be important to understanding its meaning.

    – James K Polk
    Jan 1 at 22:13











  • @JohnKugelman Sure, Java has forking. I'm referring to the original definition from the Fork–Join model, which pre-dates the Unix implementation of forking processes. Forking is a concept, e.g. thread.start() is a fork operation, and stream.parallel() may trigger fork operations.

    – Andreas
    Jan 1 at 22:34














-4












-4








-4


0






I started to do research to find out why the word "join" is used for the Thread.join() method. In fact, it waits for the thread to end on which it is called and pauses the main thread to wait for it so, there is nothing to join. So, its name should be something like:




  1. Thread.pauseCaller();

  2. Thread.freezeCaller();

  3. Thread.focusThread();

  4. Thread.runBefore();


I found one simple sentence after too much research which says that:




Thread.join(); name comes from the concept of the calling thread waiting until the specified thread joins it.




I am totally unable to get this above sentence into my mind and failed to understand the background context of using the word join for this method. What does the word "join" represent in this context? There is nothing to join anything else; instead, it just pauses the calling thread to wait for the thread followed by the join(). So, can anyone tell the context of using the join word for this method?










share|improve this question
















I started to do research to find out why the word "join" is used for the Thread.join() method. In fact, it waits for the thread to end on which it is called and pauses the main thread to wait for it so, there is nothing to join. So, its name should be something like:




  1. Thread.pauseCaller();

  2. Thread.freezeCaller();

  3. Thread.focusThread();

  4. Thread.runBefore();


I found one simple sentence after too much research which says that:




Thread.join(); name comes from the concept of the calling thread waiting until the specified thread joins it.




I am totally unable to get this above sentence into my mind and failed to understand the background context of using the word join for this method. What does the word "join" represent in this context? There is nothing to join anything else; instead, it just pauses the calling thread to wait for the thread followed by the join(). So, can anyone tell the context of using the join word for this method?







java java-threads






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 1 at 22:04







Daddy Boy

















asked Jan 1 at 21:53









Daddy BoyDaddy Boy

145




145








  • 1





    "it completes the thread on which it is called" No it doesn't. It doesn't in any way affect the thread on which it is called. It simply waits for the thread to end. Which is what the javadoc says too: Waits for this thread to die.

    – Andreas
    Jan 1 at 21:59













  • I agree that it's not an intuitive name. It's a good question why it has this strange name (there is a reason, but if you don't know it it's not obvious). I don't think your proposed names get the concept right, though. Something like await() would be more natural.

    – John Kugelman
    Jan 1 at 22:02








  • 2





    The heavy downvoting is a disappointing. We shouldn't be penalizing the OP for being confused. It's better to explain the question's misconceptions in answers than to downvote it because he doesn't quite understand what joining does. If the method were named better perhaps he wouldn't be so confused. After all, it's a name that comes from UNIX. Java doesn't actually have "forking". Really, "join" isn't all that great a name now is it?

    – John Kugelman
    Jan 1 at 22:12








  • 1





    @JohnKugelman: agreed, beginner questions are ok and the history of a name may be important to understanding its meaning.

    – James K Polk
    Jan 1 at 22:13











  • @JohnKugelman Sure, Java has forking. I'm referring to the original definition from the Fork–Join model, which pre-dates the Unix implementation of forking processes. Forking is a concept, e.g. thread.start() is a fork operation, and stream.parallel() may trigger fork operations.

    – Andreas
    Jan 1 at 22:34














  • 1





    "it completes the thread on which it is called" No it doesn't. It doesn't in any way affect the thread on which it is called. It simply waits for the thread to end. Which is what the javadoc says too: Waits for this thread to die.

    – Andreas
    Jan 1 at 21:59













  • I agree that it's not an intuitive name. It's a good question why it has this strange name (there is a reason, but if you don't know it it's not obvious). I don't think your proposed names get the concept right, though. Something like await() would be more natural.

    – John Kugelman
    Jan 1 at 22:02








  • 2





    The heavy downvoting is a disappointing. We shouldn't be penalizing the OP for being confused. It's better to explain the question's misconceptions in answers than to downvote it because he doesn't quite understand what joining does. If the method were named better perhaps he wouldn't be so confused. After all, it's a name that comes from UNIX. Java doesn't actually have "forking". Really, "join" isn't all that great a name now is it?

    – John Kugelman
    Jan 1 at 22:12








  • 1





    @JohnKugelman: agreed, beginner questions are ok and the history of a name may be important to understanding its meaning.

    – James K Polk
    Jan 1 at 22:13











  • @JohnKugelman Sure, Java has forking. I'm referring to the original definition from the Fork–Join model, which pre-dates the Unix implementation of forking processes. Forking is a concept, e.g. thread.start() is a fork operation, and stream.parallel() may trigger fork operations.

    – Andreas
    Jan 1 at 22:34








1




1





"it completes the thread on which it is called" No it doesn't. It doesn't in any way affect the thread on which it is called. It simply waits for the thread to end. Which is what the javadoc says too: Waits for this thread to die.

– Andreas
Jan 1 at 21:59







"it completes the thread on which it is called" No it doesn't. It doesn't in any way affect the thread on which it is called. It simply waits for the thread to end. Which is what the javadoc says too: Waits for this thread to die.

– Andreas
Jan 1 at 21:59















I agree that it's not an intuitive name. It's a good question why it has this strange name (there is a reason, but if you don't know it it's not obvious). I don't think your proposed names get the concept right, though. Something like await() would be more natural.

– John Kugelman
Jan 1 at 22:02







I agree that it's not an intuitive name. It's a good question why it has this strange name (there is a reason, but if you don't know it it's not obvious). I don't think your proposed names get the concept right, though. Something like await() would be more natural.

– John Kugelman
Jan 1 at 22:02






2




2





The heavy downvoting is a disappointing. We shouldn't be penalizing the OP for being confused. It's better to explain the question's misconceptions in answers than to downvote it because he doesn't quite understand what joining does. If the method were named better perhaps he wouldn't be so confused. After all, it's a name that comes from UNIX. Java doesn't actually have "forking". Really, "join" isn't all that great a name now is it?

– John Kugelman
Jan 1 at 22:12







The heavy downvoting is a disappointing. We shouldn't be penalizing the OP for being confused. It's better to explain the question's misconceptions in answers than to downvote it because he doesn't quite understand what joining does. If the method were named better perhaps he wouldn't be so confused. After all, it's a name that comes from UNIX. Java doesn't actually have "forking". Really, "join" isn't all that great a name now is it?

– John Kugelman
Jan 1 at 22:12






1




1





@JohnKugelman: agreed, beginner questions are ok and the history of a name may be important to understanding its meaning.

– James K Polk
Jan 1 at 22:13





@JohnKugelman: agreed, beginner questions are ok and the history of a name may be important to understanding its meaning.

– James K Polk
Jan 1 at 22:13













@JohnKugelman Sure, Java has forking. I'm referring to the original definition from the Fork–Join model, which pre-dates the Unix implementation of forking processes. Forking is a concept, e.g. thread.start() is a fork operation, and stream.parallel() may trigger fork operations.

– Andreas
Jan 1 at 22:34





@JohnKugelman Sure, Java has forking. I'm referring to the original definition from the Fork–Join model, which pre-dates the Unix implementation of forking processes. Forking is a concept, e.g. thread.start() is a fork operation, and stream.parallel() may trigger fork operations.

– Andreas
Jan 1 at 22:34












2 Answers
2






active

oldest

votes


















7














The word "join" comes from the Fork–Join model, where "fork" means the split the thread into multiple threads for parallel processing, and "join" means to wait for the parallel threads to complete their part, before continuing in a single thread.






share|improve this answer































    3














    Join is a common term used in models of concurrency, which implies that two separate independently running threads are synchronising with each other and one thread will not proceed until the other reaches a specific join point. So 2 threads are joining back together into one. In Java, this is usually when the other Thread finishes its task.



    Note that this might not be exactly the same in models where the tasks are backed by reusable worker threads, such as when using an ExecutorService to wait for a result, and using CompletableFuture.join() to block until the result is available. In this case the joining is more related to the task executed in parallel than the actual underlying worker thread which might be reused for other tasks afterwards.



    The name itself comes from the fork-join model for parallelizing tasks and collecting their results.






    share|improve this answer

























      Your Answer






      StackExchange.ifUsing("editor", function () {
      StackExchange.using("externalEditor", function () {
      StackExchange.using("snippets", function () {
      StackExchange.snippets.init();
      });
      });
      }, "code-snippets");

      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "1"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53999241%2fwhy-is-the-word-join-is-used-for-the-thread-join-method%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      7














      The word "join" comes from the Fork–Join model, where "fork" means the split the thread into multiple threads for parallel processing, and "join" means to wait for the parallel threads to complete their part, before continuing in a single thread.






      share|improve this answer




























        7














        The word "join" comes from the Fork–Join model, where "fork" means the split the thread into multiple threads for parallel processing, and "join" means to wait for the parallel threads to complete their part, before continuing in a single thread.






        share|improve this answer


























          7












          7








          7







          The word "join" comes from the Fork–Join model, where "fork" means the split the thread into multiple threads for parallel processing, and "join" means to wait for the parallel threads to complete their part, before continuing in a single thread.






          share|improve this answer













          The word "join" comes from the Fork–Join model, where "fork" means the split the thread into multiple threads for parallel processing, and "join" means to wait for the parallel threads to complete their part, before continuing in a single thread.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jan 1 at 22:03









          AndreasAndreas

          78.4k464129




          78.4k464129

























              3














              Join is a common term used in models of concurrency, which implies that two separate independently running threads are synchronising with each other and one thread will not proceed until the other reaches a specific join point. So 2 threads are joining back together into one. In Java, this is usually when the other Thread finishes its task.



              Note that this might not be exactly the same in models where the tasks are backed by reusable worker threads, such as when using an ExecutorService to wait for a result, and using CompletableFuture.join() to block until the result is available. In this case the joining is more related to the task executed in parallel than the actual underlying worker thread which might be reused for other tasks afterwards.



              The name itself comes from the fork-join model for parallelizing tasks and collecting their results.






              share|improve this answer






























                3














                Join is a common term used in models of concurrency, which implies that two separate independently running threads are synchronising with each other and one thread will not proceed until the other reaches a specific join point. So 2 threads are joining back together into one. In Java, this is usually when the other Thread finishes its task.



                Note that this might not be exactly the same in models where the tasks are backed by reusable worker threads, such as when using an ExecutorService to wait for a result, and using CompletableFuture.join() to block until the result is available. In this case the joining is more related to the task executed in parallel than the actual underlying worker thread which might be reused for other tasks afterwards.



                The name itself comes from the fork-join model for parallelizing tasks and collecting their results.






                share|improve this answer




























                  3












                  3








                  3







                  Join is a common term used in models of concurrency, which implies that two separate independently running threads are synchronising with each other and one thread will not proceed until the other reaches a specific join point. So 2 threads are joining back together into one. In Java, this is usually when the other Thread finishes its task.



                  Note that this might not be exactly the same in models where the tasks are backed by reusable worker threads, such as when using an ExecutorService to wait for a result, and using CompletableFuture.join() to block until the result is available. In this case the joining is more related to the task executed in parallel than the actual underlying worker thread which might be reused for other tasks afterwards.



                  The name itself comes from the fork-join model for parallelizing tasks and collecting their results.






                  share|improve this answer















                  Join is a common term used in models of concurrency, which implies that two separate independently running threads are synchronising with each other and one thread will not proceed until the other reaches a specific join point. So 2 threads are joining back together into one. In Java, this is usually when the other Thread finishes its task.



                  Note that this might not be exactly the same in models where the tasks are backed by reusable worker threads, such as when using an ExecutorService to wait for a result, and using CompletableFuture.join() to block until the result is available. In this case the joining is more related to the task executed in parallel than the actual underlying worker thread which might be reused for other tasks afterwards.



                  The name itself comes from the fork-join model for parallelizing tasks and collecting their results.







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Jan 1 at 22:18

























                  answered Jan 1 at 22:05









                  jbxjbx

                  11.8k1060112




                  11.8k1060112






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Stack Overflow!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53999241%2fwhy-is-the-word-join-is-used-for-the-thread-join-method%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      MongoDB - Not Authorized To Execute Command

                      How to fix TextFormField cause rebuild widget in Flutter

                      in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith