add some new functions,  including 1) calculate state value 2) update state value 3) allocate request; and 4) release request