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 kinds of questions as given below:
If you are designing a fantasy sports application in which there's a contest that 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?
If you are designing a chess game, where multiple users are selecting the users of the same level of competence to play with them. Then suppose at the same time, users A and B choose 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 the Database side, I'll use the 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 types of questions or any website or YouTube channel where solutions are given to these kinds of questions?