Multi threading to engine

TODO:
1. set CPU affinity
2. gflags? now thread num is hard coded.