Highlights
The purpose of this project is to familiarize yourself with the design and implementation issues of a user- level thread package on PC/Linux. You need to use the tar command with the options xvfz to uncompress and extract files from ~cis620s/pub/xt.tar.gz to your working directory.
Part I
The thread package which we discussed in the class is non-preemptive. That is, a thread can run to comple- tion unless it yields the control to other threads. For the first part of this assignment, you need to make the threads preemptive. You can use signal and ualarm to provide a clock interrupt every 0.01 second. When the clock interrupt occurs, the interrupt handler suspends the current running thread and finds a runnable thread to run. On PC/Linux, you need sigemptyset, sigaddset, and sigprocmask to unblock the SIGALRM signal to allow the next SIGALRM delivered. Add more comments to the source code.
Part II
You also need to enhance the thread library with the message passing mechanism. The mailboxes are declared as variables with a data type xthread mbox t. Each message box can hold only one positive integer value. It also has a queue of threads waiting for a message.
You have to implement the following four thread functions:
• int xthread init mbox(xthread mbox t *mptr);
The mailbox pointed by mptr is initialized when xthread init mbox() is invoked. That is, no message is in the mailbox and the waiting queue in the mailbox is empty.
• int xthread send(xthread mbox t *mptr, int msg);
The function xthread send deposits a message msg to the mailbox pointed by mptr. If there is a thread waiting for a message, xthread send changes the thread to the ready state and delivers the message to it. On success, xthread send returns 0. On error, it returns -1 if the mailbox is full.
• int xthread broadcast(xthread mbox t *mptr, int msg);
The function xthread broadcast operates much like the function xthread send except that all of the threads waiting in the queue will be unblocked and get the message msg.
• void xthread recv(xthread mbox t *mptr, int *msgptr);
The function xthread recv checks whether there is a message in the mailbox pointed by mptr. If yes, the message can be delivered to the location pointed by msgptr. Otherwise, the calling thread has to wait until a message arrives.
Turnin
Each group (at most 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
This CIS620 - IT Assignment has been solved by our IT Experts at My Uni Paper. Our Assignment Writing Experts are efficient to provide a fresh solution to this question. We are serving more than 10000+ Students in Australia, UK & US by helping them to score HD in their academics. Our Experts are well trained to follow all marking rubrics & referencing style.
Be it a used or new solution, the quality of the work submitted by our assignment experts remains unhampered. You may continue to expect the same or even better quality with the used and new assignment solution files respectively. There’s one thing to be noticed that you could choose one between the two and acquire an HD either way. You could choose a new assignment solution file to get yourself an exclusive, plagiarism (with free Turnitin file), expert quality assignment or order an old solution file that was considered worthy of the highest distinction.
© Copyright 2026 My Uni Papers – Student Hustle Made Hassle Free. All rights reserved.