How to abort a query while executing ?

I made an application which runs a complicated query which takes
minutes to complete. How can I abort it, and also, is there a
way to prevent it from grabbing the whole cpu time while executing,
in order to benefit of the multitasking ?