Operating Systems

Topics: Thread, Process, Context switch Pages: 4 (1251 words) Published: May 25, 2013
Operating Systems
Assignment #5
Chapter 4
Eighth Edition of Operating System Concepts
Avi Silberschatz
Peter Baer Galvin
Greg Gagne 2009

4.1 Provide two programming examples in which multithreading does not provide better performance than a single-threaded solution Answer: (1) Any kind of sequential program is not a good candidate to be threaded. An example of this is a program that calculates an individual tax return. (2) Another example is a "shell" program such as the C-shell or Korn shell. Such a program must closely monitor its own working space such as open files, environment variables, and current working directory.

4.2 Describe the actions taken by a thread library to context switch between user-level threads. Answer: Context switching between user threads is quite similar to switching between kernel threads, although it is dependent on the threads library and how it maps user threads to kernel threads. In general, context switching between user threads involves taking a user thread of its LWP and replacing it with another thread. This act typically involves saving and restoring the state of the registers.

4.3 Under what circumstances does a multithreaded solution using multiple kernel threads provide better performance than a single-threaded solution on a single-processor system? Answer: When a kernel thread suffers a page fault, another kernel thread can be switched in to use the interleaving time in a useful manner. A single-threaded process, on the other hand, will not be capable of performing useful work when a page fault takes place. Therefore, in scenarios where a program might suffer from frequent page faults or has to wait for other system events, a multi-threaded solution would perform better even on a single-processor system. 4.4 Which of the following components of program state are shared across threads in a multithreaded process? a. Register values

b. Heap memory
c. Global variables
d. Stack memory...
Continue Reading

Please join StudyMode to read the full document

You May Also Find These Documents Helpful

  • U02a1 Operating System Upgrade Plan Essay
  • operating systems Essay
  • Essay about Operating Systems
  • Essay about Operating System
  • Essay on Operating System
  • Operating System Essay
  • Essay about Operating System
  • Operating Systems Essay

Become a StudyMode Member

Sign Up - It's Free