“This is the 15th day of my participation in the August More Text Challenge. For details, see: August More Text Challenge.”

Two thread design models

  • Core level thread design model:

    By the operating system kernel implementation, the characteristics are: fast Windows system is the use of this design model

    It can be likened to using your brain to control your ten fingers

  • User-level thread design model:

    The thread mode implemented outside the core of the operating system is characterized by: the speed of the thread scheduling outside the core is not as fast as the kernel Linux system is used this

    You can think of it as your ten fingers that need help to move

    Is there any real multithreading in Linux?

    From the thread design model adopted by Linux above, we can see that Linux system does not have a real sense of multithreading

    As a result, multithreading in Linux is not as powerful as in Windows

    Two thread libraries for the Linux system

    • LinuxThreads threading library
    • The RedHat NPTL

    The two thread libraries are not actually implemented in full thread mode

    The lifecycle of the process

    Process creation and reclamation

    In Android, the creation of ActivityThead signals the creation of a process

    The level of the process (from highest to lowest)

    • Foreground process: Has the highest priority and is in the Activity Resume() state. Killing foreground process requires a user response
    • Visible process
    • Service process
    • Background processes
    • Empty process: No component is started. It is used as the process cache. The recovery speed is fast

    When an application is started, its process level is not kept fixed. Android internal polling is performed by handlers to detect the state of the current process, and ActivityThread controls the Activity lifecycle. If no Activity exists on the stack, However, when a Service is present, the process level is reduced from foreground process to Service process

    If you want to query the level of the current process, you can do so with activityManager.RuningAppProcessInfo, which has variables and methods inside

    Process-level mnemonics

    Before seeing after empty

    Homophonic: quan Jian after empty (understand?)