Computers and Technology

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;

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 03:00, Jadaflournoy5
Check my work the microprocessor is a(n) circuit, which is designed to process data based on a set of instructions. most desktop and laptop devices contain a microprocessor based on the standard. most tablets and smartphones contain processors based on technology. a microprocessor's circuitry is designed to perform a limited number of tasks contained in its set. during processing, an instruction is loaded into the processor's unit. data is loaded into registers in the processor's where arithmetic and logic operations are performed. microprocessor performance can be measured by its speed. other factors affecting overall processing performance include word size, cache size, and instruction set complexity. most digital devices contain only one microprocessor chip, but today's multi- processors contain circuitry that supports parallel processing. computers contain various kinds of memory. random memory is a special holding area for data, program instructions, and the system. it stores data on a temporary basis until the processor makes a data request. ram is different from disk storage because it is , which means that it can hold data only when the computer power is turned on. computers also contain read- memory, which is a type of non-volatile memory that provides a set of "hard-wired" instructions, called the loader, that a computer uses to boot up.
Answers: 3
image
Computers and Technology, 24.06.2019 03:30, etxchrissy
What is the purpose of a computer network needs assessment? to analyze which workers need more training to improve their performance to compare worker productivity to determine what steps employees can take to increase company revenue to evaluate how to move from the current status to the desired goal
Answers: 2
image
Computers and Technology, 24.06.2019 11:20, isabelperez063
Every telecommunication setup uses two devices: one device to transmit data and one device to receive data. which device transmits frequencies to mobile phones? towers transmit frequencies to mobile phones.
Answers: 1
image
Computers and Technology, 24.06.2019 17:50, connorwbrown07
Acontact list is a place where you can store a specific contact with other associated information such as a phone number, email address, birthday, etc. write a program that first takes in word pairs that consist of a name and a phone number (both strings). that list is followed by a name, and your program should output that name's phone number.
Answers: 1
Do you know the correct answer?
For Sleeping Teaching Assistant Project can anyone solve using the format below please. Format:

Questions in other subjects: