You need to prioritize orders in the market by some objective metric. You want a metric that rewards good behavior and punishes behaviors you don't want, for the market as a whole, not just any one participant.
Almost all markets now prioritize on price. An incoming sell order will interact with the highest priced bids first, and an incoming buy order will interact with the lowest priced offers first. Think that's common sense? In the pit days, markets were sometimes prioritized based on whether the guy was your cousin or if your dads were fishing buddies. Better price? Oops, didn't see you, pal.
But say 15 traders all want to buy at the best price. Who gets filled when a seller comes in with a market order? You could:
1. Prioritize equally: Give everyone bidding an equal piece. Fair's fair.
2. Prioritize by size: Bid more contracts at the price and get a bigger piece. You wanted it more than anyone else.
3. Prioritize by time: First to bid at the price gets filled first, then second, and so on.
Over years many ideas have been tried and nearly all markets worldwide have settled on 3 or some variant of it, why? Batching orders together as in 1 encourages people to split their interest into many small orders. It also discourages traders from sticking their neck out to make the best price first. Why bid alone when you can wait for others to bid with you? Likewise with 2, traders will try to game the system by placing very large orders and are rarely willing to improve prices.
So we end up with 3 which causes some speed jockeying in return for forcing traders to bid their true values right away to undercut on price, to everyone else's benefit. In return, they get rewarded with trading first.