forked from IAmFunkyFrog/os226-2021
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2cc5613
commit aa3d05b
Showing
13 changed files
with
199 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,7 @@ jobs: | |
- batch | ||
- pool | ||
- syscall | ||
- cosched | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#include <limits.h> | ||
#include <string.h> | ||
#include <stdio.h> | ||
|
||
#include "sched.h" | ||
#include "pool.h" | ||
|
||
static int time; | ||
|
||
void sched_new(void (*entrypoint)(void *aspace), | ||
void *aspace, | ||
int priority, | ||
int deadline) { | ||
|
||
} | ||
|
||
void sched_cont(void (*entrypoint)(void *aspace), | ||
void *aspace, | ||
int timeout) { | ||
|
||
} | ||
|
||
void sched_time_elapsed(unsigned amount) { | ||
time += amount; | ||
|
||
} | ||
|
||
void sched_run(enum policy policy) { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#pragma once | ||
|
||
enum policy { | ||
// first-in, first-out; run tasks in order of their arrival | ||
POLICY_FIFO, | ||
|
||
// highest priority task (highest priority value) should be executed | ||
// first. Use round-robin for processes with same priority | ||
// (task from 1st process, from 2nd, ... Nth, 1st, 2nd, ...) | ||
POLICY_PRIO, | ||
|
||
// consider deadline, execute process with Earliest Deadline First. | ||
// Fallback to priority policy if deadlines are equal | ||
POLICY_DEADLINE, | ||
}; | ||
|
||
// Add new task | ||
extern void sched_new(void (*entrypoint)(void *ctx), // entrypoint function | ||
void *ctx, // context of the process | ||
int priority, // priority, [0 - 10], bigger for more priority | ||
int deadline); // absolute time till the task should be completed, <=0 for no deadline | ||
|
||
// Continue process from function after some amount of time | ||
extern void sched_cont(void (*entrypoint)(void *aspace), // entrypoint function | ||
void *aspace,// addresses the process can access | ||
int timeout); // when the continuation became runnable | ||
|
||
// Notify scheduler that some amount of time passed | ||
extern void sched_time_elapsed(unsigned amount); | ||
|
||
// Scheduler loop, start executing tasks until all of them finish | ||
extern void sched_run(enum policy policy); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# entryid cnt prio deadline | ||
coapp 2 10 0 0 | ||
coapp 2 10 0 0 | ||
|
||
cosched 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
coapp_rt id 1 cnt 10 | ||
coapp_rt id 2 cnt 10 | ||
coapp_rt id 1 cnt 9 | ||
coapp_rt id 2 cnt 9 | ||
coapp_rt id 1 cnt 8 | ||
coapp_rt id 2 cnt 8 | ||
coapp_rt id 1 cnt 7 | ||
coapp_rt id 2 cnt 7 | ||
coapp_rt id 1 cnt 6 | ||
coapp_rt id 2 cnt 6 | ||
coapp_rt id 1 cnt 5 | ||
coapp_rt id 2 cnt 5 | ||
coapp_rt id 1 cnt 4 | ||
coapp_rt id 2 cnt 4 | ||
coapp_rt id 1 cnt 3 | ||
coapp_rt id 2 cnt 3 | ||
coapp_rt id 1 cnt 2 | ||
coapp_rt id 2 cnt 2 | ||
coapp_rt id 1 cnt 1 | ||
coapp_rt id 2 cnt 1 | ||
coapp_rt id 1 cnt 0 | ||
coapp_rt id 2 cnt 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# entryid cnt prio deadline | ||
coapp 2 2 2 0 | ||
coapp 2 2 0 0 | ||
coapp 2 2 0 0 | ||
|
||
cosched 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
coapp_rt id 1 cnt 2 | ||
coapp_rt id 1 cnt 1 | ||
coapp_rt id 1 cnt 0 | ||
coapp_rt id 2 cnt 2 | ||
coapp_rt id 3 cnt 2 | ||
coapp_rt id 2 cnt 1 | ||
coapp_rt id 3 cnt 1 | ||
coapp_rt id 2 cnt 0 | ||
coapp_rt id 3 cnt 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# entryid cnt prio deadline | ||
coapp 2 2 0 -1 | ||
coapp 2 2 0 2 | ||
coapp 2 2 0 -1 | ||
|
||
cosched 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
coapp_rt id 2 cnt 2 | ||
coapp_rt id 2 cnt 1 | ||
coapp_rt id 2 cnt 0 | ||
coapp_rt id 1 cnt 2 | ||
coapp_rt id 3 cnt 2 | ||
coapp_rt id 1 cnt 1 | ||
coapp_rt id 3 cnt 1 | ||
coapp_rt id 1 cnt 0 | ||
coapp_rt id 3 cnt 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# entryid cnt prio deadline | ||
coapp 1 4 2 0 | ||
coapp 2 16 0 0 | ||
|
||
cosched 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
coapp_task id 1 cnt 4 | ||
coapp_rt id 2 cnt 16 | ||
coapp_rt id 2 cnt 15 | ||
coapp_task id 1 cnt 3 | ||
coapp_rt id 2 cnt 14 | ||
coapp_rt id 2 cnt 13 | ||
coapp_task id 1 cnt 2 | ||
coapp_rt id 2 cnt 12 | ||
coapp_rt id 2 cnt 11 | ||
coapp_task id 1 cnt 1 | ||
coapp_rt id 2 cnt 10 | ||
coapp_rt id 2 cnt 9 | ||
coapp_task id 1 cnt 0 | ||
coapp_rt id 2 cnt 8 | ||
coapp_rt id 2 cnt 7 | ||
coapp_rt id 2 cnt 6 | ||
coapp_rt id 2 cnt 5 | ||
coapp_rt id 2 cnt 4 | ||
coapp_rt id 2 cnt 3 | ||
coapp_rt id 2 cnt 2 | ||
coapp_rt id 2 cnt 1 | ||
coapp_rt id 2 cnt 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
|
||
map_inputs checkdiff |