CS 631-01 Systems Foundations — Meeting Summary¶
- Date: May 14, 2026
- Time: 08:12 AM Pacific Time (US and Canada)
- Meeting ID: 870 0988 0761
Quick Recap¶
The lecture focused on how system calls—particularly fork, exec, and wait—work in the Octux operating system, emphasizing the role of page tables in process management. Greg provided a detailed walkthrough of: - The fork system call: creating new page tables, copying memory between parent and child, and setting up trap frames for correct context switching. - The exec system call: reusing the process control block (PCB) while loading a new executable into a fresh user virtual address space. - Project 6: implementing a tracking system using two new system calls—sysTrackSelf and sysTrackWait—to collect metrics on system calls, memory usage, and page table structures, with results copied from kernel to user space via copy-out operations.
Key Topics Covered¶
- Custom wait system call design for Project 6
- Context switching and process forking mechanics
- Trap frame allocation and user address space layout
- Virtual memory mapping (page tables, PTEs, L0/L1 tables)
- Executable loading and process startup
- TRAC process tracking system (sysTrackSelf, sysTrackWait)
Detailed Notes¶
Custom Wait System Call Implementation¶
- A custom wait system call will collect metric data and copy it into the user virtual address space.
- In a typical flow, a parent process (TRAC) forks and then waits for the child process to complete using the new track-wait system call.
- Forking creates a new process by:
- Allocating a process from the PROC table.
- Copying user pages into new page frames for the child.
- Preparing the child’s execution context (including trap frames and FDs).
Context Switching and Process Forking¶
- System calls transition from user mode to kernel mode but continue executing in the context of the originating process until scheduling changes occur.
- The fork sequence includes:
- Finding an unused, pre-allocated PROC structure (via the alloc function).
- Allocating and initializing the child process.
- Copying memory, trap frames, and the file descriptor table from parent to child.
Trap Frame Allocation Process¶
- Steps for preparing a new process:
- Obtain a new PID and mark the process state as “used.”
- Allocate a trap frame in the user virtual address space.
- Set up the user address space layout, including stack placement and guard pages. Note: XD6’s stack arrangement is unconventional relative to typical operating systems.
- Create a new user page table and map the trampoline code using the map pages function.
Virtual Memory Mapping Overview¶
- During fork and exec:
- Page tables are allocated and modified (including creation of L0 and L1 tables).
- PTEs map virtual addresses to physical memory.
- Memory is copied from parent to child, including page contents and relevant process metadata (e.g., file descriptors).
- Exec reuses the PCB but constructs a new user virtual address space populated with the target executable.
Process Loading and System Calls¶
- Loading a new executable includes:
- Allocating stack pages.
- Populating argument and environment vectors.
- Initializing the trap frame to start execution at main.
- The wait system call:
- Searches for exited child processes.
- Allows a parent to block until a child exits.
- Uses sleep/wake mechanisms for synchronization.
TRAC Process Tracking System¶
- TRAC introduces two system calls:
- sysTrackSelf: enables tracking for the current (child) process.
- sysTrackWait: collects metrics after the process completes.
- Metrics include:
- System call counts
- Read/write byte totals
- Memory classification
- Page table counts
- Implementation details:
- Use WAP and page table walks to classify memory and count page tables.
- Copy collected metrics from kernel to user space via copy-out operations when the process finishes.
Next Steps¶
- No next steps were generated due to insufficient transcript.