ESP32 help understanding using both cores

Hi all!

I looking for some help in understanding how to use both cores of an ESP32. I've done some time researching the subject. I found that basically, the arduino environment code runs on core 1 and core 0 is open and used for RF stuff (assuming BT & WIFI operations). I also found several blink 2 leds example code where each core is assigned the task of blinking one led. So I played with one example and came up with this bit of code:

TaskHandle_t Task1;
TaskHandle_t Task2;

// LED pins
const int led1 = 2;
const int led2 = 4;

void setup() {
  Serial.begin(115200); 
  pinMode(led1, OUTPUT);
  pinMode(led2, OUTPUT);

  //create a task that will be executed in the Task1code() function, with priority 1 and executed on core 0
  xTaskCreatePinnedToCore(
                    Task1code,   /* Task function. */
                    "Task1",     /* name of task. */
                    10000,       /* Stack size of task */
                    NULL,        /* parameter of the task */
                    1,           /* priority of the task */
                    &Task1,      /* Task handle to keep track of created task */
                    0);          /* pin task to core 0 */                  
  delay(500); 

  //create a task that will be executed in the Task2code() function, with priority 1 and executed on core 1
  xTaskCreatePinnedToCore(
                    Task2code,   /* Task function. */
                    "Task2",     /* name of task. */
                    10000,       /* Stack size of task */
                    NULL,        /* parameter of the task */
                    1,           /* priority of the task */
                    &Task2,      /* Task handle to keep track of created task */
                    1);          /* pin task to core 1 */
    delay(500); 
}

//Task1code: blinks an LED every 1000 ms
void Task1code( void * pvParameters ){
  Serial.print("Task1 running on core ");
  Serial.println(xPortGetCoreID());

  for(;;){
    digitalWrite(led1, HIGH);
    printFunction(xPortGetCoreID(), HIGH);
    delay(1000);
    digitalWrite(led1, LOW);
    printFunction(xPortGetCoreID(), LOW);
    delay(1000);
  } 
}

//Task2code: blinks an LED every 700 ms
void Task2code( void * pvParameters ){
  Serial.print("Task2 running on core ");
  Serial.println(xPortGetCoreID());

  for(;;){
    digitalWrite(led2, HIGH);
    printFunction(xPortGetCoreID(), HIGH);
    delay(700);
    digitalWrite(led2, LOW);
    printFunction(xPortGetCoreID(), LOW);
    delay(700);
  }
}

void loop() {
  Serial.print("hi from loop(), running on core ");
  Serial.println(xPortGetCoreID());
  delay(1000);
  
}


void printFunction(int core, bool state)
{
  Serial.print("core - "); Serial.print(core); Serial.print("   state - "); Serial.println(state);
  
}

Which is pretty much that standard 'blink 2 leds' example code, but I added a few things (like the void printFunction() ) so I could understand what is happening. I also added code in the void loop() to print data to serial monitor. Now each core is blinking an led and the loop() code is also running on core 1. How is that I have 2 different code running on core 1? Is this the work of FreeRTOS that is handling running 2 sets of code on the same core?

Also looking for advice on this:

  //create a task that will be executed in the Task2code() function, with priority 1 and executed on core 1
  xTaskCreatePinnedToCore(
                    Task2code,   /* Task function. */
                    "Task2",     /* name of task. */
                    10000,       /* Stack size of task */
                    NULL,        /* parameter of the task */
                    1,           /* priority of the task */
                    &Task2,      /* Task handle to keep track of created task */
                    1);          /* pin task to core 1 */

Specifically I am wondering how one figures out the 'Stack size of task', and what the 'parameter of the task' is?

If anyone could point where to read up of this stuff, I would be really thankful!

Randy