About Question enthuware.ocpjp.v7.2.1257 :
Moderator: admin
-
- Posts: 6
- Joined: Sun Mar 13, 2016 1:34 am
- Contact:
About Question enthuware.ocpjp.v7.2.1257 :
Please explain the options in a more elaborate manner.
-
- Site Admin
- Posts: 10388
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v7.2.1257 :
Can you tell me explanation to which option is not clear so that we can explain better?
Also, which book are you following?
Paul.
Also, which book are you following?
Paul.
-
- Posts: 6
- Joined: Sun Mar 13, 2016 1:34 am
- Contact:
Re: About Question enthuware.ocpjp.v7.2.1257 :
Please elaborate the first option. I am following the K&B book.
-
- Site Admin
- Posts: 10388
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v7.2.1257 :
The first option is just a statement of a fact from the JavaDoc API description given here: https://docs.oracle.com/javase/8/docs/a ... JoinPool--
The thread factory is explained here: https://docs.oracle.com/javase/8/docs/a ... ctory.html
All this means is that instead of directly doing new Thread to create threads, the responsibility to create threads is passed on to a thread factory. The thread factory may internally create a new thread or supply a existing one based on its policy.
HTH,
Paul.
The thread factory is explained here: https://docs.oracle.com/javase/8/docs/a ... ctory.html
All this means is that instead of directly doing new Thread to create threads, the responsibility to create threads is passed on to a thread factory. The thread factory may internally create a new thread or supply a existing one based on its policy.
HTH,
Paul.
-
- Posts: 1
- Joined: Wed Jul 08, 2020 4:19 pm
- Contact:
Re: About Question enthuware.ocpjp.v7.2.1257 :
Pls can you explain fifth option ?
-
- Site Admin
- Posts: 10388
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v7.2.1257 :
The fifth option is, "The tasks submitted to a ForkJoinPool sit on the leaves of the task tree." This option was seen by our content author on their actual exam (long time back) and so we added it here.
To be honest, I am not exactly sure what was the thought process behind this option but here is what it seems to be referring to:
While using the fork/join framework, conceptually, a big task is split into multiple subtasks, which themselves may be split further into sub-subtasks and so on. This generates the "task tree". The last level of the tree (i.e. the leaf nodes) comprise of tasks that are computed (instead of splitting further).
Implementation wise, however, the actual task tree generated could be a little different because of work stealing approach where other threads may steal any node of task tree. So, it is possible that the smallest piece of a task may not be the leaf node of the tree. It depends on the implementation of the framework.
You may want to go through this article for a more detailed discussion on this: http://moi.vonos.net/java/forkjoin/
To be honest, I am not exactly sure what was the thought process behind this option but here is what it seems to be referring to:
While using the fork/join framework, conceptually, a big task is split into multiple subtasks, which themselves may be split further into sub-subtasks and so on. This generates the "task tree". The last level of the tree (i.e. the leaf nodes) comprise of tasks that are computed (instead of splitting further).
Implementation wise, however, the actual task tree generated could be a little different because of work stealing approach where other threads may steal any node of task tree. So, it is possible that the smallest piece of a task may not be the leaf node of the tree. It depends on the implementation of the framework.
You may want to go through this article for a more detailed discussion on this: http://moi.vonos.net/java/forkjoin/
Who is online
Users browsing this forum: No registered users and 8 guests