[Concurrency] What will you do if multiple users access your application at the same time?

I’m an experienced Software Engineer but very weak in concurrency because of no prior experience in that. I’ve been interviewing with several companies in which I was asked similar kind of questions as given below:

  1. If you are designing a fantasy sports application in which there’s a contest which can handle only 100 users. If 99 users are already registered for the contest and multiple users hit the PARTICIPATE button at the same time to become the 100th user, then how will you handle this in your application?

  2. If you are designing a chess game, where multiple users are selecting the users of same level of competence to play with them. Then suppose at same time, users A and B choose the user C (to play with) at the same time, then how will you handle this?

I usually answer this by saying that I’ll use synchronized block in Java or on Database side, I’ll use Locking concept. But I’m not sure of either of them. So, can anyone tell here how do you answer such questions? Should one answer this in terms of Java Multithreading or DBMS or both? Please can anyone also tell me any resources to understand the theory to answer such type of questions or any website or YouTube channel where solutions are given to these kind of questions?

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.