

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!


1.1 Give a scenario in which a multi-threaded program might be slower than its single threaded equivalent, i.e. both programs do the same amount of work.
1.2 Give a scenario in which a multi-threaded program might be faster than its single threaded equivalent.
1.3 You just got a new job and your tasked with implementing a multi-threaded program. Your boss does not care about performance but wants the program to run on as many systems as possible. Of the three multi-threaded programming model we discussed in class, which do you choose and why?
For portability, the one-to-many (user-level) multithreading model will run on the most systems since it is implemented completely at user-level and does not require operating system support.
1.4 Your boss realized that he made a mistake (you thought you were smarter than him, any- way) and that 90% of his potential customers use the same operating system. He now wants you to implement the multi-threaded program to be as fast as possible without consideration for portability. Which model do you choose and why?
For best performance, the many-to-many multithreading model, while more com- plex, allows threads to run concurrently (on different resources) and one thread blocking for I/O or an event, does not impede other threads. I also accepted one-to-one: in this model one blocked thread does not impede others from making progress.
2.1 What are some issues to consider when choosing a scheduling policy? (You need at least four to earn full credit.)
2.2 In general, what is a multi-level feedback queue and how does it work?
A multi-level feedback queue is a scheduling mechanism that uses series of queues with each queue having successively lower priority than the preceeding queue. A job in a lower priority queue cannot run until there are no jobs in any queue with a higher priority. Each queue also has its own scheduling algorithm, and some policy is used to decide when to upgrade or downgrade a process to a higher or lower priority queue.
2.3 CPU-bound jobs need more CPU cycles than I/O-bound processes. Yet, many operating systems give I/O-bound higher CPU scheduling priority than CPU-bound jobs. Why? And are there valid reasons for giving CPU-bound jobs higher CPU scheduling priority than I/O-bound jobs.
I/O-bound jobs are typically given higher priority than CPU-bound jobs for two main reasons:
There are situations when you might want certain processes to have absolute pri- ority whether CPU-bound or I/O-bound, for example, important system processes. (Note: I graded this part of the question as a 2 point bonus.)