Overview of Multithreaded Development

In ArkTS application development, different service scenarios require different concurrency capabilities and task types.

There are three types of concurrent tasks in common service scenarios:

Time-consuming tasks: These involve significant computation or multiple I/O operations and take a long time to execute.

Continuous tasks: These include tasks like listening or periodically collecting data that need to run continuously over extended periods.

Resident tasks: These are bound to the lifecycle of the main thread or closely integrated with it.

Different task types can be further classified. For example, time-consuming tasks can be CPU intensive, I/O intensive, or synchronous, each corresponding to different service scenarios. TaskPool and Worker both support multithreaded concurrency. You can select the concurrency capability as required. For details, see Use Case Comparison.

The following sections will list common scenarios and examples in multithreaded development.