{ "$schema": "../../../tools/card-layouts/schemas/card-source.schema.json", "schema": "esc-card-source.v1", "card": { "id": "mpabi-freertos-cpp-06-allocator-resource", "series": "freertos-cpp", "series_title": "FreeRTOS C++", "number": "06", "count": "16", "slug": "allocator-resource", "title": "MemoryResource i FreeRtosAllocator", "topic": "Runtime-selected heap/arena, alignment, overflow-safe typed allocation i jawne failure", "project": "Freestanding C++ nad FreeRTOS", "subject": "Informatyka", "level": "Rok 2 · L05 · RV32I/Hazard3", "revision_date": "2026-07-19T00:00:00+02:00", "status": "Gotowa", "version": "v00.01", "uuid": "1af48a2e-8564-4e18-8115-b2c0208169d6", "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": "MemoryResource i FreeRtosAllocator", "repository_url": "https://zsl-gitea.mpabi.pl/edu-freertos-cpp/lab-rv32i-freertos-allocator-resource", "revision": "v00.01", "issued_on": "2026-07-19T00:00:00+02:00", "series": "FREERTOS-CPP-06", "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/1af48a2e-8564-4e18-8115-b2c0208169d6" }, "front_page_scope": { "title": "Cel karty", "content_tex": "Uczeń używa jednego typed allocatora nad heapem i areną, klasyfikuje adresy oraz dowodzi, że overflow i capacity failure nie zmieniają stanu storage.", "scope_title": "Zakres karty", "scope_content_tex": "Resource ma context i dwa function pointers, bez vtable. Arena jest monotoniczna i resetowana zbiorczo; karta nie deklaruje zgodności z hosted STL ani automatycznego czasu życia obiektów." }, "side_margin_tree_layout": { "columns": [ { "id": "zawodowe", "label": "TECH", "side": "left", "tree": "WE -> EK -> KW", "description": "Adresy, ABI, alignment i failure." }, { "id": "ogolne", "label": "OG", "side": "right", "tree": "WE -> EN -> KW", "description": "Kontrakty ownership i release policy." } ] }, "learning_effects": { "K06.EN01": { "bloom_level": "Analiza", "label": "Kontrakt zasobu", "text": "Uczeń wyjaśnia non-owning context, dispatch przez function pointers oraz różnicę heap free i arena reset.", "assessment_criteria": [ "K06.KW01" ] }, "K06.EK01": { "bloom_level": "Zastosowanie", "label": "Bezpieczna alokacja typowana", "text": "Uczeń implementuje guard count*sizeof(T), sprawdza alignment i dowodzi niezmienności po failure.", "assessment_criteria": [ "K06.KW01" ] } }, "assessment_criteria": { "K06.KW01": { "text": "Program kończy się PASS; resource ma trzy wskaźniki i brak vtable; adresy należą do ucHeap/.bss; overflow nie wywołuje providera; capacity failure nie zmienia storage; heap wraca do baseline, arena dopiero po reset.", "learning_effects": [ "K06.EN01", "K06.EK01" ] } }, "educational_requirements": { "K06.WE01": { "text": "Zaprojektowanie jawnego, fallible i runtime-selected źródła pamięci dla typów.", "label": "Resource i typed allocator", "learning_effects": [ "K06.EN01", "K06.EK01" ], "learning_tree": { "schema": "we-learning-tree.v1", "policy": "Każda alokacja ma jawny provider, alignment i wynik; reset wymaga granicy czasu życia.", "ogolne": [ { "effect_ref": "K06.EN01", "display": "EN LOCAL MEM.RESOURCE.01", "source": "LOCAL", "official": "MEM.RESOURCE", "local": "01", "kind": "EN", "tree_id": "K06.WE01.OG.LOCAL.MEM.RESOURCE.01", "text": "Analizuje ownership resource view i politykę release/reset.", "kw": [ { "criterion_ref": "K06.KW01", "display": "KW LOCAL MEM.RESOURCE.01", "source": "LOCAL", "kind": "KW", "official": "MEM.RESOURCE", "local": "01", "text": "Uzasadnia provider lifetime, arena no-op deallocate i zbiorczy reset." } ] } ], "zawodowe": [ { "effect_ref": "K06.EK01", "display": "EK LOCAL MEM.ALLOC.01", "source": "LOCAL", "official": "MEM.ALLOC", "local": "01", "kind": "EK", "tree_id": "K06.WE01.TECH.LOCAL.MEM.ALLOC.01", "text": "Bada typed allocation, adresy, alignment i failure state.", "kw": [ { "criterion_ref": "K06.KW01", "display": "KW LOCAL MEM.ALLOC.01", "source": "LOCAL", "kind": "KW", "official": "MEM.ALLOC", "local": "01", "text": "Pokazuje dwa storage domains, guard przed mnożeniem i niezmienione available/used." } ] } ] } } }, "sections": [ { "title": "Resource bez wirtualności", "content_kind": "prose", "content_tex": "Narysuj context oraz allocate/deallocate function pointers. Provider posiada stan, a MemoryResource jest nieposiadającym widokiem.", "educational_requirement_refs": [ "K06.WE01" ], "learning_effect_refs": [ "K06.EN01" ], "assessment_criterion_refs": [ "K06.KW01" ], "area_tree_refs": [ "K06.WE01.OG.LOCAL.MEM.RESOURCE.01" ], "steps": [ { "id": "S01", "title": "Zapisz context i dwa różne adresy funkcji allocate.", "tree_refs": [ "K06.WE01.OG.LOCAL.MEM.RESOURCE.01" ] }, { "id": "S02", "title": "Potwierdź brak vtable/typeinfo w ELF.", "tree_refs": [ "K06.WE01.OG.LOCAL.MEM.RESOURCE.01" ] } ] }, { "title": "Overflow-safe FreeRtosAllocator", "content_kind": "prose", "content_tex": "Sprawdź count > SIZE_MAX/sizeof(T) przed mnożeniem, potem przekaż bytes i alignof(T) do resource.", "educational_requirement_refs": [ "K06.WE01" ], "learning_effect_refs": [ "K06.EK01" ], "assessment_criterion_refs": [ "K06.KW01" ], "area_tree_refs": [ "K06.WE01.TECH.LOCAL.MEM.ALLOC.01" ], "steps": [ { "id": "S03", "title": "Uzupełnij guard i udowodnij brak wywołania providera przy overflow.", "tree_refs": [ "K06.WE01.TECH.LOCAL.MEM.ALLOC.01" ] }, { "id": "S04", "title": "Sprawdź niezmienione available/used po capacity failure.", "tree_refs": [ "K06.WE01.TECH.LOCAL.MEM.ALLOC.01" ] } ] }, { "title": "Heap kontra arena", "content_kind": "prose", "content_tex": "Przydziel po 16 uint32_t, sprawdź zakresy i alignment, a następnie porównaj natychmiastowy heap free z arena deallocate i reset.", "educational_requirement_refs": [ "K06.WE01" ], "learning_effect_refs": [ "K06.EN01", "K06.EK01" ], "assessment_criterion_refs": [ "K06.KW01" ], "area_tree_refs": [ "K06.WE01.TECH.LOCAL.MEM.ALLOC.01", "K06.WE01.OG.LOCAL.MEM.RESOURCE.01" ], "steps": [ { "id": "S05", "title": "Pokaż heap address w ucHeap i arena address w .bss.", "tree_refs": [ "K06.WE01.TECH.LOCAL.MEM.ALLOC.01" ] }, { "id": "S06", "title": "Pokaż arena used 64, 64, 0 po allocate/deallocate/reset.", "tree_refs": [ "K06.WE01.OG.LOCAL.MEM.RESOURCE.01" ] } ] } ], "tasks": { "task01": { "title": "Dwa zasoby, jeden typed allocator", "uuid": "1af48a2e-8564-4e18-8115-b2c0208169d6", "prompt_tex": "Uzupełnij guard overflow, uruchom identyczne alokacje z heapu i areny, a następnie udowodnij adresy, failure invariants oraz odmienne release policies.", "criterion": "Brak vtable; dwa aligned storage domains; overflow przed providerem; capacity failure bez zmiany storage; heap baseline; arena used 64/64/0; pass=1.", "educational_requirement_refs": [ "K06.WE01" ], "learning_effect_refs": [ "K06.EN01", "K06.EK01" ], "assessment_criterion_ref": "K06.KW01", "links": { "equations": [], "figures": [] } } }, "tasks_order": [ "task01" ] }