This is a question I got in an interview. It is little hard to explain, please bear with me.
Imagine a Railway Ticketing Counter.
You are the security guard, now you get to choose who can be processed at the new counter.
Counters are marked 1, 2, 3 and 4 (blue boxes). People waiting in line are marked A, B, C and so on. Here A came first, followed by B and then C etc.
I was asked to give the answer and the logic behind the answer. The interviewer kept on asking more questions on my answers.
For example - when I said,
The interviewer argued saying how is it that E and G get the same preference (priority).
After few minutes of such arguments, I told like this seems to be a simple scheduling problem which can easily be solved if there was a common queue and the security guard sends the next person on the queue to a vacant counter following FCFS.
However, the interviewer was not impressed.
Is there a different approach which I missed? What is the right way to answer such questions?
PS: I didn't get through this round :(
The simplest best-effort scheduling algorithms are round-robin, fair queuing (a max-min fair scheduling algorithm), proportionally fair scheduling and maximum throughput. If differentiated or guaranteed quality of service is offered, as opposed to best-effort communication, weighted fair queuing may be utilized.
As of now, the Round Robin scheduling algorithm is considered as the efficient process scheduling algorithm among all the existing CPU scheduling algorithms. However, in RR the shortest one have to wait for a longer time and in SRTF longer process behaves as a suspended process as short tasks keep on executing.
The main purposes of scheduling algorithms are to minimize resource starvation and to ensure fairness amongst the parties utilizing the resources. Scheduling deals with the problem of deciding which of the outstanding requests is to be allocated resources. There are many different scheduling algorithms.
The FCFS is better for a small burst time. The SJF is better if the process comes to processor simultaneously. The last algorithm, Round Robin, is better to adjust the average waiting time desired.
Given my background in the topic and more years in the industry than I'll admit here ... :-) ... I have a hypothesis as to why you didn't make the next round: this is not so much a program design question as a behaviour question.
This class of interview question is often not about the solution, but about your problem-solving approach. I (interviewer) gave you a problem with several open possibilities. First of all, this is "obviously" a metaphor for an OS multi-processing situation. I want an ideal candidate to
Armed with a better description of the problem, now I want you to work through a solution, consistently engaging your customer (me) in the general approach and the specifics. This is a critical part of the Agile approach, for instance. Also, I want to see how you explain things I don't understand.
Note that item #2 is very important: if your true customer for this is a corrupt security guard retiring at the end of the shift, then the correct solution might be to hold a bribery bidding war for access to the open counter.
Here's your homework for the next interview: what assumptions are necessary to make your given solution a good one? How can you validate those assumptions with your customer?
My immediate questions include the ones above, and ...
This is where my typing caught up with my thought processes, a fair point to stop.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With