90 likes | 322 Views
Homework Assignment #1. J. H. Wang Sep. 30, 2009. Homework #1. Chap.1: 1.22 Chap.2: 2.10 Chap.3: 3.5, 3.18* Chap.4: 4.6, 4.12* (Optional: End-of-chapter project for Chap.3 & 4) Due: two weeks ( Oct. 14, 2009 ). Chap.1
E N D
Homework Assignment #1 J. H. Wang Sep. 30, 2009
Homework #1 • Chap.1: 1.22 • Chap.2: 2.10 • Chap.3: 3.5, 3.18* • Chap.4: 4.6, 4.12* • (Optional: End-of-chapter project for Chap.3 & 4) • Due: two weeks (Oct. 14, 2009)
Chap.1 • 1.22: Describe the differences between symmetric and asymmetric multiprocessing. What are three advantages and one disadvantage of multiprocessor systems? • Chap.2 • 2.10: What is the main advantage of the layered approach to system design? What are the main disadvantages of using the layered approach? • Chap.3 • 3.5: Describe the actions taken by a kernel to context-switch between processes.
3.18*: Design a program using ordinary pipes in which one process send a string message to a second process, and the second process reverses the case of each character in the message and sends it back to the first process. For example, if the first process sends the message Hi There, the second process will return hI tHERE. This will require using two pipes, one for sending the original message from the first to the second process, and the other for sending the modified message from the second back to the first process. You may write this program using either UNIX or Windows pipes.
Chap.4 • 4.6: What are two differences between user-level threads and kernel-level threads? Under what circumstances is one type better than the other?
4.12*: The Fibonacci sequence is the series of numbers 0, 1, 1, 2, 3, 5, 8, … . Formally, it can be expressed as:fib0=0fib1=1fibn=fibn-1+fibn-2Write a multithreaded program that generates the Fibonacci sequence using either the Java, Pthread, or Win32 thread library. This program should work as follows: The user will enter on the command line the number of Fibonacci numbers that the program is to generate. The program will then create a separate thread that will generate the Fibonacci numbers, placing the sequence in data that can be shared by the threads (an array is probably the most convenient data structure). When the thread finishes execution, the parent thread will output the sequence generated by the child thread. Because the parent cannot begin outputting until the child finishes, this will require having the parent wait for the child thread to finish.
Homework Submission • For hand-written exercises, please hand in your homework in paper version in class • For programming exercises, please turn in your program code with compilation instructions via program submission site as follows: • URL: http://140.124.183.12/os/ • User account/Password: your student ID • Please change your password as soon as possible • Program uploading: including source codes and a compilation instruction if your program needs special environment or tool to compile or run • Please clearly name your program files using your ID
More on Optional End-of-Chapter Projects • Programming Project for Chap. 3: POSIX Message Passing • The message passing system • Creating the processes • Programming Project for Chap. 4: • 1. Naming service project • Server and client • 2. Matrix multiplication project • Passing parameters to each thread • Waiting for threads to complete