The following problems will be due in class.
The control laws need to run at a frequency of 500 Hz. The load on the battery can change with 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 any other assumptions you make.
| 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 into something. There is no limit on how often the robot can run into things. |
| periodic | ≤ 2 ms | The robot can only respond to running into things by changing the control laws, so there is no need to check for collisions more often than every 2 ms. The robot probably needs to run the planning task to figure out what to do, so it may make sense to wait for the planning task. | ||
| T3 | Battery status | periodic | 2 ms | Power consumption could change based on the control laws, but probably not more frequently than that. |
| 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 least once per meter travelled. A shorter period may be useful 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 it cannot compute a new plan. If that is the case an aperiodic job may be an acceptable alternative. | ||
| T5 | Communication | aperiodic | N/A | Nothing in the communication task depends on meeting a deadline. |
Because sporadic jobs may have varying release times and execution times, the periodic task model may be too inaccurate and can lead to undue underutilization of the processor even when the interrelease times of jobs are bounded from below and their executions are bounded from above. As an example, suppose we have a stream of sporadic jobs whose interrelease times are uniformly distributed from 9 to 11. Their execution times are uniformly distributed from 1 to 3.
For the periodic task model we model a task using the lower bound on its period and the upper bound on its execution time (the worst case). In this case, the period, p = 9, and the exeuction time, e = 3.
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 E uniformly distributed from 1 to 3 time units, and the period is a random variable P uniformly distributed from 9 to 11. Utilization is a random variable that is a function of E and P. In particular, Usporadic = 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 fe(e) and fp(p). In this case, after a bit more math than I anticipated we find:
| 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 |
After integrating we find Usporadic = E[U] ≈ 0.20.
The utilization with the periodic task model is about 13 % more than if we use the average utilization.
Show a precedence graph that for all these activities.
You may have drawn an edge from e to g if you assumed the table was required to pour lemonade into the cups.



Notes:
J2 and J3 miss their deadlines. This is not an optimal scheduling algorithm.
A system contains nine nen-preemtable jobs named Ji, for i = 1, 2, ..., 9. Their execution times are 3, 2, 2, 2, 2, 4, 4, 4, 4, and 9, respectively, their release times are equal to 0, and their deadlines are 12. J1 is the immediate predecessor of J9, and J4 is the immmediate predecessor of J5, J6, J7, and J8. There are no other precedence constraints. For all the jobs, Ji has a higher priority than Jk if i < k.
Yes, here is the schedule:

No, J9 misses its deadline.


No, J9 misses its deadline.
