Multithreading Models o The relationship between user threads and kernel threads ①Many-to-one[n:1] One-to-One [1:1] Many-to-Many [n:m] Many-to-One [n:1] Many user-level threads user thread mapped to single kernel thread Examples: Solaris Green Threads GNU Portable Threads kernel thread 口1⊙生年12月00 陈话兰xlanchen@ustc.edu.cn http/staff.u0117401 Operating System操作系统原理斐 March29,201911/44
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Multithreading Models The relationship between user threads and kernel threads 1 Many-to-One [n:1] 2 One-to-One [1:1] 3 Many-to-Many [n:m] 1 Many-to-One [n:1] ▶ Many user-level threads mapped to single kernel thread ▶ Examples: ⋆ Solaris Green Threads ⋆ GNU Portable Threads k user thread kernel thread 陈香兰 xlanchen@ustc.edu.cn http://staff.ustc.edu.cn/~xlanchen (Computer Application Laboratory, CS, USTC @ Hefei Embedded System Laboratory, CS, USTC @ Suzhou) 0117401: Operating System 操作系统原理与设计 March 29, 2019 11 / 44
Multithreading Models One-to-One [1:1] user Each user-level thread maps to thread a kernel thread Examples kernel Windows NT/XP/2000 thread ★Linux Solaris 9 and later 口1⊙生年12月00 陈话兰xlanchen@ustc.edu.cn http/staff.u0117401 Operating System操作系统原理斐 March29,201911/44
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Multithreading Models 2 One-to-One [1:1] ▶ Each user-level thread maps to a kernel thread ▶ Examples ⋆ Windows NT/XP/2000 ⋆ Linux ⋆ Solaris 9 and later k k k k user thread kernel thread 陈香兰 xlanchen@ustc.edu.cn http://staff.ustc.edu.cn/~xlanchen (Computer Application Laboratory, CS, USTC @ Hefei Embedded System Laboratory, CS, USTC @ Suzhou) 0117401: Operating System 操作系统原理与设计 March 29, 2019 11 / 44
Multithreading Models Many-to-Many [n:m] Allows many user level threads user thread to be mapped to many kernel threads Allows the operating system to create a sufficient number of kernel threads Examples kemel Solaris prior to version 9 thread Windows NT/2000 with the ThreadFiber package 口1⊙生年12月00 陈话兰xlanchen@ustc.edu.cn http/staff.u0117401 Operating System操作系统原理斐 March29,201911/44
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Multithreading Models 3 Many-to-Many [n:m] ▶ Allows many user level threads to be mapped to many kernel threads ▶ Allows the operating system to create a sufficient number of kernel threads ▶ Examples ⋆ Solaris prior to version 9 ⋆ Windows NT/2000 with the ThreadFiber package k k k user thread kernel thread 陈香兰 xlanchen@ustc.edu.cn http://staff.ustc.edu.cn/~xlanchen (Computer Application Laboratory, CS, USTC @ Hefei Embedded System Laboratory, CS, USTC @ Suzhou) 0117401: Operating System 操作系统原理与设计 March 29, 2019 11 / 44
Multithreading Models Two-level Model,a popular variation on many-to-many model user thread Similar to n:m,except that it allows a user thread to be bound to a kernel thread Examples ★1RIX ★HP-UX kernel ★Tru64UNIX thread ★Solaris8 and earlier 口1⊙生年12月00 陈话兰xlanchen@ustc.edu.cn http/staff.u0117401 Operating System操作系统原理斐 March29,201911/44
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Multithreading Models 4 Two-level Model, a popular variation on many-to-many model ▶ Similar to n:m, except that it allows a user thread to be bound to a kernel thread ▶ Examples ⋆ IRIX ⋆ HP-UX ⋆ Tru64 UNIX ⋆ Solaris 8 and earlier k k k k user thread kernel thread 陈香兰 xlanchen@ustc.edu.cn http://staff.ustc.edu.cn/~xlanchen (Computer Application Laboratory, CS, USTC @ Hefei Embedded System Laboratory, CS, USTC @ Suzhou) 0117401: Operating System 操作系统原理与设计 March 29, 2019 11 / 44
Outline 31 Thread Libraries 口1⊙生年12月00 东香兰xanchen@ustc.edu.cn http:/staff..u011740i:Operating System操作系统原理斐 March29,201912/44
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Outline 3 Thread Libraries 陈香兰 xlanchen@ustc.edu.cn http://staff.ustc.edu.cn/~xlanchen (Computer Application Laboratory, CS, USTC @ Hefei Embedded System Laboratory, CS, USTC @ Suzhou) 0117401: Operating System 操作系统原理与设计 March 29, 2019 12 / 44