Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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,

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 dened by the user level thread library, can be used on systems that have no kernel-level thread support, thread switching is as effcient as function calls, but the kernel knows nothing about them so any blocking affects all threads.

2.Problem statement You will implement a simplied version of many-to-one user level threads in the form of a library called Simple Threads. 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 problem, 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 getcontext setcontext makecontext swapcontext 2.1.2 Timers In order to implement preemptive scheduling, you will need to set a timer and register a timer handler that will act as the thread scheduler for your library. You will figure out how to suspend the running thread and resume a thread from the ready queue.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Fundamentals Of Database Management Systems

Authors: Mark L. Gillenson

3rd Edition

978-1119907466

More Books

Students also viewed these Databases questions

Question

Determine miller indices of plane A Z a/2 X a/2 a/2 Y

Answered: 1 week ago

Question

How do todays organizations diff er from those of earlier eras?

Answered: 1 week ago