Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Implement Fork/Join pattern #3227

Open
Open
@iluwatar

Description

@iluwatar

Description

The Fork/Join pattern is a concurrency design approach that splits (“forks”) a large task into multiple smaller subtasks, processes these subtasks in parallel, and then recombines (“joins”) their results. In Java, this pattern is embodied by theForkJoinPool andRecursiveTask /RecursiveAction classes within thejava.util.concurrent package. It’s particularly useful for CPU-intensive, divide-and-conquer problems where parallel processing can significantly reduce completion time.

Key Elements

  • Divide-and-Conquer: Recursively split tasks into smaller chunks until reaching a manageable size.
  • Parallel Processing: Distribute subtasks across a pool of worker threads (usually aForkJoinPool).
  • Work Stealing: Idle threads “steal” tasks from busy threads’ queues to optimize utilization.
  • RecursiveTask / RecursiveAction: Abstract classes for defining the task logic and splitting strategy (RecursiveTask returns a result,RecursiveAction does not).

References

  1. Java Documentation forForkJoinPool
  2. Java Concurrency in Practice – Brian Goetz
  3. Java Design Patterns – Contribution Guidelines

Acceptance Criteria

  • Create a new module or package namedfork-join (or similar).
  • Demonstrate splitting a computationally intensive task into subtasks usingRecursiveTask orRecursiveAction.
  • Show how the results are joined together for a final outcome.
  • Provide a README (or.md file) explaining the pattern with diagrams or code snippets.
  • Include tests verifying parallel execution and correctness of results.
  • Ensure all code meets the repository style, naming conventions, and passes CI checks.

Metadata

Metadata

Assignees

Projects

Status

In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp