This repository houses my solutions to the assignments completed during the Operating Systems Course (CS330) in the 5th semester at IIT Kanpur under the guidance of Prof. Debadatta Mishra. The solutions presented here reflect the hands-on experience gained in implementing various critical aspects of operating systems, including memory management, system calls, and fault handling.
- Objective: Implement API functions for dynamic memory allocation and deallocation, along with a utility to recursively calculate the size of any directory or file, including symbolic links.
- Implementation Highlights:
- Developed a robust
memalloc()
andmemfree()
library, optimized to reduce memory fragmentation. - Implemented recursive directory size calculation, accounting for symbolic links.
- Developed a robust
- Objective: Extend GemOS to include trace buffer functionality (similar to
pipe()
functionality in UNIX), and implementstrace()
andftrace()
utilities - Implementation Highlights:
- Implemented the trace buffer functionality, supporting
create_pipe()
,read()
,write()
, andclose_pipe()
functionalities. - Developed
strace()
andftrace()
utilities to intercept and record system calls and function calls invoked by a process. - Integrated a fault handler to manage trace buffer overflows.
- Validated
write
andread
syscalls based on the read/write access permissions of code, data, heap, and stack segments.
- Implemented the trace buffer functionality, supporting
- Objective: Implement the
mmap()
,munmap()
, andmprotect()
system calls. Develop thecfork()
syscall using a Copy-on-Write (CoW) fault handler to support lazy memory allocation. - Implementation Highlights:
- Extended the GemOS codebase to include the
mmap()
,munmap()
, andmprotect()
system calls. - Implemented a
cfork()
system call triggered by page faults supporting lazy allocation.
- Extended the GemOS codebase to include the
- Object Files: For Assignments 2 and 3, object files for various components were provided. The task was to modify and implement specific files:
tracer.c
for Assignment 2 andv2p.c
for Assignment 3.