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 09:40
It is vital to research each of the services you plan to disable before implementing any change, especially on critical machines such as the: a. servers in the test environment. b. domain controller and other infrastructure servers. c. desktops that have previously been attacked. d. desktops used by upper-level management.
Answers: 2
question
Computers and Technology, 22.06.2019 10:40
5. illustrate how fine-line inventory classification can be used with product and market segments. what are the benefits and considerations when classifying inventory by product, market, and product/market?
Answers: 2
question
Computers and Technology, 23.06.2019 03:30
Many everyday occurrences can be represented as a binary bit. for example, a door is open or closed, the stove is on or off, and the fog is asleep or awake. could relationships be represented as a binary value? give example.
Answers: 1
question
Computers and Technology, 23.06.2019 06:00
What makes myhexadecimalnumber a child of mynumber? which methods does myhexadecimalnumber inherit directly from the mynumber class? what can an instance of the mynumber class do? what can an instance of the myhexadecimalnumber class do? which methods are overridden? why are they overridden? how many examples of overloading are there? why was this done? where is the super keyword used? what is it doing? why isn’t the incoming value set immediately in the second myhexadecimalnumber constructor? how many examples can you find of an inherited method being called?
Answers: 1
You know the right answer?
For Sleeping Teaching Assistant Project can anyone solve using the format below please. Format:
Questions
question
Social Studies, 01.11.2020 17:20
question
Biology, 01.11.2020 17:20
question
English, 01.11.2020 17:20
question
Mathematics, 01.11.2020 17:20
question
Chemistry, 01.11.2020 17:20