Tips for Programming Assignment #1

1 / 14

# Tips for Programming Assignment #1 - PowerPoint PPT Presentation

Tips for Programming Assignment #1. Requirements. Measure success ratio, deadline miss ratio &amp; QoS level for different loads = 0.4, 0.6, 0.8, ..., 1.8, 2.0 for three different approaches Simple EDF &amp; RMS without admission control or QoS degradation EDF &amp; RMS + admission control

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.

## PowerPoint Slideshow about ' Tips for Programming Assignment #1' - season

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

### Tips for Programming Assignment #1

Introduction to Real-Time Embedded Systems

Requirements
• Measure success ratio, deadline miss ratio & QoS level for different loads = 0.4, 0.6, 0.8, ..., 1.8, 2.0 for three different approaches
• EDF & RMS + admission control
• EDF & RMS + admission control + QoS degradation (e.g., imprecise computation)
• Run 10 simulations using different seed numbers for each load and take the average success ratio, miss ratio & QoS level for every approach described above

Introduction to Real-Time Embedded Systems

Time-Driven vs. Event-Driven Simulation
• Time-Driven
• for (usnigned int t=1; t=600000; t++)

{

Do something at time t;

t++;

}

• Easy but slow

Introduction to Real-Time Embedded Systems

Time-Driven vs. Event-Driven Simulation
• Event-Driven
• Fast
• Process the current event
• Most professional simulators are event-driven
• More difficult
• Should be careful to properly manage the event queue
• For this assignment, you can do time-driven simulation

Introduction to Real-Time Embedded Systems

Overall structure

int main(char *argv, int argc)

{

if (argc < NUM_ARGS) cout << “error”; exit(-1);

/* argv[0] -> EDF or RMS */

/* argv[1] -> estErr (execution time estimation error); removed from PA #1 */

/* argv[2] -> turn on/off QoS degradation */

for (unsigned int i=0; i<NUM_SIMULATIONS; i++)

{

for (unsigned int t=0; t<MAX_TIME; t++) /* one simulation run */

{ /* Use a different seed number for each simulation run */

generate_jobs(t);

schedule();

dispatch();

step_run();

collect_statistics(); /* #submitted, #admitted, #timely, QoS */

}

cout << “Scheduling algorithm = ” << /* print EDF or RMS according to argv[0] */ << endl;

cout << “estErr = “ << argv[1] << endl;

cout << “QoS = “ << /* average QoS in [0,1] */ << endl;

cout << “Load = “ << argv[3] << endl;

cout << “deadline miss ratio = “ << 1 - (#timely / #submitted) << endl;

clean_up();

}

Introduction to Real-Time Embedded Systems

Skeletion of class source()

#define MIN_EXEC_TIME 5 //5ms

#define MAX_EXEC_TIME 20 //20ms

#define MIN_PERIOD 20

#define MAX_PERIOD 500

#define MAX_SOURCES

{

int next_job_arrival_time;

int exec_time;

int period; //relative deadline = period

float u; //utilization

int qos; //1 = high, 0.5 = low

}

//Use newranrandom number generator to create Poisson & uniform distributions

Uniform Unif();

Introduction to Real-Time Embedded Systems

// main

u_total = 0.0; //total utilization

next_task_arrival_time = t + (int) P.Next();

for (unsigned int t=0; t<MAX_TIME; t++) /* one simulation run */

{

{

next_task_arrival_time = t + (int) P.Next();

}

.......

}

Introduction to Real-Time Embedded Systems

{

s[num_tasks]->exec_time = (unsigned int) (MIN_EXEC_TIME + Unif.Next() * (MAX_EXEC_TIME – MIN_EXEC_TIME));

s[num_tasks]->period = (unsigned int) (MIN_PERIOD + Unif.Next()*(MAX_PERIOD – MIN_PERIOD))

//Delete this task and return false

else

{

}

}

Introduction to Real-Time Embedded Systems

generate_jobs(t)

void generate_jobs(t)

{

{

if (s[i]->admitted && s[i]-> next_job_arrival_time == t)

{

// Generate a job with s[i]->period,

// s[i]->exec_time, etc. and insert it

s[i]-> next_job_arrival_time = t + s[i]->period;

}

}

}

Introduction to Real-Time Embedded Systems

{

if (u_total + s[task_id] <= U_BOUND)

else

}

Introduction to Real-Time Embedded Systems

{

}

{

if (u_total + 0.5 * s[sid]->u <= U_BOUND) //imprecise computation

{

s[tid]->qos = LOW;

s[tid]->exec_time = 0.5 * s[tid]->exec_time;

s[tid]->u = 0.5 * s[tid]->u;

return;

}

else

{

}

}

Introduction to Real-Time Embedded Systems

schedule()

void schedule()

{

// sort the ready queue according to

// the selected scheduling algorithm, i.e.,

// EDF or RM

}

Introduction to Real-Time Embedded Systems

dispatch() & step_run()

job *dispatch()

{

/* return the highest priority job amog the currently running task and the tasks in the ready queue */

}

step_run(unsigned int t, job *highest)

{

highest->exec_time--;

if (highest->exec_time == 0)

if (its deadline <= t) #timely++;

/* continue to run a job even if its deadline is missed */

}

Introduction to Real-Time Embedded Systems

Expected Outcome
• Show the following: