Knowing multi-threading and how it works is good, but can we make use of it to solve some real-life problems? An interviewer may ask questions where he/she wants to know how would you tackle some scenarios and leverage multi-threading. Not to be forgotten that concurrency, synchronization and race conditions are to be kept in mind while answering such questions.
Here are some situations given to check your understanding and the ability to solve problems using multi-threading :
1. Given a large array of, say, a million numbers, sort it using multi-threading.
Sorting an array would involve both reads and writes…