Explain how the kernel data structures, such as `task_struct`, `mm_struct`, and `vm_area_struct`, are updated during the `execve()` system call. What role do these structures play in process context replacement?
The task_struct is updated with the new executable information. This includes resetting the program counter to the entry point of the new executable and updating other state information.
Signal handlers are reset to their default actions, unless explicitly preserved.
During exec, it is updated to reflect new executable which includes resetting the program counter, updating memory management structures, and resetting signal handlers.
mm_struct:
The mm_struct is updated to reflect the new memory layout. This includes creating new vm_area_struct entries for the process context.
vm_area_struct:
Each memory segment is represented by a new 'vm_area_struct' entry which describes the start and the end address, permissions and other attributes of the memory region. These entries are linked into the mm_struct to describe the complete address space of the process.