Situation to run tow tasks simultaneously

First, it depends a LOT on your definition of “Running”. As Richard Barry says, those tasks are running in the sense that they have been created, but they are blocked waiting for requests.

Push Buttons should, as he said, generate an interrupt and the ISR post an message to the button task.

For the web application, the system will need a server application to accept the https requests, waking up with each packet from the Internet, and that task can send a message to the button task, perhaps even the exact same message as the button ISR does. After all, does the controller care which button was pushed (real or on-line), it just wants to respond to them.

When nothing is happening, both those tasks are just blocked waiting for something.

Note, unless you have a multi-core processor, two tasks can’t ACTUALLY be running at the same time, one might be running and the other ready, and if they take long enough to do their job, they might gets switched back and forth between each other, looking like both are running.

1 Like