title: Earliest deadline scheduling
body: <p>I want to implement Earliest deadline scheduling in C but I cant find the algorithm on the net..</p>
  
  <p>I understand the example below that when time is 0, both A1 and B1 arrive. Since A1 has the earliest deadline, it is scheduled first. When A1 completes, B1 is given the processor.when time is 20, A2 arrives. Because A2 has an earlier deadline than B1, B1 is interrupted so that A2 can execute to completion. Then B1 is resumed when time is 30. when time is 40, A3 arrives. However, B1 has an earlier ending deadline and is allowed to execute to completion when time is 45. A3 is then given the processor and finishes when time is 55.. However I cant come up with a solution.. Please help me to find an algorithm. 
  Thanks..</p>
  
  <p>Image of the example </p>
  
  <p><img src="https://i.stack.imgur.com/kk7kg.png" alt="example">
  <a href="http://imageshack.us/photo/my-images/840/scheduling.png/" rel="nofollow noreferrer">http://imageshack.us/photo/my-images/840/scheduling.png/</a></p>