At times when I ask my son to stop doing something immediately he does not stop. Should I beat him in that case? I know the answer might be no but I need an alternative in which he listens and stops doing when I tell him to.
A mistake a lot of parents make is saying "Stop that. I said stop that. Stop that at once. If you don't stop that we're going home now. Stop it. I said stop that ...." on and on infinitum without actually doing anything. As far as the child is concerned its just meaningless background noise. Does this sound familiar?
If so, then you are right in thinking that you have to do something to break this cycle and get your son's attention, but violence is not the right thing.
Step 1: Take whatever it is away from him, get down to his level (at 6 this is probably going to mean kneeling or sitting), take hold of him by the shoulders and make him look at you. Keep telling him to look at you until he does so.
Step 2: Tell him that what he is doing is wrong/dangerous/unacceptable/rude. Get him to acknowledge this, for instance saying "Do you understand that?" until he says "yes".
Step 3: Tell him that if he doesn't stop immediately then you will take some action. Make it a credible action you are prepared to take immediately, because you MUST follow through with it. It might just be 5 minutes on the naughty step, it might be going home right away, but it has to be now because future threats (bed with no tea or something) are too far away.
Beating a child merely teaches him that violence is how to get your way. Its also illegal in a lot of places. Don't go there.
However you choose to deal with the issue, your actions are a means of communicating with your child. Do you want him to fear you? Then beat him. Do you want him to follow you out of ignorance? Then demand he obey "or else".
If, on the other hand, you want a critically-thinking adult who can make up his own mind, then don't fear educating him. If you are wanting him to immediately stop something, then set the background for him. For example, with my daughter, I told her that she was always free to question what I told her to do except if I said, "that's an order." If I said that, she was to do it immediately without question, but she could ask me for an explanation later.
This was good since I believe that if I don't have a reason, then I shouldn't be ordering her anyway.
Ten years after being the age of your son, my daughter follows the same principles. On some occasions which were not emergencies, her thinking was correct, so I gave in -- we can all be wrong after all.
The underlying principle is that if someone is willing to accept the consequences for their actions, then there is really nothing that can be done. We can, however, preempt that by teaching critical thinking from the earliest of days so that the conclusion they reach is as good (if not better!) than our own.
Then our child can grow into an adult we can be proud of: they do not fear the unknown, do not run from the unknown, and have no need to fear negative consequences for doing what they think to be right -- they are independent.
I've found that distraction and redirection works most of the time. For example, would you like a snack, would you like to go for a walk, would you like... You might try wedding that with a statement such as, You cannot do that. (Of course, beating is not a tenable approach in this day and age. Beyond that, the child will quickly learn that you do not use physical methods in public and will use that knowledge.)