Presentation is loading. Please wait.

Presentation is loading. Please wait.

Homework Assignment #1 J. H. Wang Oct. 13, 2010. Homework #1 Chap.1: 1.24 Chap.2: 2.13 Chap.3: 3.5, 3.13* (or 3.14*) Chap.4: 4.6, 4.12* –(*: optional.

Similar presentations


Presentation on theme: "Homework Assignment #1 J. H. Wang Oct. 13, 2010. Homework #1 Chap.1: 1.24 Chap.2: 2.13 Chap.3: 3.5, 3.13* (or 3.14*) Chap.4: 4.6, 4.12* –(*: optional."— Presentation transcript:

1 Homework Assignment #1 J. H. Wang Oct. 13, 2010

2 Homework #1 Chap.1: 1.24 Chap.2: 2.13 Chap.3: 3.5, 3.13* (or 3.14*) Chap.4: 4.6, 4.12* –(*: optional programming exercises) –(Optional: End-of-chapter project for Chap.3 & 4) Due: two weeks (Oct. 27, 2010)

3 Chap.1 –1.24: What is the purpose of interrupts? What are the differences between a trap and an interrupt? Can traps be generated intentionally by a user program? If so, for what purpose?

4 Chap. 2 –2.13: What is the main advantage of the microkernel approach to system design? How do user program and system services interact in a microkernel architecture? What are the disadvantages of using the microkernel approach?

5 Chap. 3 –3.5: Describe the actions taken by a kernel to context-switch between processes.

6 –*3.13: The Fibonacci sequence is the series of numbers 0, 1, 1, 2, 3, 5, 8, …. Formally, it can be expressed as: fib 0 =0 fib 1 =1 fib n =fib n-1 +fib n-2 Write a C program using the fork() system call that generates the Fibonacci sequence in the child process. The number of the sequence will be provided in the command line. For example, if 5 is provided, the first five numbers in the Fibonacci sequence will be output by the child process. Because the parent and child processes have their own copies of the data, it will be necessary for the child to output the sequence. Have the parent invoke the wait() call to wait for the child process to complete before exiting the program. Perform necessary error checking to ensure that a non-negative number is passed on the command line.

7 –(3.14*): Repeat the exercise in 3.13, this time using the CreateProcess() in the Win32 API. In this instance, you will need to specify a separate program to be invoked from CreateProcess(). It is this separate program that will run as a child process outputting the Fibonacci sequence. Perform necessary error checking to ensure that a non-negative number is passed on the command line.

8 Chap. 4 –4.6: What are the differences between user- level threads and kernel-level threads? Under what circumstances is one type better than the other?

9 –*4.12: The Fibonacci sequence is the series of numbers 0, 1, 1, 2, 3, 5, 8, …. Formally, it can be expressed as: fib 0 =0 fib 1 =1 fib n =fib n-1 +fib n-2 Write 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.

10 Homework Submission For hand-written exercises, please hand in your homework in A4 papers 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.39/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

11 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

12 Thanks for Your Attention!


Download ppt "Homework Assignment #1 J. H. Wang Oct. 13, 2010. Homework #1 Chap.1: 1.24 Chap.2: 2.13 Chap.3: 3.5, 3.13* (or 3.14*) Chap.4: 4.6, 4.12* –(*: optional."

Similar presentations


Ads by Google