Is the operation below an atomic operation in a multitasking environment like RTX-51? If it is not, then what is supposed to do to make it an atomic one except using locking mechanisms?
void func() { int locVal = globalVal++; ... ... }
You cannot assume that any statement in C will result in an atomic operation.
That's not entirely true. C does provide __sigatomic_t in <signal.h> for exactly this purpose. There is a drawback though, in that interrupt handling is usually not mapped to the <signal.h> machinery.