• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/10

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

10 Cards in this Set

  • Front
  • Back
Multithreading refers to the ability of the OS to support multiple threads of execution within a single process. The traditional single threaded approach contained a single thread, or instruction trace, per process
Multithreading refers to the ability of the OS to support multiple threads of execution within a single process. The traditional single threaded approach contained a single thread, or instruction trace, per process
In the single threaded process model, the representation of a process includes its PCB, user address space and user and kernel stacks. In the multithreaded process model, there is still a single PCB and user address space, but also separate xxxxx for each thread, and a separate thread xxxxxx block
In the single threaded process model, the representation of a process includes its PCB, user address space and user and kernel stacks. In the multithreaded process model, there is still a single PCB and user address space, but also separate stacks for each thread, and a separate thread control block
Thus, threads share the state and resources of that process. They reside in the same address space and have access to the same data, so that if one thread opens a file for reading, other threads in that process can also access that file
Thus, threads share the state and resources of that process. They reside in the same address space and have access to the same data, so that if one thread opens a file for reading, other threads in that process can also access that file
Advantages of Threads
Give me some
It takes far less time to create a new thread in an existing process than to create a new process (in Solaris 2, the speed up factor is about 30).
It takes less time to terminate an existing thread, or to switch between two threads within the same process
Threads can communicate more efficiently. If two processes wish to communicate, they must use the kernel to do so, whereas threads do not need to invoke the kernel.
A program may continue to run, even if part of it is blocked or is doing a complex operation,"", thus increasing responsiveness to the user.
Multiprocessor architectures can be utilised more efficiently, with each thread running concurrently on a different CPU.
User level threads (ULTs) are implemented by a thread library at the user level.
This library provides support for thread creation, scheduling and management with no support from the kxxxxx (which is not aware of their existence).
They are generally fast to create and manage, however if the kernel is single threaded, then any user level thread performing a blocking system call will cause the entire process to block, even if other threads are available to run within the application.
Examples of thread libraries are ?OSIX ?threads and Solaris 2 UI-threads.
User level threads (ULTs) are implemented by a thread library at the user level.
This library provides support for thread creation, scheduling and management with no support from the kernel (which is not aware of their existence).
They are generally fast to create and manage, however if the kernel is single threaded, then any user level thread performing a blocking system call will cause the entire process to block, even if other threads are available to run within the application.
Examples of thread libraries are POSIX Pthreads and Solaris 2 UI-threads.
Kernel level threads (KLTs) (also called xxxxxweight processes) are supported directly by the OS.
The user level contains only an API to the kernel thread facility
This makes them xxxxxx to manipulate than user threads.
The kernel can schedule another thread for execution if one thread issues a blocking system call.
Most OSs (eg. Windows NT, Solaris 2) support KLTs
Kernel level threads (KLTs) (also called lightweight processes) are supported directly by the OS.
The user level contains only an API to the kernel thread facility
This makes them slower to manipulate than user threads.
The kernel can schedule another thread for execution if one thread issues a blocking system call.
Most OSs (eg. Windows NT, Solaris 2) support KLTs
An application begins with a single thread and begins running that thread. This application and it’s thread are allocated to a single process managed by the kernel
While the application is running, it may spawn a new thread to run within the same process (spawning is a library utility).
The library creates a data structure for the new thread and passes control to one of the threads within this process using some scheduling algorithm.
The kernel is unaware of this activity. It continues to schedule the process as a unit and assigns a single execution state to that process
An application begins with a single thread and begins running that thread. This application and it’s thread are allocated to a single process managed by the kernel
While the application is running, it may spawn a new thread to run within the same process (spawning is a library utility).
The library creates a data structure for the new thread and passes control to one of the threads within this process using some scheduling algorithm.
The kernel is unaware of this activity. It continues to schedule the process as a unit and assigns a single execution state to that process
Pros and Cons of ULTs
Kernel mode privileges not required. Therefore the process does not switch to kernel mode to do thread management (saving two context switches).
+ Scheduling can be application specific.
+ ULTs can run on any OS.

– The entire process will block if a thread makes a blocking call
– Because the kernel assigns one process to only one processor at a time, multiple threads are unable to run on multiprocessors
Kernel Level Threads (KLTs)
Scheduling by the kernel is done on a thread basis, overcoming the main drawbacks of the ULT approach.
Multiple threads of the same process can be scheduled simultaneously on multiple processors.
If one thread becomes blocked, the kernel can schedule another thread from the same process
The main disadvantage is that the transfer of control from one thread to another within the same process requires a context switch to the kernel
A Combined Approach
Some OSs provide a combined ULT/KLT facility (eg Solaris)
Thread creation is done in user space, as is the bulk of scheduling and synchronisation of threads within an application. The ULTs are mapped to a smaller or equal number of KLTs.
The programmer may adjust the number of KLTs for a particular application and machine to achieve the best results.
Concurrency is superior to the other approaches