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

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 22:30
Which of the following factors would your hypothetical supervisor look at when deciding whether to test a biological material sample for dna? the amount of other evidence you have implicating a suspect in a crime the annual budget for the crime lab both of the above none of the above; you would almost always order a test
Answers: 3
question
Computers and Technology, 23.06.2019 02:00
In the context of an internet connection, llc stands for leased line connection liability limited company local loop complex local loop carrier
Answers: 1
question
Computers and Technology, 23.06.2019 02:30
Which component acts as a platform on which application software runs
Answers: 2
question
Computers and Technology, 23.06.2019 14:30
Select the correct answer. peter has launched a website that features baby products. however, clients often find they are unable to access the website because the server is down. which feature of cybersecurity should peter focus on for his website? a. data authenticity b. data privacy c. data availability d. data integrity e. data encryption
Answers: 3
You know the right answer?
For Sleeping Teaching Assistant Project can anyone solve using the format below please. Format:
Questions
question
Mathematics, 01.05.2021 05:00
question
Mathematics, 01.05.2021 05:00
question
Mathematics, 01.05.2021 05:00
Questions on the website: 13722366