Microsoft

  www.microsoft.com
  www.microsoft.com

Interview Question

Software Development Engineer II Interview Redmond, WA

Design a scheduler to run many functions at different

  times. It needs to (obviously) be thread-safe. Each task which is scheduled to run will have a time stamp, containing a desired execution time, a function pointer (containing the desired function). Also, find a way to supply the arguments to each function. Implement the mechanisms for scheduling/removing work to be done. How would you handle functions that must be serialized as opposed to ones that didn't need to be?
Answer

Interview Answer

1 Answer

0

Too much to write in this box, but open your operating systems 101 book. If you know how to dispatch threads, use a mutex and a condition variable, you're good to go. Also, know how to implement a min-heap or perhaps a circular queue. You'll need one. Make quite sure it's thread safe!

Interview Candidate on Jan 27, 2013

Add Answers or Comments

To comment on this, Sign In or Sign Up.