Dual-Core operation of Raspberry Pi Pico RP2040

The RP2040 processor of the Raspberry Pi Pico has dual ARM Cortex-M0+ cores that can be used in an Arduino-style sketch as follows:

/*
 * Test Rspberry Pi Pico dualcore mode
 *
 * Classical 'blink' example but split into two tasks, running on the two RP2040 cores:
 * - Core 0 sets the state of the LED
 * - Core 1 copies the state to the LED
 *
 */

unsigned char state;

/*
 * Setup for core 0
 */
void setup() {
  pinMode(LED_BUILTIN, OUTPUT);
}

/*
 * Setup for core 1
 */
void setup1() {

}

/*
 * Core 0 - set value of the user LED
 */
void loop() {
  state = HIGH;     // turn the LED on (HIGH is the voltage level)
  delay(1000);      // wait a second
  state = LOW;      // turn the LED off by making the voltage LOW
  delay(1000);      // wait a second
}

/*
 * Core 1 - copy to LED
 */
void loop1() {
  digitalWrite(LED_BUILTIN, state);
  delay(1);         // wait a millisecond
}

There are the setup routines setup() and setup1() as well as the looping routines loop() and loop1() for cores 0 and 1.
These routines are executed on the different cores and thus run asynchronously. Proper use of semaphores is necessary when data are exchanged between the loop threads.