Skip to content

Commit

Permalink
simple progress on EAMQ implementation and make docker commands
Browse files Browse the repository at this point in the history
  • Loading branch information
anthongretter committed Oct 4, 2024
1 parent abcfdbe commit dff9dd8
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 25 deletions.
5 changes: 0 additions & 5 deletions .vscode/settings.json

This file was deleted.

4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ FROM fedora:40

RUN yum -y update && \
yum -y install make g++ gcc gdb qemu binutils binutils-x86_64-linux-gnu cross-gcc-common \
gcc-c++-x86_64-linux-gnu nano dev86 && \
gcc-c++-x86_64-linux-gnu nano dev86 bridge-utils libvirt virt-install qemu-kvm && \
yum clean all

WORKDIR /app

CMD ["/bin/bash"]
ENTRYPOINT ["/sbin/init"]
2 changes: 1 addition & 1 deletion app/producer_consumer/producer_consumer_traits.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ template<> struct Traits<Thread>: public Traits<Build>
static const bool simulate_capacity = false;
static const int priority_inversion_protocol = NONE;

typedef RR Criterion;
typedef LLF Criterion;
static const unsigned int QUANTUM = 10000; // us
};

Expand Down
24 changes: 9 additions & 15 deletions include/scheduler.h
Original file line number Diff line number Diff line change
Expand Up @@ -279,16 +279,10 @@ class LLF: public RT_Common
// Energy Aware Multi Queue
class EAMQ: public RT_Common
{
friend class Scheduler<Thread>;

typedef Scheduler<Thread>::Base Queue;

public:
static const unsigned short QUEUES = 4; // or maybe a trait?

//static const bool timed = true;
static const bool dynamic = true;
//static const bool preemptive = true;

public:
// rever
Expand All @@ -298,21 +292,21 @@ class EAMQ: public RT_Common
// template <typename T>
// static int rank(T obj);

unsigned int queue() const; // metodo usado para retornar o index da sublista que um elemento sera inserido
static unsigned int current_queue(); // sublista atual em que sera retirado o head no "choosen"
// void next_queue();
void handle_rank();
unsigned int queue() const { return _queue; }; // returns the Thread's queue
void handle(Event event);

static unsigned int current_queue() { return _current_queue; }; // current global queue
static void next_queue() { ++_current_queue %= QUEUES; }; // points to next global queue

protected:
volatile unsigned int _queue; // Thread's current queue
static volatile unsigned _current_queue; // Current global queue
};

__END_SYS

__BEGIN_UTIL

// /* Então,
// * Parece que já existe uma implementação de fila com mais "filas". Uhuul
// * Ela meio q particiona uma fila em diversas, e mantem um ponteiro a atual.
// * O comentário da Scheduling_Multilist mostra oq deve ser implementado no critério (Priority)
// * */
template<typename T>
class Scheduling_Queue<T, EAMQ>: public Scheduling_Multilist<T> {};

Expand Down
11 changes: 11 additions & 0 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -196,4 +196,15 @@ dist: veryclean
find $(TOP) -name "*.S" -print | xargs sed -i "1r $(ETC)/license.txt.as"
$(CLEAN) $(ETC)/license.as

dimage:
docker build -t epos $(TOP)

dclean:
docker stop epos || true
docker rm epos || true

drun: dimage dclean
docker run -itd --privileged --cap-add=ALL -v $(TOP):/app --name epos epos
docker exec -it epos /bin/bash

FORCE:
16 changes: 14 additions & 2 deletions src/api/scheduler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#include <process.h>
#include <time.h>
#include "scheduler.h"


__BEGIN_SYS

Expand Down Expand Up @@ -98,8 +100,8 @@ void LLF::handle(Event event) {
if(periodic() && ((event & UPDATE) | (event & JOB_RELEASE) | (event & JOB_FINISH))) {
_priority = elapsed() + _deadline - _capacity + _statistics.job_utilization;
// tempo atual + deadline = ponto real de deadline
// capacidade ("total" do job executar) + o que ja foi executado = restante a executar
// ponto real de deadline - restante a executar = slack
// capacidade (restante do job executar) + o que ja foi executado = total a executar
// ponto real de deadline - total a executar = slack
}
RT_Common::handle(event);

Expand All @@ -110,4 +112,14 @@ void LLF::handle(Event event) {
// Since the definition of FCFS above is only known to this unit, forcing its instantiation here so it gets emitted in scheduler.o for subsequent linking with other units is necessary.
template FCFS::FCFS<>(int p);


EAMQ::EAMQ(Microsecond p, Microsecond d, Microsecond c): RT_Common(int(elapsed() + ticks((d ? d : p) - c)), p, d, c) {}

void EAMQ::handle(Scheduling_Criterion_Common::Event event) {
if(periodic() && ((event & UPDATE) | (event & JOB_RELEASE) | (event & JOB_FINISH))) {

}
RT_Common::handle(event);
}

__END_SYS

0 comments on commit dff9dd8

Please sign in to comment.