packaged task demo
generalize to N threads