How nangsontay/osassignment-hk242 works
Main Components
• Kernel Core: The heart of the OS (src/os.c) that integrates the various services.
• Memory Management: This includes modules for memory allocation and paging (see include/mem.h, include/mm.h, src/mm.c, src/mm-vm.c, and src/mm-memphy.c). These files implement both low-level memory management and virtual memory/paging mechanisms.
• Scheduler: Files under include/sched.h and src/sched.c indicate that process or thread scheduling has been implemented.
• System Call Interface: Modules related to system calls (include/syscall.h, src/syscall.c, and syscall tables/scripts like src/syscall.tbl and src/syscalltbl.sh) handle interactions between user processes and the kernel.
• CPU Component: CPU simulation/manipulation is present in include/cpu.h and src/cpu.c to mimic CPU operations essential to an OS.
• Loader & Other Utilities: The loader (include/loader.h and src/loader.c) prepares the execution environment, while additional utilities such as queue handling (include/queue.h, src/queue.c) and a timer (include/timer.h, src/timer.c) handle auxiliary tasks within the OS kernel.
• Input/Output Test Cases: The various files within the input and output directories represent different test cases or simulation configurations (for example, mlq, paging, syscall tests, and various process and scheduler tests).
Relationships and Data Flows
• Memory management interacts with both the paging logic and process scheduling to manage per-process memory.
• The Scheduler coordinates with the CPU module to schedule tasks and may use queues to manage ready and blocked processes.
• The Loader initializes processes by interacting with memory management and CPU configuration.
• The Timer component often serves to trigger context switches in the scheduler and should be linked accordingly.
Architectural Patterns and Design Principles
• Modular Design: Each major OS component (memory, scheduler, CPU, system calls) is separated into its own source and header files, illustrating a modular approach.
• Clear Separation of Concerns: Notice how input configurations and expected outputs are separate from the OS logic, reinforcing clean boundaries between the operating system's simulation and its test harness.
• Simulation/Mapping of Real Hardware: Components such as CPU, Memory Management, and Paging are implemented to simulate hardware behavior, a common pattern in educational OS projects.
Elements
• Clear Labels: Name each component explicitly (e.g., “Kernel Core”, “Memory Management”, “Scheduler”, “System Call Interface”, “CPU Simulation”, “Loader”, “Timer Service”).
• Interdependency Lines: Clearly mark dependencies such as the scheduler’s interaction with both the CPU and queues, and how system calls interact with various subsystems (memory, scheduling, etc.).