Implementing Control Commands for an MCU over Serial
There are many ways to implement a communication protocol. For example you may choose to use:


human readable format or binary
error checking such as a checksum or CRC
start and/or end message characters
message length, number etc payload information
acknowledge / negative acknowledge / retry mechanisms


Your example command is human readable and should use '\n' (enter) as the end of message character. Start / end of message characters make it easier to parse the input stream.

A typical program flow would be to wait for the start character to be received, then store subsequent bytes into a message buffer until the end character is received. Once that happens pass the buffer to another function to parse the message. If no start character, just start storing bytes immediately until the end character is received.

Most* embedded systems run in an infinite loop. Handling of serial transmit and receive is done via interrupts on the Arduino (see HardwareSerial.cpp). Received characters are placed into a buffer. On every iteration of the loop you check to see if there are any characters in the buffer (Serial.available()) and process them. By receiving characters using interrupts no characters should be missed. You don't do all the processing in these interrupt routines though, else they become too long and therefore miss subsequent interrupts.

If you don't want your device to sit idle looping, put it into a sleep state to 'pause' the loop until an interrupt or other event.

I really like this library for human readable messaging:  http://playground.arduino.cc/Code/Messenger

* I can't think of a system which doesn't but perhaps there is one out there.