Files
agila-learning-examples/en/expanded-30-1/lesson-3/lesson.html
T

3 lines
1.4 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!doctype html><html lang="en"><meta charset="utf-8"><title>Affinity and migration</title><h1>Affinity and migration</h1><p>15-minute session: read for 3 minutes, trace for 3, experiment for 7, and complete the check for 2. Spend longer whenever you need.</p><p>CPU affinity restricts which logical CPUs a thread may run on. It can reduce migration or accidentally create contention. Pinning does not reserve a core from other workloads. Compare unpinned and pinned runs only on a machine where topology and policy are known. Record affinity, competing load, frequency behavior, and sample count. Do not change a production server’s scheduling policy for a lesson.</p><p><strong>Practice and evidence:</strong> Predict the example or draw its state transitions. Change one assumption, test the boundary, and record the actual result. Explain what this small model does not establish about a production system.</p><pre><code class="language-python">import os
print(sorted(os.sched_getaffinity(0)))
</code></pre><h3>Practice and evidence</h3><p>Keep three notes: your prediction, the actual result, and why they match or differ. The completion check grades understanding; the practice task builds skill.</p><p><a href="https://git.agilaos.com/matt/open_agx">Language reference: git.agilaos.com</a></p><p><a href="https://docs.nvidia.com/cuda/cuda-c-best-practices-guide/">Language reference: docs.nvidia.com</a></p></html>