How does a 3D printer software/firmware work
You appear to be asking about rate-limiting the stream of G-code provided by the computer, but some more context in your question will help if this is not the case.

Printers tend to work in two ways.


Read G-code from local storage as a text file. Here, the parser/control engine is in full control.
Stream G-code over a serial port using an 'ack' handshake.


The reference for G-code used in 3D printing is the RepRap Wiki. Here you will find responses such as ok resend and fatal, these indicate when a previous command is processed and something else can be sent, if the previous message was identified as corrupt, or if recovery is impossible.

The basic rule for this style of handshake is that after every host to slave transaction, the host must wait for some response before sending another transaction. The slave could send either ACK responses, or other asynchronous transactions if you can design the system to avoid or not care about overrun in the slave to host direction.

When designing a handshake like this, you can consider all possible ways for something to go wrong (assume the interface is imperfect). How can you handle a request being missed and no ACK ever? When there is a timeout, can you make a 'benign' request to see if the printer is still connected, etc.