Lock revenue variable, Operating System

Assignment Help:

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");


Related Discussions:- Lock revenue variable

How several bits are there in the logical address, Q. Regard as a logical a...

Q. Regard as a logical address space of eight pages of 1024 words every mapped onto a physical memory of 32 frames. a. How several bits are there in the logical address? b. H

Lexical substitution during macro expansion, Lexical substitution during ma...

Lexical substitution during macro expansion Lexical substitution is employed to produce an assembly statement from a model statement. A model statement contains 3 types of stri

Peripharal device, 50 peripharal device name ,diagram and uses

50 peripharal device name ,diagram and uses

Define system call, Define System Call A system call is a request that ...

Define System Call A system call is a request that is made by any program to the operating system for carrying out tasks - picked from a predefined set - which the said program

Briefly explain about file system implementation, Briefly explain about fil...

Briefly explain about file system implementation? Several on-disk and in-memory structures are used to execute a file system. On disk, the file system may have information abou

Explain about interprocess communication, Explain about interprocess commun...

Explain about interprocess communication The cooperating processes communicate with each other via an interprocess communication facility. IPC gives a mechanism to permit proce

Compression regarding the file system in windows 2000, Write short note on ...

Write short note on compression regarding the file system in Windows 2000. NTFS is able to perform data compression on individual files or on all data files in a directory. To

Name the evolutionary process models, Normal 0 false false ...

Normal 0 false false false EN-IN X-NONE X-NONE MicrosoftInternetExplorer4

Shell scripting in both a windows and unix environment, Purpose This is...

Purpose This is intended to help you develop your understanding of shell scripting in both a Windows and Unix environment. Deliverables For both the first and second op

Explain multiprocessing operating system, Multiprocessing - An Operating S...

Multiprocessing - An Operating System proficient of utilizing and supporting more than one computer processor. Below are some instances of multiprocessing Operating Systems. Li

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd