Embed presentation
Download to read offline
![int FUNCTION(unsigned int process_id) { task_t processes[MAX_PROCESSES]; task_
process = &processes[process_id]; unsigned int pagesfreed = 0 ; (...) (...) (...) } Complete the
above function (in C) to deallocate page table memory (page replacement) used by a process in
termination (e.g. due to a segmentation or protection fault). (Structs for Reference): task: int:
process_id, pagecount pde_t: "pagetable } task_t pte: unsigned int: is_frame_in_use, ref, dirty,
op, frame, page } pte_t pde: pte_t ptepage; } pde_t Hint: You can travel the page directory and
find allocated pages (stored in ptepage) for freeing.](https://image.slidesharecdn.com/intfunctionunsignedintprocessid-tasktprocesses-maxprocesse-230223182146-ea5e4298/85/int-FUNCTION-unsigned-int-process_id-task_t-processes-MAX_PROCESSE-docx-1-320.jpg)
The document outlines a C function designed to deallocate page table memory during the termination of a process due to issues such as segmentation or protection faults. It provides specific instructions and hints for finding and freeing allocated pages using the defined structures and variables. The goal is to complete the memory management function to ensure efficient resource utilization.
![int FUNCTION(unsigned int process_id) { task_t processes[MAX_PROCESSES]; task_
process = &processes[process_id]; unsigned int pagesfreed = 0 ; (...) (...) (...) } Complete the
above function (in C) to deallocate page table memory (page replacement) used by a process in
termination (e.g. due to a segmentation or protection fault). (Structs for Reference): task: int:
process_id, pagecount pde_t: "pagetable } task_t pte: unsigned int: is_frame_in_use, ref, dirty,
op, frame, page } pte_t pde: pte_t ptepage; } pde_t Hint: You can travel the page directory and
find allocated pages (stored in ptepage) for freeing.](https://image.slidesharecdn.com/intfunctionunsignedintprocessid-tasktprocesses-maxprocesse-230223182146-ea5e4298/85/int-FUNCTION-unsigned-int-process_id-task_t-processes-MAX_PROCESSE-docx-1-320.jpg)