Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question Only 4 threads used on android

Discussion in 'C# Job System' started by DevDunk, Jun 9, 2023.

  1. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    4,362
    When using a parralel for job on Android (tested on multiple snapdragon devices) the work is only scheduled under 4 worker threads, while there are more threads on the device.
    Is this intentional? The documentation does not state anything about this.

    If intentional, is there a way to change this?

    Maybe using thread configuration https://docs.unity3d.com/Manual/android-thread-configuration.html
     
  2. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    3,899
    How many actual threads are there? Are these virtual threads ("hyperthreading" of sorts)?

    Are these extra threads from one of those low-energy "we only do email" chips (which won't speed up anything gaming related)?
     
  3. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    4,362
    There should be 8 threads total (SD 865 and XR2).
    4 cores are indeed more efficiency cores. Wouldn't think they would decrease performance if they could be used for a few jobs
     
  4. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    3,899
    I'm only aware of the high level workings of the "efficiency + power" cores concept. I would expect these "efficiency" cores may not even be available for regular apps.

    In relation to each other, the "efficient" cores simply cannot keep up at all, combining them would reveal little performance benefit especially when multithreading. Consider that 100 jobs already finished may still be waiting on the 4 jobs running "efficiently" and slowing the entire process down, rather than speeding it up, as a consequence. These CPUs may also lock each other's memory regions, or require doubling memory usage and copying memory back (going through "efficient" aka low-bandwidth memory / channels even) after a job is done, or any other such technical side-effects that make it unacceptable to have them work in tandem.

    Trying to make them work together may even be prohibited on a technical level because the OS might keep only one of these chips active because it may be easier to manage for the OS.

    These are just assumptions but I wouldn't be surprised that this is how this tech works. It'll be far easier for the vendor to program the OS to be efficient enough to run on efficient cores (or only selectively push some tasks to power cores), whereas end-user apps can make use of all the power (and sometimes have to simply because they are not optimized / badly programmed).
     
    Yoreki and DevDunk like this.