1 Overview
A thread library provides an API for creating and managing threads. Support for threads is provided either at user-level or by the kernel, depending on the goals of the end-product. Kernel level threads are managed directly by the operating system, where each thread is viewed as an independent task, managed via system calls from user space, scheduled by the kernel, and good for applications that frequently block. User level threads, on the other hand, are managed without kernel support, are defined by the user level thread library, can be used on systems that have no kernel-level thread support, thread switching is as efficient as function calls, but the kernel knows nothing about them so any blocking affects all threads.
2 Assignment
You will implement a simplified version of many-to-one user level threads in the form of a library called Simple Threads. (Credit for the example code and some of the assignment parameters goes to the Operating Systems Course from Uppsala University .)
In the many-to-one model for user level threads, all threads execute on the same kernel thread. As there is only one kernel-level thread associated with the process (the process containing threads is represented by a single context within the kernel), only one user-level thread may run at a time.
The thread manager you will include a preemptive round-robin scheduler. If a thread does not yield during its time-slice, it will be preempted and one of the other ready threads will be resumed. The preempted and resumed threads should change state accordingly.
2.1 Preliminaries
To complete this assignment, there are two necessary concepts you must master: managing execution contexts and signal handlers. Examples are given for both for you to examine and reuse.
∗http://www.it.uu.se/education/course/homepage/os/vt18/module-4/simple-threads/
2.1.1 Execution Contexts
The example code that will be the starting point for grasping execution context management is in the contexts.c source file. To understand the code, read the following manual pages:
• getcontext
• setcontext
• makecontext
• swapcontext
Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.
You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.
Read moreEach paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.
Read moreThanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.
Read moreYour email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.
Read moreBy sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.
Read more