• 沒有找到結果。

# Project 2: Energy-Efficient Schedul ing For Android Environment

N/A
N/A
Protected

Academic year: 2022

Share "Project 2: Energy-Efficient Schedul ing For Android Environment"

Copied!
18
0
0

(1)

Real-Time Systems, 2009 Fall

### Project 2: Energy-Efficient Schedul ing For Android Environment

Advised by Prof. Tei-Wei Kuo

TA: Po-Chun Huang ( 黃柏鈞 )

(2)

### Introduction

• From the previous assignment, we know how to control the power modes of the backlight dev ice on the Android platform

• However, it is not trivial to simply turn of f the backlight device when we do not need i t, for the considerable time and energy over heads on power mode switching

• Don’t worry; in this assignment we will fin d a clever way to do this (since it is requi red )

2

(3)

### Some Quick Facts

• Power consumption of T-Mobile G1

1000 200300 400500

Current: mA600

Configurations of Peripheral Devices

Reference: http://rockthearth.blogspot.com/2009/04/power-consumption-of-t- mobile-g1.html

3

(4)

### (1/2)

• We will be given a task set T of periodic tasks ti, for i=1, 2,…, N

– All tasks arrive at time point 0

– Tasks are sorted based on their periods (so pi <= pj iff i<j)

• Each task has a period pi, deadline di, and several operations xij (i=1…N; j=1…ni), each of which has the following properties:

– Luminance uij: can be C, DL and DH, standing for Computation (no display required), Display in Low light and Display in High ligh t, respectively

– Length lij: lij=1, 2, …(setting the time unit to 3~4 seconds is a good choice)

• The requirements of a feasible schedule is those of a conventional hard real-time environment, plus

– The operations of the same task must be scheduled in the specifi ed order

– During the scheduled time of each operation, the back light devi ce must be adjusted to at least as bright as that specified as r equired Luminance

4

(5)

What Will Be Done in This Assignment? (2/2)

• Energy issues

– During each time unit, the backlight device at none(C), low light display (DL), and high light display (HL) consumes EC , EDL, and EDH of energy, respectively

• Of course we can assume that EDH>EDL>EC>=0

• For simplicity we assume that EC=0

– Additional energy ESW is consumed on power level switching

• For simplicity, we assume that switching from an arbitrary power level to another demands the same quantity of energy

• For simplicity, we assume that power level switching happens imme diately

• Our goal:

Compute the feasible schedule with minimal energy con sumption!

5

(6)

### A Sample Input

• The input will be given to you manually;

you can hard-code them in your sources (w ith clear mark so that I know it’s the i nput )

• T = {t1, t2, t3}

– t1 = (16(p1), 14(d1), ((1, 0(C))(x11), (1, 1(DL))(x12))) – t2 = (20(p2), 20(d2), ((1, 2(DH))(x21), (3, 1)(x22))) – t3 = (28(p3), 20(d3), ((1, 0)(x31), (1, 1)(x32), (1, 0)

(x33)))

– EC=0, EDL=1, EDH=5, ESW=12

6

(7)

### Scoring

• Baseline: RM schedule (30%)

• Implement then write down your improvement over t he RM schedule in reports (70%)

– Must provide the intuition and sufficient examples to show why it is better than original RM!

– Must output the detailed computed schedule with LogCat!

• Better if you can prove the bound of energy or ti me! (30% bonus)

• Even better if you can compose a demo of your alg orithm on the Android emulator! (30% bonus)

7

(8)

8

(9)

### Open the LogCat Console View

• Add the LogCat view to menu shortcut:

Window -> Customize Perspective -> Sh ortcuts -> Submenus : Show View -> Ca tegories : Android -> LogCat

• Open the view: Window -> Show View ->

LogCat

9

(10)

Print Customized Debugging Messages in LogC at

• Import android.util.Log package in your project

• Use the static variable Log to keep trace of your target: Log.d("DEBU G", "message");

• Please use the message typed “DEBUG” to make them distinguished fro m system messages!

• You must print at least the following messages to receive any score

– If the task set is un-schedulable, simply print “Unschedulable!”

– Else, during the time interval [0, LCM(p1, …, pN)), in each time unit, the li ght level and the IDs of scheduled operation and its residing task should be p rinted as:

Time XX: Running task XX, operation XX, H(high light)/L(low light)/N(no light) – If nothing is being executed during that time, print: Time XX: Idle, H/L/N

– By the end of program, print out a summary message about the total energy cons umption statistics, and the number of light level switching, using RM and your algorithms respectively:

Total high light time: XX Total low light time: XX Total no light time: XX

Total light switching: XX times Total energy consumption of RM: XX

Total energy consumption of my algorithm: XX Improvement by XX%

10

(11)

### Sample Outputs 1

• ---- RM ----

– Unschedulable!

• ---- My program ----

– Unschedulable!

• ---- Results ----

– Unschedulable!

11

(12)

Sample Outputs 2

• ---- RM ----

– Time 0: Running task 1, operation 1, H – Time 1: Running task 2, operation 1, L – ……

– Time 48: Running task 1, operation 1, N – Total high light time: 22

– Total low light time: 15 – Total no light time: 11

– Total light switching: 16 times – Total energy consumption: 130

• ---- My program ----

– Time 0: Running task 1, operation 1, H – Time 1: Running task 1, operation 2, H – ……

– Time 48: Running task 2, operation 1, N – Total high light time: 17

– Total low light time: 16 – Total no light time: 15

– Total light switching: 6 times – Total energy consumption: 108

• ---- Results ----

– Energy improved by 17%

12

(13)

13

(14)

### Hint 2: Idle Time…

• How about the light mode between sche duled task operations?

• We know that

• How about…

14

H ??? H

H ??? L

L ??? H

N N N

(15)

### Hint 3: Moving and Swapping

• Moving: Without violating the deadlin es, move the scheduled points of task s left or right to reduce the idle ti me

• Swapping: Without violating the deadl ines, swap the scheduled points of ta sks to reduce light level switching

15

L H L H

L L H H

(16)

### ion

• Thread.sleep lets a thread “sleep”

for a specified time period

• Thread.run executes the thread’s met hod

• Thread.join waits for the created thr ead to finish for its computation res ults

• No need to create a thread for each t ask…

16

(17)

### Submission

• The deadline of this assignment is 1/7, 2 3:59

• Mail to f95070@csie.ntu.edu.tw with

– Title: [RTS Project II] Your-Student-ID Your-Name – Attached files:

• Project directory compressed into a single file: Your-Studen t-ID.zip/.tar/.tgz/.7z

• Report: Your-Student-ID.txt

– You will receive a confirmation about your su bmission in two days; if not, please contact TA immediately

– Any questions are welcome through E-mail or f ace-to-face discussion in R442!

17

(18)

## Q & A?

Thank You!

18

Pessoal remunerado a tempo completo e a tempo parcial nas lotarias e outros jogos de aposta segundo o sexo e a profissão Number of full-time and part-time paid employees in the

Pessoal remunerado a tempo completo e a tempo parcial nas lotarias e outros jogos de aposta segundo o sexo e a profissão Number of full-time and part-time paid employees in the

Pessoal remunerado a tempo completo e a tempo parcial nas lotarias e outros jogos de aposta segundo o sexo e a profissão Number of full-time and part-time paid employees in the

Pessoal remunerado a tempo completo e a tempo parcial nas lotarias e outros jogos de aposta segundo o sexo e a profissão Number of full-time and part-time paid employees in the

You are given the wavelength and total energy of a light pulse and asked to find the number of photons it

(c) If the minimum energy required to ionize a hydrogen atom in the ground state is E, express the minimum momentum p of a photon for ionizing such a hydrogen atom in terms of E

The four e/g-teaching profiles identified in this study are outlined as follows: parsimony (low e-teaching and medium, below- average g-teaching), conservation (low e-teaching and

Two sources to produce an interference that is stable over time, if their light has a phase relationship that does not change with time: E(t)=E 0 cos( w t+ f ).. Coherent sources: