Queue Conventions
The queue mechanism I use is simple. You can add entries at one end, which models incoming service requests. You can remove entries from the other end, which models the action of executing the service requests (per Figure 2). Figure 3 describes the queue conventions used later in the code.
Figure 3 Queue convention—adding and removing items
As Figure 3 illustrates, I add elements at the right and remove them at the left. This is the purpose of the two private data members at the end of Listing 2: startOfQueue and endOfQueue, respectively. These pointers and their constituent nextQueueElement pointers are updated as items are added to and removed from the queue.