"""Deadline Monotonic algorithm for uniprocessor architectures."""fromsimso.coreimportSchedulerfromsimso.schedulersimportscheduler@scheduler("simso.schedulers.DM_mono")classDM_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 priority based on deadlinejob=min(self.ready_list,key=lambdax:x.task.deadline)else:job=Nonereturn(job,cpu)