"""Earliest Deadline First algorithm for uniprocessor architectures."""fromsimso.coreimportSchedulerclassEDF_mono(Scheduler):definit(self):self.ready_list=[]defon_activate(self,job):self.ready_list.append(job)job.cpu.resched()defon_terminated(self,job):self.ready_list.remove(job)job.cpu.resched()defschedule(self,cpu):ifself.ready_list:# job with the highest priorityjob=min(self.ready_list,key=lambdax:x.absolute_deadline)else:job=Nonereturn(job,cpu)