ECS and job system, what is actually possible and how it works in detail?,How ECS and job system actually work? Internals & possibilities & limitations

I’m looking for some materials that would actually explain how I can utilize job systems with ECS, as every page just states that “jobs are multithreaded and safe” with no real information about how it works, why it is thread safe and limitations of it.

Ad I would want to know how I can integrate ECS with job system, can you create systems that works as a job? so multiple system can operate on components from multiple threads? If so, how is thread safety guaranteed or what needs to be done to make it safe? And if not, then how jobs can be used in typical game with ECS. Or maybe jobs are only useful for longer and more advanced operations, like transforming some data in the background and then using the result in main thread again? - so useless for typical systems.

Would be great to also read more about internals of ECS/job system, to know how actually such data is stored in memory etc.,I’m reading about ECS & jobs and after countless articles I still did not find more information than: It is safe and multithreaded because we say so. Without even explanation what can be processed in other threads etc.

So my question is how ECS and job system can work together and what are the limitations, in perfect system I would imagine that I only need to create few systems that operate on selected components and each system can run in different thread as long as they modify different components.
Is anything like that possible with ECS & Jobs? If yes - how it works, how unity know what can be running next to each other and what not. If not - then what exactly is possible, can I use jobs to modify components from another thread, or this is still limited to main one? And if I can modify them, then how thread safety is guaranteed (or not)?

I’m just looking for something that would explain both systems in detail, not just “it’s better and works”.

Hello @GotoFinal, yes you can use ECS + Job System in Unity. ECS helps you to optimize how the CPU can quickly access data from the memory because the GameObjects are converted into an entity, these entities are well structured and organized in your computer’s memory and the Job system takes an advantage of parallel processing by the use of multiple cores of your processors hence it boost your game performance by a greater percentage.

Here is a sample code of how ECS and Job System works.

[GenerateAuthoringComponent] 
struct Velocity : IComponentData
{
  public float4 value; 
}

class ApplyVelocitySystem : JobComponentSystem
{
    

     protected override JobHandle OnUpdate(JobHandle inputDeps)
     {
       float detltatime = Time.deltaTime;
       return entities.ForEach((ref Translation translation, in Velocity velocity ) =>
       {
           translation.value+=velocity.value*Time.deltaTime;
       }).Shedule(inputDeps)

    }

}