1 / 10

Homework Assignment #2

Homework Assignment #2. Hsung-Pin Chang Department of Computer Science and Engineering National Chung Hsing University. Homework Assignment #2-1. In text book page no.227 page Exercise 6.8: The Sleeping-Barber Problem.

Download Presentation

Homework Assignment #2

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. Homework Assignment #2 Hsung-Pin Chang Department of Computer Science and Engineering National Chung Hsing University

  2. Homework Assignment #2-1 • In text book page no.227 page • Exercise 6.8: The Sleeping-Barber Problem. • Print all the messages corresponding to each customer and the barber’s behavior. NCHU System & Network Lab

  3. Homework Assignment #2-2 Semaphore-based solution NCHU System & Network Lab

  4. Homework Assignment #2-2 Implement a solution to the producer consumer problem using the producer and consumer processes shown in the previous slide. Create three producer threads and three consumer threads. The producer and the consumer threads share a buffer with four character slots. The producer thread will alternate between sleeping for a random period of time and inserting the uppercase alphabets in order into the buffer. The consumer also sleep for a random period of time and will attempt to remove an item from the buffer. The main()will sleep for a period of time and upon awakening, will terminate the application. NCHU System & Network Lab

  5. NCHU System & Network Lab

  6. NCHU System & Network Lab

  7. Turn In • The homework which you upload • Source code • Executing result (snapshot) NCHU System & Network Lab

  8. Turn In • Deadline : 2007/12/5 23:59 • Pack homework into a RAR file and upload to • ftp:// 140.120.15.117:1003 • ID: os96 PW: os96 • Filename format • ex: HW2_79556042_蘇榮柏.rar • If you want to update • ex: HW2_79556042_蘇榮柏v2.rar NCHU System & Network Lab

  9. Turn In • TA info. • Name • 蘇榮柏 甘惠文 邱顯泰 邱俊肇 • Lab • 系統與網路實驗室 1003A • E-mail (follow name sequence) • s9556042@cs.nchu.edu.tw • s9556043@cs.nchu.edu.tw • s9556045@cs.nchu.edu.tw • s9556048@cs.nchu.edu.tw NCHU System & Network Lab

  10. Turn In • No late work is acceptable • You get zero if you miss the due day • No cheat work is acceptable • You get zero if you copy other people’s version NCHU System & Network Lab

More Related