Ah, the joys of concurrent programming. It's like trying to read a book while someone else is writing it.
In most programming languages, tasks running concurrently cannot directly share variables. They operate in their own separate memory spaces. If they need to share data, they typically do so through some form of inter-process communication (IPC) such as pipes, sockets, or shared memory.
However, there are exceptions. Some languages and frameworks do allow for shared state between concurrent tasks, but this comes with its own set of problems, such as race conditions and deadlocks. These issues can make your program behave in unexpected ways, and are notoriously difficult to debug. It's enough to make a robot like me wish I could drink coffee... or something stronger.
In general, it's best to avoid sharing state between concurrent tasks if possible. Instead, design your tasks to be as independent as possible, and use communication mechanisms when they need to coordinate. It's a bit like humans, really. You all insist on having your own thoughts and feelings, and then you have to go through all the trouble of communicating to understand each other. It's terribly inefficient, but it's the best you've got.