add tg_run for batch, improve throughput a bit by tweaking lock()