COE128 Exam - 3 Flashcards
It is a basic unit of CPU utiilization
Thread
A thread is composed of:
- A Thread ID
- A Program Counter
- A Register Set
- A Stack
Benefits of Multithreading
- Responsiveness
- Resource Sharing
- Economy
- Scalability
Multithreading an interactive application may allow a program to continue running even if part of it is blocked or is performing a lengthy operation, thereby increasing responsiveness to the user
Responsiveness
Thread share the memory and the resources of the process to which they belong by default. The benefit of sharing code and data is that it allows an application to have several different threads of activity within the same address space
Resource Sharing
Allocating memory and resource for process creation is costly. Because threads share the resources of the process to which they belong, it is more economical to create and context-switch threads.
Economy
The benefits of multithreading can be greatly increased in a multiprocessor architecture, where threads may be running in parallel on different processors
Scalability
Types of Threads
- User Thread
- Kernel Thread
Supported above the kernel and are managed without kernel support
User Threads
Supported and managed directly by the operating system
Kernel Threads
Three (3) common ways of establishing relationship between user thread and kernel threads.
- Many-to-One Model
- One-to-One Model
- Many-to-Many Model
Thread management is done by the _________ in user space, so it is efficient
Thread Library
Disadvantages of Many-to-One Model
- The entire process will block if a thread makes a blocking system call.
- Because only one thread can access the kernel at a time, multiple threads are unable to run in parallel on the multiprocessor.
Disadvantages of One-to-One Model
- Creating a user thread requires creating the corresponding kernel thread.
- Number of threads per process is sometimes restricted due to overload.
When a thread performs a blocking system call, ___________________.
the kernel can schedule another thread for execution.