{ "$schema": "../../../tools/card-layouts/schemas/card-source.schema.json", "schema": "esc-card-source.v1", "card": { "id": "mpabi-freertos-cpp-09-kernel-facade", "series": "freertos-cpp", "series_title": "FreeRTOS C++", "number": "09", "count": "16", "slug": "kernel-facade", "title": "Scheduler Facade and Scoped Kernel Guards", "topic": "Statyczna fasada, this_task, critical section i scheduler suspend guard", "project": "Freestanding C++ nad FreeRTOS", "subject": "Informatyka", "level": "Rok 2 · L08 · RV32I/Hazard3", "revision_date": "2026-07-19T00:00:00+02:00", "status": "Gotowa", "version": "v00.01", "uuid": "6a2ab068-17e7-4bfa-b726-2df37787ed69", "author": "M. Pabiszczak", "year": "2026" }, "generated": { "tex": "doc/generated/main.tex", "html": "web/index.html", "html_css": "web/style.css", "html_tree_inspector": false, "react_app": true }, "template": "templates/karta-klasyczna.json", "title_block": { "category": "KARTA PRACY · INFORMATYKA", "prepared_by": "M. Pabiszczak", "prepared_on": "2026-07-19T00:00:00+02:00", "title": "Scheduler Facade and Scoped Kernel Guards", "repository_url": "https://zsl-gitea.mpabi.pl/edu-freertos-cpp/lab-rv32i-freertos-kernel-facade", "revision": "v00.01", "issued_on": "2026-07-19T00:00:00+02:00", "series": "FREERTOS-CPP-09", "document_type": "karta pracy", "tool": "card-layouts", "show_qr": false, "show_repository_qr": false, "height_cm": 2.6, "repeat_on_every_page": true, "replace_front_matter": true, "url": "https://dce7fb9d-7b2f-5d49-96a2-3a30d3070b84.mpabi.pl/6a2ab068-17e7-4bfa-b726-2df37787ed69" }, "front_page_scope": { "title": "Cel karty", "content_tex": "Uczeń rozdziela bezstanową usługę Scheduler od parowanych operacji, mierzy critical nesting i mstatus.MIE oraz dowodzi odtworzenia stanu na trzech wczesnych wyjściach.", "scope_title": "Zakres karty", "scope_content_tex": "Scheduler suspension nie maskuje przerwań i nie dopuszcza blokujących API. CriticalSection działa w task context, nie jest mutexem ani guardem ISR." }, "side_margin_tree_layout": { "columns": [ { "id": "zawodowe", "label": "TECH", "side": "left", "tree": "WE -> EK -> KW", "description": "Nesting, mstatus.MIE i assembly." }, { "id": "ogolne", "label": "OG", "side": "right", "tree": "WE -> EN -> KW", "description": "Lifetime, pairing i control flow." } ] }, "learning_effects": { "K09.EN01": { "bloom_level": "Analiza", "label": "Fasada kontra RAII", "text": "Uczeń dobiera statyczną fasadę dla usługi i guard RAII dla pary oraz analizuje trzy ścieżki return.", "assessment_criteria": [ "K09.KW01" ] }, "K09.EK01": { "bloom_level": "Zastosowanie", "label": "Stan kernela", "text": "Uczeń mierzy nesting, MIE i scheduler state oraz potwierdza inline wrapperów w ELF.", "assessment_criteria": [ "K09.KW01" ] } }, "assessment_criteria": { "K09.KW01": { "text": "Program kończy się PASS; critical depth ma sekwencję 0-1-2-1-0, MIE 1-0-0-0-1, suspension zachowuje MIE=1, oba guardy odtwarzają trzy early returns, a facade i guardy nie emitują symboli ani runtime C++.", "learning_effects": [ "K09.EN01", "K09.EK01" ] } }, "educational_requirements": { "K09.WE01": { "text": "Zaprojektowanie cienkiej fasady kernela i scope-bound par z dowodem odtworzenia stanu.", "label": "Kernel facade i guards", "learning_effects": [ "K09.EN01", "K09.EK01" ], "learning_tree": { "schema": "we-learning-tree.v1", "policy": "Każda para ma trzy ścieżki wyjścia, a każda różnica między suspension i critical ma odczyt stanu sprzętowego lub kernela.", "ogolne": [ { "effect_ref": "K09.EN01", "display": "EN LOCAL OOP.RAII.03", "source": "LOCAL", "official": "OOP.RAII", "local": "03", "kind": "EN", "tree_id": "K09.WE01.OG.LOCAL.OOP.RAII.03", "text": "Analizuje lifetime usługi, scope guarda i early-return control flow.", "kw": [ { "criterion_ref": "K09.KW01", "display": "KW LOCAL OOP.RAII.03", "source": "LOCAL", "kind": "KW", "official": "OOP.RAII", "local": "03", "text": "Uzasadnia statyczny Scheduler i dokładnie jedno restore na każdej ścieżce." } ] } ], "zawodowe": [ { "effect_ref": "K09.EK01", "display": "EK LOCAL RTOS.KERNEL.01", "source": "LOCAL", "official": "RTOS.KERNEL", "local": "01", "kind": "EK", "tree_id": "K09.WE01.TECH.LOCAL.RTOS.KERNEL.01", "text": "Śledzi critical nesting, MIE, scheduler state i wynik inliningu.", "kw": [ { "criterion_ref": "K09.KW01", "display": "KW LOCAL RTOS.KERNEL.01", "source": "LOCAL", "kind": "KW", "official": "RTOS.KERNEL", "local": "01", "text": "Pokazuje dokładne sekwencje, zachowanie IRQ podczas suspension oraz brak symboli wrappera." } ] } ] } } }, "sections": [ { "title": "Usługa kontra para", "content_kind": "prose", "content_tex": "Sklasyfikuj Scheduler start/state jako statyczną fasadę, a enter/exit i suspend/resume jako zakresowe pary.", "educational_requirement_refs": [ "K09.WE01" ], "learning_effect_refs": [ "K09.EN01" ], "assessment_criterion_refs": [ "K09.KW01" ], "area_tree_refs": [ "K09.WE01.OG.LOCAL.OOP.RAII.03" ], "steps": [ { "id": "S01", "title": "Uzasadnij brak konstruktora i destruktora Scheduler.", "tree_refs": [ "K09.WE01.OG.LOCAL.OOP.RAII.03" ] }, { "id": "S02", "title": "Napraw trzy early returns jednym guardem.", "tree_refs": [ "K09.WE01.OG.LOCAL.OOP.RAII.03" ] } ] }, { "title": "Critical nesting i mstatus.MIE", "content_kind": "prose", "content_tex": "Wykonaj raw enter/enter/exit/exit, a potem ten sam kontrakt przez CriticalSection. Zapisz depth i MIE na każdym checkpoint.", "educational_requirement_refs": [ "K09.WE01" ], "learning_effect_refs": [ "K09.EK01" ], "assessment_criterion_refs": [ "K09.KW01" ], "area_tree_refs": [ "K09.WE01.TECH.LOCAL.RTOS.KERNEL.01" ], "steps": [ { "id": "S03", "title": "Odtwórz 0-1-2-1-0 oraz 1-0-0-0-1.", "tree_refs": [ "K09.WE01.TECH.LOCAL.RTOS.KERNEL.01" ] }, { "id": "S04", "title": "Potwierdź depth 0 i MIE 1 po każdej ścieżce.", "tree_refs": [ "K09.WE01.TECH.LOCAL.RTOS.KERNEL.01" ] } ] }, { "title": "Scheduler suspension i this_task", "content_kind": "prose", "content_tex": "Zmierz running-suspended-running przy stale włączonym MIE, przetestuj nesting i zidentyfikuj bieżący handle, tick oraz yield.", "educational_requirement_refs": [ "K09.WE01" ], "learning_effect_refs": [ "K09.EK01" ], "assessment_criterion_refs": [ "K09.KW01" ], "area_tree_refs": [ "K09.WE01.TECH.LOCAL.RTOS.KERNEL.01" ], "steps": [ { "id": "S05", "title": "Pokaż MIE=1 podczas suspension i outer/inner nesting.", "tree_refs": [ "K09.WE01.TECH.LOCAL.RTOS.KERNEL.01" ] }, { "id": "S06", "title": "Porównaj this_task handle i sprawdź inline w ELF.", "tree_refs": [ "K09.WE01.TECH.LOCAL.RTOS.KERNEL.01" ] } ] } ], "tasks": { "task01": { "title": "Fasada kernela i restore na każdej ścieżce", "uuid": "6a2ab068-17e7-4bfa-b726-2df37787ed69", "prompt_tex": "Porównaj raw API z cienką fasadą i dwoma guardami, napraw trzy early returns oraz udowodnij nesting, MIE, scheduler state i inline assembly.", "criterion": "Critical 0-1-2-1-0/MIE 1-0-0-0-1; scheduler suspension MIE 1; all early returns restored; nested state correct; current handle equal; no wrapper symbols; pass=1.", "educational_requirement_refs": [ "K09.WE01" ], "learning_effect_refs": [ "K09.EN01", "K09.EK01" ], "assessment_criterion_ref": "K09.KW01", "links": { "equations": [], "figures": [] } } }, "tasks_order": [ "task01" ] }