demonstrate that your program include the program


Demonstrate that your program (include the program output as part of the final report) can produce the correct output with the following parameters. For each case comment if the output agree with the given parameters.

Case a. factory_delay=1, retail_delay=2, warehouse_delay=3, max_product=2 and max_revenue=4.


Case b. factory_delay=2, retail_delay=1, warehouse_delay=3, max_product=3 and max_revenue=4.

Case c. factory_delay=1, retail_delay=3, warehouse_delay=2, max_product=3 and max_revenue=6.

Factory thread:
 
    printf("Factory thread starting.\n");
 
   while (1){
   
     // lock revenue variable and test for termination conditon
     if (revenue>=max_revenue){
  break;
  }
   
     if ((product0)){
       product++;
       parts--;
    revenue--;

         printf("Factory: manufacturing. | Parts=%d | Products=%d | Revenue=%d|\n",parts,product,revenue);
     }
     else{
       if (product>=max_products)
         printf("Factory: stock overflow! | Parts=%d | Products=%d | Revenue=%d |\n",parts,product,revenue);      
       else if (parts<1)
         printf("Factory: no parts! | Parts=%d | Products=%d | Revenue=%d |\n",parts,product,revenue);      
     }   
       
     // delay the thread according to factory_delay
     Sleep(factory_delay*1000);
   }
 
    printf("Factory thread terminating.\n");

Request for Solution File

Ask an Expert for Answer!!
Operating System: demonstrate that your program include the program
Reference No:- TGS0416932

Expected delivery within 24 Hours