# Tso Allocation Process


![left](./student-guide/diagram/04-TSO-Get-Process-01-01.png)
------------------------------------------------------------
All the logic that TiDB interacts with PD is carried out through a thread module of the PD Client, which is specifically responsible for obtaining TSO from PD in batch. The general workflow is as follows:

- PD Client listening a channel. If there is a TSO request in this channel, it will start requesting TSO from the PD (if there are multiple request in this channel, this request will be batch), corresponding to figure 1, 2.

- Assign TSO from batch request to these request. Corresponding figures: 3, 4, 5, and 6. The above 2 can be expanded into the following 3 stages:

- PD puts a TSO request into this channel and asynchronously return a TSFuture object identified to the PD Client, which is a very fast process.

- The PD Client return this TSFuture object ID to the requester and obtains it with TSFUTrue when the PD sends a true TSO.

- The PD sends a real TSO to the PD Client, and the requester can get the TSO from the TSFuture object ID it holds. (Call TSFuture.wait ()) In summary, the allocation of the entire TSO is an asynchronous process.