harmony 鸿蒙Thread Model Overview (FA Model)

  • 2023-02-03
  • 浏览 (594)

Thread Model Overview (FA Model)

There are three types of threads in the FA model:

  • Main thread

Manages other threads.

  • Ability thread

    • One ability thread for each ability.
    • Distributes input events.
    • Draws the UI.
    • Invokes application code callbacks (event processing and lifecycle callbacks).
    • Receives messages sent by the worker thread.
  • Worker thread

Performs time-consuming operations.

Based on the OpenHarmony thread model, different services run on different threads. Service interaction requires inter-thread communication. Threads can communicate with each other in Emitter or Worker mode. Emitter is mainly used for event synchronization between threads, and Worker is mainly used to execute time-consuming tasks.

NOTE

The FA model provides an independent thread for each ability. Emitter is mainly used for event synchronization within the ability thread, between a pair of ability threads, or between the ability thread and worker thread.

你可能感兴趣的鸿蒙文章

harmony 鸿蒙Application Models

harmony 鸿蒙Using Explicit Want to Start an Application Component

harmony 鸿蒙Using Implicit Want to Open a Website

harmony 鸿蒙AbilityStage Component Container

harmony 鸿蒙Accessing a DataAbility

harmony 鸿蒙Accessing a DataShareExtensionAbility from the FA Model

harmony 鸿蒙AccessibilityExtensionAbility

harmony 鸿蒙Common action and entities Values

harmony 鸿蒙API Switching Overview

harmony 鸿蒙Switching of app and deviceConfig

0  赞