Does a sortedMap handle multiple simultaneous SetAsync() or UpDateAsync() requests at once, or with a queue?

If multiple requests to set data in the same sorted map are done at once, does the sorted map handle them all at once, or in a queue.

Based on the ability to have 100,000 requests per second, I would assume they are done simultaneously, but having an exact answer would help.

I have this question because I have a global counter variable in my game, and I want to know if it’s theoretically possible for 2 servers to try to add a number to the global counter at the same time where:

  1. Server1 grabs the current sortedMap value
  2. Server1 adds it’s number to the sortedMap value
  3. Before Server1 sets it’s new value to the sortedMap, server2 grabs the sortedMap value
  4. Server1 updates the sortedMap value
  5. Server2 adds it’s number and sets it to the memoryStore.

In this example server1’s number would be completely ignored.

If they are handled in a queue then the following would happen in the same situation:

  1. Server1 is entered into the sortedMap queue, and since its first is taken off the start its operations.
  2. Server1 grabs the current sortedMap value
  3. Server1 adds it’s number to the sortedMap value
  4. Server2 is added into the sortedMap queue, and since server1 is still not done computing, it waits.
  5. Server1 updates the sortedMap value, and is taken off the queue
  6. Server2 is now first in the queue and starts it’s operations
  7. Server2 grabs the sortedMap value
  8. Server2 adds it’s number and sets it to the memoryStore.

Now I have already come up with a way to completely avoid this problem, so it’s not a super high priority, but I would like to know for future projects.