Mind map
Threads

Map content
Threads
What is a 'Thread'?
- A way for a program to split itself in two or more running tasks
- Fundamental for CPU utilisation and multithreaded computers
- Multithreading
- OS can run multiple threads within a single process
- Multithreading
- Fundamental for CPU utilisation and multithreaded computers
- a.k.a thread of execution
- Thread Structure
- Thread ID
- Program counter
- Register set
- Stack
- Thread Libraries
- For Thread Creation and Termination
- pthread_creat()
- Pthread_exit()
- Pthread_detach()
- Remove data structure
- For Thread Creation and Termination
- A way for a program to split itself in two or more running tasks
Benefits of Threads
- Thread creation doesn't require OS to initialise resources shared between parent processes and its threads
- Responsiveness
- Process can run even if part of it is blocked
- User can still use it
- Process can run even if part of it is blocked
- Resource Sharing
- Several activities within one address space
- Economy
- Threads share resources of process
- More economical to context-switch threads
- Threads share resources of process
- Utlisation of multiprocessor architectures
- Multiple threads on multiple CPUs
- Increased concurrency!
- Multiple threads on multiple CPUs
Thread State
- State shared by all threads in address space
- Contents of memory (data, heap)
- I/O state
- Private to each thread
- Kept in Thread Control Block (TCB)
- State shared by all threads in address space
Java Threads
- Extend Thread
- Implement Runnable
Threading Models
- User-Level Threads
- Threading operations performed in user space
- Kernel sees one execution context
- many-to-one thread mapping
- Manage own resources
- Threading operations performed in user space
- Kernel-Level Threads
- Maps each thread to its own execution context
- one-to-one thread mapping
- If one user-level thread is blocked = whole process blocked
- Maps each thread to its own execution context
- User-Kernel Combo Model
- Thread creation done in user space
- Bulk of scheduling of threads within application
- User-Level Threads
Images and files in the map
Information
- Description
- Computer Science Mind Map on Threads, created by Alex Bernini on 06/05/2019.
- Created by
- Alex Bernini
- Views
- 0
- Rating







