ForkJoinPool - Work stealing


Reference

前篇: Java Concurrency - ForkJoinPool 的 deadlock
下篇: ForkJoinPool - Error Handling

Introduction

ForkJoinPool 實作 work stealing 的概念, 簡單說明一下

Work-stealing

  1. 每個 thread 會有一個 queue, queue 裡面放的是 CPU bound 的工作
  2. queue 裡面的工作可能會產生新的能平行作業的工作
  3. 新產生的工作會放在 queue 裡面
  4. 如果有 thread 把 queue 裡面的工作做完了, 就會去別的 queue 拿工作來處理 (steal)

沒有留言:

張貼留言

Lessons Learned While Using Claude Code Skills

Recently, I started experimenting with Claude Code Skills . I first saw this YouTube video: https://www.youtube.com/watch?v=CEvIs9y1uog ...