Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

In this RTOS program below, how many threads are running? a. 4 b. 5 c. 2 d. 3 in

ID: 3834186 • Letter: I

Question


In this RTOS program below, how many threads are running? a. 4 b. 5 c. 2 d. 3 int count = 0; char in; void outputThread (void) {while (1) {if (in i = 0) putc(in); Thread wait (100);}} void input Thread (void) {while(1){in = getc() if(in ==) Thread wait (100);}} void print Thread (void) {while (n! = 0){printf("input is % c at %d", in, count); Thread::wait (100);}} void main (void) {Thread inputThread (osPriorityHigh, DEFAULT_STACK_SIZE, NULL); Thread outputhread (osPriorityNormal, DEFAULT_STACK_SIZE, NULL); inputThread.start (USBInput) outputhread.start(showUser); while (1) {count++; wait (1000);}}

Explanation / Answer

void main(void)
{
    Thread inputThread(...);   //A thread has been created.
    Thread outputThread(...);   //A thread has been created.
   
    inputThread.start(...);   //This thread has been initialized to run.
    outputThread.start(...);   //This thread has been initialized to run.
    ...
}
So, in this code, only 2 threads are running.
The answer is: a. 2.