Sesi 4

Sekolah Tinggi Teknologi
Adisutjipto Yogyakarta
Materi Kuliah : Sistem Operasi / OS
Semester Genap
E.N. Tamatjita
- 0S
STTA-TF
E.N. Tamatjita -
1
Pertemuan Ke-4
Threads






Multicore Programming
Multithreading Models
Thread Libraries
Implicit Threading
Threading Issues
Operating System Examples
- 0S
STTA-TF
E.N. Tamatjita -
2
Gambar ini diambil dari Buku Operating System Concepts, Abraham Silberschatz, Peter Baer Galvin and
Greg Gagne, Chapter 4, hal. 165, John Wiley and Sons, Inc., Virginia, New Jersey, 2013
- 0S
STTA-TF
E.N. Tamatjita -
3
Benefits
 Responsiveness – may allow continued
execution if part of process is blocked,
especially important for user interfaces
 Resource Sharing – threads share
resources of process, easier than shared
memory or message passing
 Economy – cheaper than process creation,
thread switching lower overhead than
context switching
 Scalability – process can take advantage of
multiprocessor architectures
- 0S
STTA-TF
E.N. Tamatjita -
4
Multicore vs Multiprocessor
 Multicore or multiprocessor systems putting pressure on
programmers, challeng
 Dividing activities
 Balance
 Data splitting
 Data dependency
 Testing and debugging
 Parallelism implies a system can perform more than one task
simultaneously
 Concurrency supports more than one task making progress
 Single processor / core, scheduler providing concurrency
 Types of parallelism
 Data parallelism – distributes subsets of the same data across
multiple core each
 Task parallelism – distributing threads across cores, each thread
performing
 As # of threads grows, so does architectural support for threading
 CPUs have cores as well as hardware threads
 Consider Oracle SPARC T4 with 8 cores, and 8 hardware threads
per core
- 0S
STTA-TF
E.N. Tamatjita -
5
Gambar ini diambil dari Buku Operating System Concepts, Abraham Silberschatz, Peter Baer Galvin and
Greg Gagne, Chapter 4, hal. 166, John Wiley and Sons, Inc., Virginia, New Jersey, 2013
- 0S
STTA-TF
E.N. Tamatjita -
6
Gambar ini diambil dari Buku Operating System Concepts, Abraham Silberschatz, Peter Baer Galvin and
Greg Gagne, Chapter 4, hal. 164, John Wiley and Sons, Inc., Virginia, New Jersey, 2013
- 0S
STTA-TF
E.N. Tamatjita -
7
User Threads dan Kernel Threads
 User threads - management
 Three primary thread library
 POSIX Pthreads
 Win32 threads
 Java threads
 Kernel threads - Support
 Examples – virtually all general purpose
o/s, including :
 Windows
 Solaris
 Linux
 Tru64 UNIX
 Mac OS X
- 0S
STTA-TF
E.N. Tamatjita -
8
Multithreadings Model
 Many-to-One
 One-to-One
 Many-to-Many
Penjelasan  Lihat White Board…
- 0S
STTA-TF
E.N. Tamatjita -
9
*** Minggu Depan ________
Sinkronisasi Proses
- 0S
STTA-TF
E.N. Tamatjita -
10