Ch 4 Flashcards
Data parallelism
distributes subsets of the same data across multiple cores, same operation on each
Task parallelism
distributing threads across cores, each thread performing unique operation
User Threads
management done by user-level threads library i.e. POSIX Pthreads, Windows threads, Java threads
Kernel Threads
virtually all general purpose operating systems, including Windows, Solaris, Linux/UNIX, Mac OS X
Kernel Threads
virtually all general purpose operating systems, including Windows, Solaris, Linux/UNIX, Mac OS X
Multithreading models
Many-to-One - Multiple threads may not run in parallel on muticore system because only one may be in kernel at a time
One-to-One - More concurrency than many-to-one. Number of threads per process sometimes restricted due to overhead
Many-to-Many - Allows the operating system to create a sufficient number of kernel threads
Signals
Signals are used in UNIX systems to notify a process that a particular event has occurred.
target thread
If thread has cancellation disabled, cancellation remains pending until thread enables it Asynchronous cancellation terminates the target thread immediately Deferred cancellation allows the target thread to periodically check if it should be cancelled
TLS
Thread-local storage (TLS) allows each thread to have its own copy of data
What data gets duplicated in threads?

Benefits of multithreading?
- Responsiveness - useful for user interfaces
- Resource sharing - it allows an application to have several different threads of activity within the same address space.
- Economy - because they share recources
- Scalibility - multiprocessor architecture,
Amdahl’s Law

Challenges of multithreading?
Identifying tasks
balance
data splitting
Data dependency
Testing and Debugging
thread pools
The general idea behind a thread pool is to create a number of threads at process startup and place them into a pool, to limit the amount of threads that can be in use (a multithread problem).
Servicing a request with an existing thread is faster.
block
A block is simply a self-contained unit of work recognized by a compiler. ( i.e printf() )
Signal handler
processes signals generated by a particular event, delivered to a process, handled
thread cancellation
Asynchronous cancellation terminates the target thread immediately
asynchronous cancellation is problematic, because a thread may be terminated without letting the OS reclaim all of its recources
Deferred cancellation allows the target thread to periodically check if it should be canceled
deferred cancelation fixes the issue mentioned above.