---
id: "{{ID}}"
title: "{{TITLE}}"
type: "SCIENCE_LAB"
created_by: "Curriculum OS Builder"
phase: "{{PHASE}}"
deliverable: "P3-T13"
version: "{{VERSION}}"
date: "{{DATE}}"
template_contract: "artifact-template-v1"
template_required_sections:
  - "Guiding Inquiry & Driving Question"
  - "Hypothesis & Experimental Design"
  - "Controlled Variables:"
  - "Data Collection & Code Lab Protocol"
  - "Lab Setup & Instrumentation Code:"
  - "Data Collection Table:"
  - "CER Scientific Conclusion (Claim, Evidence, Reasoning)"
  - "📌 Claim (Khẳng định):"
  - "📊 Evidence (Bằng chứng số liệu):"
  - "🧠 Reasoning (Lập luận khoa học):"
  - "Peer Review & Verification Protocol"
---
<!-- INJECT_BODY -->

# STEM / CODE INVESTIGATION LAB (CER): [LAB TITLE]
_Unit: U[X] | Module: M[X.X] | Domain: [Scientific / Engineering Domain]_

## Guiding Inquiry & Driving Question
- **Real-World Driving Question:** [E.g., "How does thread contention affect application frame rate (FPS) and memory throughput under heavy load?"]
- **Engineering Phenomenon:** [E.g., "When two tasks write to the same mutable array simultaneously, why does the program crash intermittently rather than every single run?"]

---

## Hypothesis & Experimental Design
- **Student Hypothesis Template:**  
  > *"If we [Action / Variable Manipulation, e.g., 'isolate the shared mutable resource inside an Actor instead of using a global lock'], then [Predicted Outcome, e.g., 'data races will drop to zero and UI thread latency will remain under 16ms'] because [Scientific / Engineering Rationale]."*

### Controlled Variables:
- **Independent Variable (Manipulated):** [E.g., Number of concurrent tasks: 1, 10, 100, 1000].
- **Dependent Variable (Measured):** [E.g., Execution time (ms), Data Race crash count, CPU core utilization (%)].
- **Control Variables (Constant):** [E.g., Device hardware, input data size, operating system version].

---

## Data Collection & Code Lab Protocol

### Lab Setup & Instrumentation Code:
```swift
// Benchmark / Probe harness provided to students
import Foundation

struct BenchmarkProbe {
    static func runExperiment(iterations: Int, concurrencyLevel: Int) async -> ExperimentResult {
        // Probe execution harness measuring latency and memory
    }
}
```

### Data Collection Table:
| Trial | Concurrency Level | Memory Usage (MB) | Execution Latency (ms) | Anomaly / Error Count |
| :---: | :---: | :---: | :---: | :---: |
| 1 | 1 Task | | | |
| 2 | 10 Concurrent Tasks | | | |
| 3 | 100 Concurrent Tasks | | | |
| 4 | 1,000 Concurrent Tasks | | | |

---

## CER Scientific Conclusion (Claim, Evidence, Reasoning)
> *Students must write their conclusion strictly following the 3-part CER framework:*

### 1. 📌 Claim (Khẳng định):
- *Direct answer to the driving question in 1 concise sentence:*  
  ```text
  [E.g., "Actor-based state isolation completely eliminates data race crashes while maintaining sub-16ms latency up to 500 concurrent operations."]
  ```

### 2. 📊 Evidence (Bằng chứng số liệu):
- *Specific quantitative data points cited directly from the Data Collection Table:*  
  ```text
  [E.g., "In Trial 3 with 100 concurrent tasks, the unprotected array crashed 4 out of 5 times, whereas the Actor implementation completed with 0 errors in an average of 12.4ms."]
  ```

### 3. 🧠 Reasoning (Lập luận khoa học):
- *Connect the evidence back to the underlying technical principle:*  
  ```text
  [E.g., "This occurs because the Actor mailbox serializes incoming asynchronous message invocations via cooperative multitasking on the dispatch pool, ensuring that only one thread can mutate internal state at any given CPU tick."]
  ```

---

## Peer Review & Verification Protocol
- **Reproducibility Test:** Exchange code probes with another student group to verify if their experimental results match within a $\pm 10\%$ tolerance band.
