Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The purpose of this project is to familiarize yourself with the design amd implementation issaes of a aser-level thread package on PC/Linux. You need to

image text in transcribed
image text in transcribed
The purpose of this project is to familiarize yourself with the design amd implementation issaes of a aser-level thread package on PC/Linux. You need to uue the tar command with the options xviz to uncompress and extract files from cts620s/pub/xt, tar . ge to your working directory. Part 1 The thread package which we discussed in the class is non-preemptiye. That is, a thread can run to completion unless it yields the controd to other threads. For the first part of this assignment. you need to make the threads preemptive. You can use signnl and ualara to provide a clock interrupt every 0.02 second. When the clock interrupt occurs, the interrupt handler suspends the current runaing thread asd finds a runnable thread to run. On PCA insx, you need sigenptyset, nigaddset, and sigproenask to unblock the SIGAL.RM signal to allow the next SIGAL.RM delivered. Add more comments to the soarce code. Part II You also need to enhance the thread library with the message passing mechanism in a file message, c. You have to implement the following three thread functions: - int xthread send (int tid, int msg): Assume that eich thread has a message box which can hold one positive integer value. The. function xthread send deposits a message msg to the message box of the thread tid. If the recipient thread is waiting the arrival of a message, x thread send changes it to the ready state. On success, x thread send returns 0 . On error, it returns - 1 if the thread t id does not exist or 2 if the message box is full. - int x thread-syneend(int tid, int msg); The function xthread synsend operates much like the function xthread.send except that it blocks the sender until the recipient thread receives the message. - int xthread recv ); The function xthread recv checks whether there is a message in the calling thread's message box. If yes, the message can be retumed. Otherwise, the calling thread has to wait until a message arrives. xthread recv also needs to move the waiting sender to the ready state if the sender calls the function xthread synsend to deposit a message. xthread asyrecy is non-blocking when it receives a message. It retums - I immediately if there - int xthread asyrecv(); is no message in the message box. Note that if the SIGALRM occurs during the execution of thread creation/completion, message passing, etc., the process table may lead to an inconsistent state (why? Give an example in your report). To solve this problem, you can use usec=ualarm(0,0);ualarm(usec,0); to disable the timer interrupt at the function entrance and restore it before the function returns. Turnin Each group (two students) has to submit your report and program electronically. You have to put your report file (i.e. report.pdf) under the xt dir. Before you submit, you need to use make clean to clean all of the object/executable files. Then, on grail, change the directory to the parent directory of the xt dir and use the following command to submit the whole xt dir: turnin -c cis620s -p proj2 xt Your report should include the description of your code, the thread state transition diagram, experiences in debugging and testing, the project status (working or not), etc. The cover page should contain your pictures, names and the login id you used to turnin the project. Start on time and good luck. If you have any questions, send e-mail to j sang@csuohio. edu

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

Handbook Of Database Security Applications And Trends

Authors: Michael Gertz, Sushil Jajodia

1st Edition

1441943056, 978-1441943057

Students also viewed these Databases questions

Question

find all matrices A (a) A = 13 (b) A + A = 213

Answered: 1 week ago