Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
las3_pub
/
simso
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
a3663753
authored
May 28, 2015
by
PE Hladik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add EDCL scheduler
parent
34b6f852
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
58 additions
and
0 deletions
+58
-0
simso/schedulers/EDCL.py
+58
-0
No files found.
simso/schedulers/EDCL.py
0 → 100644
View file @
a3663753
#!/usr/bin/python
# coding=utf-8
__author__
=
'Pierre-Emmanuel Hladik'
from
simso.core
import
Scheduler
class
EDCL
(
Scheduler
):
"""
EDCL Scheduler.
Global EDF-based Scheduling with Efficient Priority Promotion.
Shinpei Kato and Nobuyuki Yamasaki.
The 14th International Conference on Embedded and Real-Time Computing
Systems and Applications, 2008
"""
def
on_activate
(
self
,
job
):
job
.
cpu
.
resched
()
def
on_terminated
(
self
,
job
):
job
.
cpu
.
resched
()
def
update_laxity
(
self
):
for
t
in
self
.
task_list
:
if
t
.
is_active
():
job
=
t
.
job
laxity
=
(
job
.
absolute_deadline
-
job
.
ret
)
*
self
.
sim
.
cycles_per_ms
-
self
.
sim
.
now
()
# if laxity is less than 0, the job will never respect its deadline,
# so we do not consider this job as critical
if
laxity
==
0
:
job
.
data
[
'priority'
]
=
0
else
:
job
.
data
[
'priority'
]
=
job
.
absolute_deadline
def
schedule
(
self
,
cpu
):
self
.
update_laxity
()
# List of ready jobs not currently running:
ready_jobs
=
[
t
.
job
for
t
in
self
.
task_list
if
t
.
is_active
()
and
not
t
.
job
.
is_running
()]
if
ready_jobs
:
# Select a free processor or, if none,
# the one with the greatest deadline (self in case of equality):
key
=
lambda
x
:
(
1
if
not
x
.
running
else
0
,
x
.
running
.
absolute_deadline
if
x
.
running
else
0
,
1
if
x
is
cpu
else
0
)
cpu_min
=
max
(
self
.
processors
,
key
=
key
)
# Select the job with the least priority:
job
=
min
(
ready_jobs
,
key
=
lambda
x
:
x
.
data
[
'priority'
])
if
(
cpu_min
.
running
is
None
or
cpu_min
.
running
.
absolute_deadline
>
job
.
absolute_deadline
):
return
(
job
,
cpu_min
)
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment