Why is the word “join” is used for the Thread.join() method?
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:
- Thread.pauseCaller();
- Thread.freezeCaller();
- Thread.focusThread();
- 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
|
show 1 more comment
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:
- Thread.pauseCaller();
- Thread.freezeCaller();
- Thread.focusThread();
- 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
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 likeawait()
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, andstream.parallel()
may trigger fork operations.
– Andreas
Jan 1 at 22:34
|
show 1 more comment
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:
- Thread.pauseCaller();
- Thread.freezeCaller();
- Thread.focusThread();
- 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
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:
- Thread.pauseCaller();
- Thread.freezeCaller();
- Thread.focusThread();
- 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
java java-threads
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 likeawait()
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, andstream.parallel()
may trigger fork operations.
– Andreas
Jan 1 at 22:34
|
show 1 more comment
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 likeawait()
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, andstream.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
|
show 1 more comment
2 Answers
2
active
oldest
votes
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.
add a comment |
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.
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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.
add a comment |
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.
add a comment |
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.
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.
answered Jan 1 at 22:03


AndreasAndreas
78.4k464129
78.4k464129
add a comment |
add a comment |
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.
add a comment |
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.
add a comment |
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.
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.
edited Jan 1 at 22:18
answered Jan 1 at 22:05
jbxjbx
11.8k1060112
11.8k1060112
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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, andstream.parallel()
may trigger fork operations.– Andreas
Jan 1 at 22:34