{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Operating System Concepts, Seventh Edition

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
COMP 314 – Unit 2 Chapter 4 Overview o A thread is a basic unit of CPU utilization; it comprises a thread ID, a program counter, a register set, and a stack. (127) It shares with other threads belonging to the same process its code section, data section, and other OS resources, such as open files and signals. A traditional (or heavyweight) process has a single thread of control o Motivation Prior to threads, process creation was used as means of multitasking, with each task being given its own process. (128) This process-creation method is time consuming and resource intensive, as was shown in the previous chapter. If the process will generally perform all the same tasks as the existing, why incur the overhead? It is more efficient to use one process that contains multiple threads. o Benefits (129) Responsiveness Multithreading an interactive application may allow a program to continue running even if part of it is blocked or is performing a lengthy operation. Resource Sharing By default, threads share the memory and the resources of the process to which they belong. Allows several different threads of activity within the same address space. Economy Allocating memory and resources for process creation is costly. o It is much quicker to create and context switch threads. Utilization of Multiprocessor Architecture The benefits of multithreading can be greatly increased in a multiprocessor architecture, where threads may be running in parallel on different processors. Multithreading Models (129) o Support for threads may be provided either at the user level, for user threads, or by the kernel, for kernel threads. User threads are supported above the kernel and are managed without kernel support; Whereas kernel threads are supported and managed directly by the OS. o There are three common ways of establishing a relationship between user and kernel threads: Many-to-One Model Maps many user-level threads to one kernel thread. Thread management is done by the thread library in user space, so it is efficient; but the entire process will block if a thread makes a blocking system call. Also because only one thread can access the kernel at a time, multiple threads are unable to run in parallel on multiprocessors. Allows the developer to create as many user threads as she wishes, but true concurrency is not gained because the kernel can schedule only one thread at a time.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 4

COMP 314 - U2C4 - COMP 314 Unit 2 Chapter 4 Overview o A...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon bookmark
Ask a homework question - tutors are online