HW#3, CSIT431 Introduction to Operating Systems

HW#3, CSIT431 Introduction to Operating Systems

<p> HW#3, CSIT431 Introduction to Operating Systems Spring 2002 SUNY at Fredonia, Fredonia, New York Maximum Marks 5 This is a Group Assignment; Use your project groups and submit it online at http://www.cs.fredonia.edu/~zubairi/submit_os.html</p><p>Assigned: 9th April Due: 16th April Q1. Using the IPC (Interprocess communication) available in Linux, develop software that implements a fully automated “hilo” game. In this game, you will use a random number generator, similar to the program shown below. You will configure the game as follows: (a) Two processes will run in parallel. Don’t use threads. One of them will “think” of a random number between 0 and 50. (b) The other process will “guess” the number, again in a randomized way and send it to the first process, using the IPC mechanism you choose. (c) The first process will increment the count of “trials”, show the guess and count of trials on the screen and match the guess with the key. If found correct, it will display “success in x trials” on the screen (where x is the number of trials) and bring the game to an end. Both processes should exit on the completion of the game. (d) If the number of “trials” exceeds 25, the game should be terminated. (e) Use C programming on pizza.cs.Fredonia.edu for your work and submit the source code display and run details online.</p><p>#include <stdio.h> #include <stdlib.h> #include <time.h></p><p> void main(void) { const int MAX_LIMIT=55;</p><p> int key;</p><p> srand( (unsigned)time( NULL ) ); key = rand()%MAX_LIMIT; printf("%d\n",key); } 3 Marks Q2. Prepare an interprocess communication model for a fast food restaurant by showing the processes and their synchronization mechanism. Write a pseudo code algorithm just like the one about the barbershop or dining philosophers. The following persons are involved in a fast food restaurant: Customer, Order-taker, Cook, Food packer and Cashier. 2 Marks</p>

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    1 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us