get current pid more efficiently.