1 / 8

IPC and IPS Problems

IPC and IPS Problems. Jehan-François Pâris jfparis@uh.edu. Problem I: RPC. Consider the following C function void trans (int *from, int *to, double amount){ *from -= amount; *to += amount; } //trans. Problem I: RPC. What would happen if we execute trans (&bal, & bal, 5000.00); using

alair
Download Presentation

IPC and IPS Problems

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. IPC and IPS Problems Jehan-François Pârisjfparis@uh.edu

  2. Problem I: RPC • Consider the following C function • void trans (int *from, int *to, double amount){ *from -= amount; *to += amount;} //trans

  3. Problem I: RPC • What would happen if we executetrans (&bal, & bal, 5000.00);using • regular procedure calls ? • RPC calls?

  4. Problem I : RPC • We will have problems with RPC!

  5. Problem II: mutual exclusion • What is wrong with the following solution to the mutual exclusion problem? //Global arrayshared int wait[2] = {0, 1}; void enter(int pid) { // pid must be 0 or 1while (wait[pid]); } // enter_region void leave_region(int pid) { wait[pid] = 1;wait[1 – pid] = 0; } // leave_region

  6. Problem 3: monitors • A pizza oven has enough space inside for ten pizzas and a small opening through which a single cook can put a pizza in the oven and remove it when it is ready. Add the required pseudocode to the following monitor to ensure the smooth operation of the oven. (8×2 pts) • Class pizza_oven { private int npizzas; // pizzas in oven private condition not_empty; private condition not_full; • public void synchronized put_a_pizza() { __________________________________________ __________________________________________ put_a_pizza_in_the_oven(); __________________________________________ __________________________________________ } // put_a_pizza() • public void synchronized remove_a_pizza() { __________________________________________ __________________________________________ take_a_pizza_from_the_oven(); __________________________________________ __________________________________________ } // remove_a_pizza() • oven() { npizzas = 0; } // constructor} // Class oven

  7. Problem 3: monitors • Class pizza_oven { private int npizzas; // pizzas in oven private condition not_empty; private condition not_full; • public void synchronized put_a_pizza() { __________________________________________ __________________________________________ put_a_pizza_in_the_oven(); __________________________________________ __________________________________________ } // put_a_pizza() • public void synchronized remove_a_pizza() { __________________________________________ __________________________________________ take_a_pizza_from_the_oven(); __________________________________________ __________________________________________ } // remove_a_pizza() • oven() { npizzas = 0; } // constructor} // Class oven

  8. Problem 3: monitors • Pizan() { npizzas = 0; } // constructor} // Class oven

More Related