title: Task scheduling - controlling the execution of a function
body: <p>In an embedded project, we're supposed to implement a task scheduler with different priorities, the project implementation is in C and is run on an <a href="http://en.wikipedia.org/wiki/Arduino" rel="nofollow">Arduino</a> device.  </p>
  
  <p>Now that we're in the researching phase, one question popped but nobody had experience enough to have a certain answer: </p>
  
  <p>How is it possible to control the execution time of a function? How do we keep track of time before the function returns so we can interrupt it for example when a time-out occurs?</p>
  
  <p>One suggestion was to use <code>fork()</code>, but since Arduino does not include an operation system, there's no kernel to handle a thread. Or am I wrong? </p>
  
  <p>Any input will be helpful, thanks a bunch,</p>