python读取edf_python实现的EDF(earliest deadline first)算法

1 #!/user/bin/env python

2 #-*- coding:utf-8 -*-

3

4

5 classGetCloseTime:6 def __init__(self, dictionary):7 self.dictionary =dictionary8

9 defgreatest_common_divisor(self, _left, _right):10 return _left if _right == 0 else self.greatest_common_divisor(_right, _left %_right)11

12 deflowest_common_multiple(self):13 temp_result = 1

14 for value inself.dictionary.values():15 temp_result = value[1] * temp_result / self.greatest_common_divisor(value[1], temp_result)16 returntemp_result17

18

19 classTaskControlBlock:20 CURRENT_TIME =021

22 def __init__(self, dictionary,23 name_list,24 period_time,25 central_processing_unit_time,26 remain_time,27 current_period):28 for key indictionary.keys():29 name_list.append(key)30 period_time.append(dictionary.get(key)[1])31 central_processing_unit_time.append(dictionary.get(key)[0])32 remain_time.append(dict

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值