Questions about sketch examples

Hello everyone,

I am trying to learn the codebase so according to dev guide I tried to run UART_test.cpp. I compiled-upload-run this successfully. Yet the following questions came up:

  1. If I understand correctly this is kind of similar with lua scripting in the sense that it is some logic (code block) that is executed periodically. Is that assumption correct? Is there a scheduler involved for that?
  2. Can I upload two different sketches? Or the second will overwrite the first?

Finally, I am trying also to develop a driver for a serial device. Would it be possible to write it entirely like a sketch example, or should I integrate it into the code?