Paper 19592141

   

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 

Need your ASSIGNMENT done? Use our paper writing service to score better and meet your deadline.


Click Here to Make an Order Click Here to Hire a Writer