subject

For Sleeping Teaching Assistant Project can anyone solve using the format below please. Format:
Main function
intmain(intargc, char *argv[]) {
// Initialize your variables
// Create TA threadsleep(1);
for(i=0;i sleep(1);
// Create students threads
}
for(j=0;j }
}
Semaphore wait() function
voidwait(intsema, intparam)
{
while(sema== 0) {}
if(param== 0)
printf("[SEMAPHORE] TA gets the lock!\n");
else
printf("[SEMAPHORE] Student %d gets the lock!\n",param);
sema--;
}
Semaphore signal() function
void signal(intsema, intparam)
{
if(param== 0)
printf("[SEMAPHORE] TA releases the lock!\n");
else
printf("[SEMAPHORE] Student %d releases the lock!\n",param);
sema++;
}
Thread sleepingta() function
void *sleepingta(void *param) {
// Wait & get the lock
printf("[TA THREAD] TA is in the office.\n");
// Release the lock
while(ENDOFPROGRAM) {
// Add your logic
}
// End thread
}
Thread student() function
void *student(void *param) {
// Wait & get the lockprintf("[STUDENT THREAD] Student %d is coming!\n",*(int*)param);
// Add your logic
// Release the lock
// End thread
}
Variables
#include
#include
#define SLEEP 0
#define WAKEUP 1
Int semaphore;
Int MAX, TA, TTL;
Int ENDOFPROGRAM;
Int curstudent;
Int waitinglist;

ansver
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 10:30, icantspeakengles
Aconstruction company is creating a powerpoint presentation describing how they calculate costs during each construction step. they plan to email this presentation to clients. the individual clients will be watching the presentation slide show on their own personal computers. what is the most important formatting step the company should take to make the text readable and pleasing to the eye?
Answers: 2
image
Computers and Technology, 24.06.2019 02:00, destinyd10189
Read the following scenario, and then answer the question below. you want to send an e-mail to your boss requesting a meeting to discuss a raise. what is the best example of an e-mail to an employer about this meeting? “hey jason. can we chat about getting me more money soon? let me know. peace, meg.” “hello jason. pardon me for sending yet another e-mail today about my need to talk to you about my position and a possible pay increase. i am dying to know when you can talk. sincerely, meg.” “hello jason. i have been with the company for one year and have taken on more responsibilities than outlined in my job description. i would appreciate an opportunity to speak with you about my position. let me know when we can schedule a meeting. you, meg.” “greetings jason! i hope this e-mail finds you well and happy today. i really, really want to talk to you about something important. i am not sure if you have time. i hope you do. get back in touch with me and let me know when we might talk. ever so much for taking the time to read this. sincerely, meg.”
Answers: 3
image
Computers and Technology, 24.06.2019 15:30, jerry1496
If you want to delete an entire word at a time, which key should you press along with the backspace or delete key?
Answers: 1
image
Computers and Technology, 24.06.2019 23:30, clairajogriggsk
What is the opening page of a website called? a. web page b. landing page c. homepage d. opening page
Answers: 1
You know the right answer?
For Sleeping Teaching Assistant Project can anyone solve using the format below please. Format:

Questions in other subjects:

Konu
Mathematics, 16.07.2019 11:00