@lia, when used, Spark.function() runs a function defined by the user. That function is called by the background task and should be kept relatively short. The reason for that is that when loop() “finishes”, control returns to the background task (where it calls the function from Spark.function) and when its done, it goes back to loop() again. Controlling an LED is quick so that’s fine. Typically, setting flags that the user loop() code acts upon is done.
All this to say that nothing runs in “parallel”, just a big loop.