Multithread Concurrency Overview (TaskPool and Worker)

Overview

Concurrency models are used to implement concurrent tasks in different scenarios. Common concurrency models are classified into shared memory models and message passing models.

A typical message passing model is actor. It provides a relatively high degree of concurrency while eliminating a series of complex and occasional issues caused by locks.

Currently, ArkTS provides two concurrency capabilities: TaskPool and Worker, both of which are implemented based on the actor model.

Comparison Between the Actor and Memory Sharing Models provides an example of multithread concurrent programming based on the actor model.

TaskPool and Worker

For details about the operation mechanisms and precautions, see TaskPool Introduction and Worker Introduction. For details about their differences in implementation features and use cases, see Comparison Between TaskPool and Worker.