RTSsol

download RTSsol

of 5

Transcript of RTSsol

  • 8/3/2019 RTSsol

    1/5

    Homework 1 Solutions

    The following problems will be due in class.

    1. A robotic vacuum cleaner has a motor control task that computes control laws for its drivemotor, a contact task that detects when the robot's contact sensor is triggered by running intosomething, a battery status task that monitors the voltage on the battery and how much currentis being taken from it, a planning task that determines the path the robot should follow, and acommunication task that allows the user to set the time of day and dowload times of the dayduring which the robot should work. Classify each task as periodic, sporadic, or aperiodic andidentify the relevant task parameters (e.g., a periodic task has a period, worst-case executiontime, and relative deadline.) More than one answer may be correct, so you must justify yourchoices to get full credit.

    The control laws need to run at a frequency of 500 Hz. The load on the battery can changewith every control law update. The robot should never travel outside the range it has planned.The planning task needs to run fast enough that the robot does not go more than 1 m between

    jobs in the planning task. Assume the top speed of the robot is 0.5 m/s. Be sure to describe anyother assumptions you make.

    Several of the tasks had multiple acceptable answers. As long as you can give a good enoughreason I will accept almost anything.

    2. Do problem 3.1 in the book.

    Because sporadic jobs may have varying release times and execution times, the periodic taskmodel may be too inaccurate and can lead to undue underutilization of the processor even

    Task Type Period Reason

    T1

    Control Laws periodic 2 ms Needs to be updated with a frequency of 500 Hz

    T2

    Contact sporadic N/A Run the task whenever the robot runs intosomething. There is no limit on how often the robotcan run into things.

    periodic 2 ms The robot can only respond to running into thingsby changing the control laws, so there is no need tocheck for collisions more often than every 2 ms.The robot probably needs to run the planning task tofigure out what to do, so it may make sense to waitfor the planning task.

    T3

    Battery status periodic 2 ms Power consumption could change based on thecontrol laws, but probably not more frequently thanthat.

    T4

    Planning periodic 2 s The robot takes at least 2 s to go 1 m at top speed. A

    2 s period guarantees the planning task runs at leastonce per meter travelled. A shorter period may beuseful to deal with moving obstacles like people or

    pets (or unexepected collisions.)

    aperiodic N/A It may be acceptable to have the robot pause if itcannot compute a new plan. If that is the case anaperiodic job may be an acceptable alternative.

    T5

    Communication aperiodic N/A Nothing in the communication task depends onmeeting a deadline.

    Page 1 of 5EE 599-002: Homework 1 Solutions

    25-02-2012file://C:\Users\Amit\Desktop\New folder\soln1.html

  • 8/3/2019 RTSsol

    2/5

    when the interrelease times of jobs are bounded from below and their executions are boundedfrom above. As an example, suppose we have a stream of sporadic jobs whose interreleasetimes are uniformly distributed from 9 to 11. Their execution times are uniformly distributedfrom 1 to 3.

    a. What are the parameters of the periodic task if we were to use such a stask to model thestream?

    For the periodic task model we model a task using the lower bound on its period and theupper bound on its execution time (the worst case). In this case, the period, p = 9, andthe exeuction time, e = 3.

    b. Compare the utilization of the periodic task in part (a) with the average utilization of thesporadic job stream.

    The utilization of a periodic task is its execution time divided by its period. In this case:

    Uperiodic

    = eperiodic

    /pperiodic

    = 3/9 = 0.3333

    Modeling the job as a stream of periodic jobs, the execution time is a random variable Euniformly distributed from 1 to 3 time units, and the period is a random variable Puniformly distributed from 9 to 11. Utilization is a random variable that is a function ofE and P. In particular, U

    sporadic= E/P. In general we can find the average value of U, E

    [U], we need to integrate u fu(u), the probability density function of U from -infinity to

    infinity.

    You can use the rules of probability to determine fu(u) from f

    e(e) and f

    p(p). In this case,

    after a bit more math than I anticipated we find:

    After integrating we find Usporadic

    = E[U] 0.20.

    The utilization with the periodic task model is about 13 % more than if we use theaverage utilization.

    3. You want to set up a lemonade stand. In no particular order, you need to:a. mix lemon juice and water,

    b. buy lemons and sugar (at the grocery store),c. buy a table (at another store),d. mix the lemon juice, sugar, and water,e. set up the table and a sign,f. make a sign, and

    g. pour the lemonade into cups

    Show a precedence graph that for all these activities.

    0, u < 1/11

    121/8 - 1/(8u2), 1/11 u < 1/9

    fu(u) = 5, 1/9 u < 3/11

    9/(8u2) - 81/8, 3/11 u < 1/3

    0, 1/3 u

    Page 2 of 5EE 599-002: Homework 1 Solutions

    25-02-2012file://C:\Users\Amit\Desktop\New folder\soln1.html

  • 8/3/2019 RTSsol

    3/5

    You may have drawn an edge from e to g if you assumed the table was required to pourlemonade into the cups.

    4. Do problem 4.1 from the booka. Find the effective release times and deadlines of the jobs in the precendence graph in

    Figure 4P-1.

    b. Find an EDF schedule of the jobs.

    c. A job is said to be at level i if the length of the longest path from the job to jobs thathave no successors is i... Find a priority-drive schedule of the jobs in Figure 4P-1according to this priority assignment.

    Notes:

    1. J1

    is the only job released at t=0, so it goes first.

    2. At t=1, J2, J

    4, and J

    7have been released. J

    4has a level of 3, so it goes first.

    3. At t=2, J4is done. J

    7has the next highest level (2), so it goes next.

    4. At t=3, J7

    is done. J3, J

    5, J

    8, and J

    9are released. J

    5has the next highest level (2),

    so it runs.5. At t=4, J

    5is done. Either J

    2or J

    8could run because both have a level of 1 and

    both have had their precedence contraints met. At this point J2

    has already missed

    its deadline...

    Page 3 of 5EE 599-002: Homework 1 Solutions

    25-02-2012file://C:\Users\Amit\Desktop\New folder\soln1.html

  • 8/3/2019 RTSsol

    4/5

  • 8/3/2019 RTSsol

    5/5

    d. Can the jobs meet their deadlines if they are scheduled nonpreemptively on fourprocessors? Explain your answer.No, J

    9misses its deadline.

    e. Suppose that due to an improvement of the three processors, the execution time of everyjob is reduced by 1. Can the jobs meet their deadlines? Explain your answer.

    No, J9

    misses its deadline.

    Page 5 of 5EE 599-002: Homework 1 Solutions