
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

Objective : Experiment with differences between creating processes and creating threads in Linux.
Assignment (Due Monday, January 21): Write two programs in C that generate the Fibonacci sequence of length n where n is (a natural number) given as input. In the first program, the sequence is generated in a new process; in the second the sequence is generated in a new thread. Please look at Exercises 3.6 (page
You are given a sample source code (fib.c) of a program that calculates the n th^ -Fibonacci number. You are not required to use this sample code, if you prefer to write your own.
You are required to generate a set of experiments that investigate the difference in overhead between threads and processes for the purpose of generating Fibonacci numbers. Ideas to try:
The output should look something like this:
alagor@supernova:~/temp$ ./fib-fork 10 3 Answer: 55 /fib 10 process/thread nr.1/ Answer: 89 /fib 11 process/thread nr.2/ Answer: 144 /fib 12 process/thread nr.3/
To time your programs, you can use the time command or other available timing tools.
Deliverables:
This is an individual assignment. Your source code must compile on one of the C4 Lab PC’s (c4labpc11.csee.usf.edu thru c4labpc29.csee.usf.edu). Although you can use any Linux environment to write your programs, make sure you test your solution on one of these machines before submitting.