This project simulates periodic real-time workloads and studies how cache interference changes execution-time predictability. The simulator compares shared-cache scheduling against cache partitioning and cache coloring, measures cache-related preemption delay (CRPD), and exports repeatable results for the course report and presentation.
- Implement periodic real-time scheduling with
RMSandEDF. - Model cache interference caused by task preemption.
- Measure CRPD, response time, deadline misses, and cache behavior.
- Compare baseline shared-cache execution with cache-aware isolation policies.
- Generate repeatable traces, CSV summaries, and plots for evaluation.
.
├── CMakeLists.txt
├── Makefile
├── inc/
├── src/
├── scripts/
├── results/
- C compiler with C11 support
- CMake 3.16+
- Python 3.10+ with
numpy,pandas,matplotlib
The simulator core is standard C and does not depend on Linux-only APIs. The documented build and analysis workflow is strongest on WSL/Linux, while native Windows builds are also supported with an appropriate toolchain.
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build buildFrom PowerShell with Visual Studio Build Tools or MinGW installed:
cmake -S . -B build
cmake --build build --config ReleaseList built-in scenarios:
./build/cache_aware_scheduler --list-scenariosRun the baseline shared-cache simulation:
./build/cache_aware_scheduler --scenario demo --scheduler rms --policy sharedRun a cache-colored comparison and save the event trace:
./build/cache_aware_scheduler --scenario demo --scheduler rms --policy colored --trace-csv results/demo_trace.csvExport one-run summary CSV:
./build/cache_aware_scheduler --scenario stress --scheduler edf --policy partitioned --summary-csv results/stress_partitioned.csvdemo: three periodic tasks with partial color overlap and isolated partitionsharmonic: four harmonic tasks for scheduler and cache-policy comparisonstress: higher-interference task set that amplifies CRPDsched_compare: non-harmonic scheduler-comparison workload with zero deadline misses in the isolated partitioned baselinecrpd_peak: overloaded non-harmonic workload for worst-case CRPD and scheduler stress
- Jobs released and completed
- Deadline misses
- Preemptions
- Cache hits and misses
- Cross-task evictions
- Observed CRPD cycles
- Analytic CRPD bound
- Average and worst-case response time
Run the full sweep:
python3 scripts/run_experiments.pyGenerate plots:
python3 scripts/plot_results.pyExpected outputs from the main sweep and plotting commands:
results/experiment_results.csvresults/crpd_cycles.pngresults/deadline_misses.pngresults/cross_task_evictions.pngresults/max_response_time.png
Additional outputs from the sensitivity workflow in Additional Analysis:
results/cache_sensitivity.csvresults/cache_sensitivity_crpd.pngresults/cache_sensitivity_deadlines.pngresults/cache_sensitivity_response.png
- The simulator is discrete-time and deterministic.
- Each task job is represented as a sequence of memory accesses.
- Each access costs one cycle on a cache hit and
1 + miss_penaltycycles on a miss. - On preemption, the simulator snapshots the preempted task's resident cache lines.
- On resume, the simulator charges CRPD for lost lines and reloads them before normal execution continues.
partitionedassigns disjoint cache-set regions to tasks.coloredassigns shared color classes so some tasks still contend inside a color while avoiding full-cache interference.base_access_utilizationreports raw access demand only.isolated_cold_wcet_utilizationreports a conservative cold-start, no-interference WCET load estimate.- Pairwise CRPD attribution can be exported with
--pairwise-csvto identify which task caused reload cost for which victim. sched_compareis intended for scheduler comparison under cache interference with a clean zero-deadline-miss isolated partitioned baseline.crpd_peakis intentionally overloaded, so its deadline misses reflect both cache interference and infeasible demand.
Export pairwise attribution for one run:
./build/cache_aware_scheduler --scenario sched_compare --scheduler rms --policy shared --pairwise-csv results/sched_compare_pairwise.csv
python3 scripts/plot_pairwise.py results/sched_compare_pairwise.csv results/sched_compare_pairwise.pngExport a trace and render a timeline:
./build/cache_aware_scheduler --scenario sched_compare --scheduler rms --policy shared --trace-csv results/sched_compare_trace.csv
python3 scripts/plot_timeline.py results/sched_compare_trace.csv results/sched_compare_timeline.png --title "Sched Compare Shared Timeline"Run a miss-penalty sensitivity sweep:
python3 scripts/run_sensitivity.py
python3 scripts/plot_sensitivity.pyRun the built-in self-test:
./build/cache_aware_scheduler --self-testThe self-test checks that shared cache produces more interference than colored cache, colored produces more interference than partitioning on the demo scenario, partitioning eliminates observed CRPD there, and the sched_compare scenario has zero deadline misses in the partitioned baseline while still producing different RMS and EDF behavior.
- The simulator models one outstanding job per task and drops overrunning jobs when a new release arrives.
- Cache coloring is modeled through deterministic set-color mapping rather than a full MMU/page allocator.
- The analytic CRPD bound is conservative and intended for comparison, not formal proof.
- Project concept based on the CE8400 / ENGI9875 course brief.
- If AI assistance is used in the final submission, include a short disclosure statement in the report and README as required by the course policy.