My application has a toolbar and a lot of buttons on it. Some buttons start a long running processes(tasks). At this moment every task executes asynchronously to allow user to do something else while task is executing. Thereby I have a problem: user can click the same button many times to start others same tasks. I have decided to disable button before start task and enable it after finish. Other problem, I should to protect other buttons from pressing (some of these would be disabled after done current tasks). In general, I have to disable all buttons (toolbar) to be sure that user cannot do something dangerous with buttons at transient. My questions are: 

Could someone recommend way to distract users from flickering (disable/enable buttons) or how to involve them in process, how to made them filling that task is not so long?

Maybe I should to execute tasks synchronously and disable all UI for time of execution? 

By the way:
Delay can vary from 1 to 10 sec. About progress bar: it is a difficult to calculate current progress, and it causes some performance degradation (task can be done faster without any additional UI iterations from other threads).  


Question: How to remember a trusted machine using two factor authentication (like Google's system)
Answer: Don't think this can be done safely for an arbitrary client using only a standard web browser. As you say, cookies are not a safe choice to authorise a computer. Besides, cookies are set per browser, not per computer. You could try browser fingerprinting techniques, but again this is specific to the browser, not the computer. And keep in mind that HTTP requests, including User Agent strings, can be set arbitrarily by a malicious client.