• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Concurrency Overview
2
3Concurrency refers to the capability of processing multiple tasks in the same period. To improve the response speed and frame rate of applications and prevent time-consuming tasks from blocking the main thread, OpenHarmony provides two policies: asynchronous concurrency and multithread concurrency.
4
5- Asynchronous concurrency means that an action in asynchronous code is suspended and will continue later. Only one segment of code is being executed at a time.
6
7- Multithread concurrency allows multiple segments of code to be executed at a time. When the main thread continues to respond to user operations and update the UI, time-consuming operations are performed in the background to avoid application freezing.
8
9Concurrency is used in a variety of scenarios, including a [single I/O task](single-io-development.md), [CPU intensive task](cpu-intensive-task-development.md), [I/O intensive task](io-intensive-task-development.md), [synchronous task](sync-task-development.md), and the like. You can select a concurrency policy based on your scenario.
10
11ArkTS provides the following mechanisms to support asynchronous concurrency and multithread concurrency:
12
13- Promise and async/await: provide asynchronous concurrency and apply to the development of a single I/O task. For details, see [Asynchronous Concurrency Overview](async-concurrency-overview.md).
14
15- **TaskPool** and **Worker**: provide multithread concurrency and apply to the development of CPU intensive tasks, I/O intensive tasks, and synchronous tasks. For details, see [Multithread Concurrency Overview](multi-thread-concurrency-overview.md).
16