Overview of the Lab 2 Assignment: Multicore Real-Time Tasks Chris Gill and Son Dinh CSE 522S – Advanced Operating Systems Washington University in St. Louis St. Louis, MO 63143
CSE 522S – Advanced Operating Systems Lab Objectives Kernel module releases multiple end-to-end tasks periodically on different cores Timer releases first sub-task Entire task must finish before next release Subtasks may span multiple cores Each subtask has its own release time, sub-deadline, execution time, and priority Each sub-task runs in its own kthread Completion releases downstream subtask Release guards prevent early execution You will calibrate subtasks’ execution times Number of iterations of a specific loop Measured in isolation first Also monitored at run-time Core 0 Core 1 Core 2 Core 3 CSE 522S – Advanced Operating Systems
“Data Driven” Module Configuration Each task (and subtask) is described by configuration data A custom header file contains config data General module functions read that data, configure threads, timers, counters, etc. Module init and exit functions Init allocates, exit deallocates Again use dynamic data structures Don’t assume fixed sizes/numbers for things that may vary per program inputs Module can be loaded in “calibrate” mode If loaded in calibrate mode, runs one subtask at a time on its core, finds number of iterations closest to given execution time, prints results to system log file Otherwise, will run all tasks at once, using the given numbers of iterations for each subtask that’s found in the config info struct rt_subtask_spec { unsigned int task_id; unsigned int subtask_id; unsigned int st_core; unsigned int st_exectime; … }; struct rt_subtask_spec* configuration = 0; int define_config(void); int setup_subtasks(void); CSE 522S – Advanced Operating Systems
Task Release Mechanisms Timer expires, wakes up thread for first subtask(s), reschedules next timer wakeup Keeps a “wheel” of subtask release times Uses absolute time to avoid release jitter Thread for first sub-task has no dependence First subtask is released when timer expires T 2,1 T 1,1 T 3,1 4 5 8 10 12 15 CSE 522S – Advanced Operating Systems
Subtask Release Mechanisms When subtask completes, updates a counter Also notifies a condition variable When a subtask wakes up it checks counter If not updated, blocks on the condition variable This handles both early and late completion Not awoken until release time, doesn’t start until predecessor has recorded its completion T 2,2 T 1,2 T 3,2 4 5 8 10 12 15 CSE 522S – Advanced Operating Systems
Monitoring and Evaluation Release time is when a job of a task is ready Start time is when a job is first scheduled Release guards should prevent start before release Execution time is sum of scheduled intervals Record subtask execution times, compare to what was specified in the configuration data Missed deadline if task runs past next release Τ1,1,1 Τ2,1,1 Τ1,1,1 Time released resumed preempted completed CSE 522S – Advanced Operating Systems
CSE 522S – Advanced Operating Systems Extra Credit Options Extend the calibration mode so it calculates subtasks’ sub-deadlines, priorities, etc., too Outputs that calculated data to the system log, in a nicely structured format Write a helper program that can extract that calculated system log file, and use it to generate .h file that the module can include to run correctly Add a mode to run using SCHED_DEADLINE Vary parameters to see their effects on behavior Compare results to standard SCHED_FIFO behavior CSE 522S – Advanced Operating Systems
CSE 522S – Advanced Operating Systems Lab Write-up As you work, please record your observations in detail It’s a good idea to read the entire assignment, and to plan and design a bit before starting to work on it It’s also a good idea to develop and test incrementally First, design and implement calibration mode Then, design and implement run mode Then design and implement extra credit options, if you’d like Make sure Kernelshark, etc. traces validate your assumptions Design and run and document results of validation experiments Write a cohesive report that analyzes, integrates, and offers explanations for what you observed Document the thinking behind your design Attribute sources for any code or design ideas you obtained from elsewhere (caveat – only use what you understand, and know to be correct) Explain not only what you did and what you saw, but also why you did that, and why you think what you saw happened CSE 522S – Advanced Operating Systems