A Preemptive User-Level Threads Package

This project was completed during my study of Operating Systems. I implemented a user-level threads package in C which included maintaining thread contexts, saving and restoring those contexts, and being able to modify contexts to allow thread creation, switching, and running. Additionally, the package has the functionality to preempt threads with interrupts which were simulated and tested using timer interrupts. For this, I used thread blocking, locks for mutual exclusion, and condition variables for synchronization.

These functions allowed threads to preempt others, sleep/block on threads and wakeup when possible, and ensured that the master thread only exited once all other spawned threads had been exited.

This project demonstrated my understanding of multithreading on operating systems, and the distinction between the types of threads and how they are scheduled on an OS. Furthermore, it displays my excellence in the C programming language and memory management.