hi guys

You found your way to the bar, a sign of intelligence right there.

Here's a gold mine:
https://www.gammon.com.au/forum/bbshowpost.php?bbtopic_id=123

The tasking on Arduino links are below. The first one and the state machine from the second are what's really needed to run lightning fast cooperative tasking.