NG
POKOK BAHASAN
MultiProgramming
MultiProcessing
Multithreading
DEFINISI
Multiprocessing merupakan penggunaan dua atau lebih CPU dalam sebuah sistem komputer.
Multitasking merupakan metode untuk menjalankan lebih dari satu proses dimana terjadi
pembagian sumberdaya seperti CPU.
Multiprogramming merupakan teknik yang memperbolehkan lebih dari satu program siap
dieksekusi (proses) dan menyediakan kemampuan untuk berpindah dari satu proses ke proses
lain, meskipun proses sebelumnya belum selesai
Multithreading adalah cara pengeksekusian yang mengizinkan beberapa thread terjadi dalam
sebuah proses, saling berbagi sumber daya tetapi dapat dijalankan secara independen.
LATAR BELAKANG
Pada saat ini, setiap sistem operasi harus memiliki kemampuan
untuk:
Menyediakan lingkungan untuk menjalankan proses dalam bentuk
multiprogramming fashion.
Bertindak sebagai service provider bagi sebagian besar layanan yang
diperlukan pengguna, seperti copying files, making new folders,
compressing information, sending and receiving messages from other
computers in the network, etc.
Menyediakan user interface yang mudah digunakan dan menyenangkan
untuk bekerja.
WHY MULTITHREADING TODAY?
Storage need to hold multiple context’s PC, registers, status word, etc.
Coordination to match an event with a saved context
A way to switch contexts
Long latency operations must use resources not in use
PROCESSOR UTILIZATION VS.
LATENCY
I/O completed
Process
Termination
18
PROCESSOR WAIT RATIO
If the average execution time of a program with single-
programming is e and the average I/O time is b, then the
following ratio is the CPU wait fraction (w). It is actually the
fraction of the time the CPU is idle.
b
w
eb
19
THE MULTIPROGRAMMING
CONCEPT
Multiprogramming merupakan suatu teknik yang memperbolehkan lebih dari
satu program siap dieksekusi dan menyediakan kemampuan untuk berpindah
dari satu proses ke proses yang lain, meskipun proses sebelumnya belum
selesai
Teknik ini mampu bekerja dalam single-processor (like our personal
computers) dan multiprocessor (such as large main frame) computers.
Multiprogramming terutama diselesaikan oleh sistem operasi. Perangkat keras
menyediakan beberapa sirkuit tertentu yang dapat digunakan oleh sistem
operasi dalam rangka memfasilitasi multiprogramming.
20
MULTIPROGRAMMING AND
PCS
Do we need multiprogramming for PCs?
Yes. All PC users like to run many applications simultaneously. Nobody runs
for example an Internet explorer looking for an information while staring at the
monitor for the results for a long time.
21
MULTIPROGRAMMING
PRODUCTIVITY
Multiprogramming increases system productivity. If CPU wait time
is represented by w in single-programming environment, the CPU
wait time decreases to approximately for a system running n
n
w
processes simultaneously.
Example: If w = .9 then =0.59 ; meaning that if we have five processes
5
running simultaneously, thewCPU utilization is increased by (0.41-.10)*100 =
310%.
By increasing the CPU utilization other device’s utilization is also
increased.
22
PROCESS STATE TRANSITION
DIAGRAM
Siklus hidup dari proses multiprogramming tidak sama dengan
singleprogramming.
Sebuah proses mungkin siap menggunakan CPU untuk
menjalankan program, sementara CPU menjalankan program lain.
The basic states are thus Ready, Running, and Wait/Blocked. Wait
refers to a state in which the process is waiting for a device or an
event and Blocked is for the case the process is waiting for its I/O
to be completed by an I/O processor.
23
PROCESS’S LIFE CYCLE
Process
Termination
Running
A process is
picked to run
Preempted for the Needs I/O or
interest of others circumstance
Process birth
Wait/Blocked
Ready
Running obstacle is
vanished
24
REQUIREMENTS OF
MULTIPROGRAMMING
Process Switching possibility: sistem harus dapat beralih dengan
aman dari satu proses ke proses yang lain. Ini disebut Context
switching.
Direct Memory Access: I/O prosesor harus mampu langsung
mengakses memori utama tanpa gangguan dan konflik.
The Interrupt System: I / O prosesor dan perangkat monitoring
harus mampu berkomunikasi secara aman dengan CPU.
25
MULTIPROCESSIN
G
MULTIPROCESSING
Modern operating systems are multiprocessing
Appear to do more than one thing at a time
Three general approaches:
Cooperative multiprocessing
Preemptive multiprocessing
Really having multiple processors
27
MULTIPROCESSORS AND
MULTIPROCESSING
Hardware: Multiprocessor computers have become commodity products, e.g.,
quad-processor Pentium Pros, SGI and Sun workstations.
Programming: Multithreaded programming is supported by commodity
operating systems, e.g., Windows NT, UNIX/Pthreads.
Applications: Traditionally science and engineering. Now also business and
home computing.
Problem: Difficulty of multithreaded programming compared to sequential
programming.
28
WHY BUY A
MULTIPROCESSOR?
Multiple users.
Multiple applications.
Multitasking within an application.
Responsiveness and/or throughput.
29
MULTIPROCESSOR
ARCHITECTURES
Message-Passing Architectures
Ruang alamat terpisah untuk setiap prosesor.
Prosesor berkomunikasi melalui message passing.
Shared-Memory Architectures
Ruang alamat tunggal dipakai bersama oleh semua prosesor.
Prosesor berkomunikasi melalui memory read/write.
SMP or NUMA.
Cache coherence is important issue.
30
MESSAGE-PASSING
ARCHITECTURE
memory memory ... memory
interconnection network
31
SINGLE VS. MULTITASKING
SHARED-MEMORY
ARCHITECTURE
processor
1
processor
2
... processor
N
interconnection network
memory
1
memory
2
... memory
M
34
SHARED-MEMORY
ARCHITECTURE:
SMP AND NUMA
SMP = Symmetric Multiprocessor
All memory is equally close to all processors.
Typical interconnection network is a shared bus.
Easier to program, but doesn’t scale to many processors.
35
SMP VERSUS NUMA
EXAMPLE: QUAD-PROCESSOR
PENTIUM PRO
SMP, bus interconnection.
4 x 200 MHz Intel Pentium Pro processors.
8 + 8 Kb L1 cache per processor.
512 Kb L2 cache per processor.
Snoopy cache coherence.
Compaq, HP, IBM, NetPower.
Windows NT, Solaris, Linux, etc.
37
EXAMPLE: SGI ORIGIN 2000
NUMA, hypercube interconnection.
Up to 128 (64 x 2) MIPS R 10000 processors.
32 + 32 Kb L1 cache per processor.
4 Mb L2 cache per processor.
Distributed directory-based cache coherence.
Automatic page migration/replication.
SGI IRIX with Pthreads.
38
MESSAGE-PASSING VERSUS SHARED-
MEMORY
ARCHITECTURES
Model pemrograman SMA lebih mudah karena transfer data
ditangani secara otomatis.
Message-Passing dapat efisien diimplementasikan pada memori
bersama, namun tidak sebaliknya.
39
MULTITHREADING
MULTITHREADING
Multithreading programs appear to do more than one thing at a time
Same ideas as multiprocessing, but within a single program
More efficient than multiprocessing
Java tries to hide the underlying multiprocessing implementation
Sun CoolThreads
UltraSPARC T1
4-threads per core
IBM
POWER5
IBM POWER5
HTTP://WWW.RESEARCH.IBM.COM/JOURNAL/RD/494/MATHIS.PDF
IBM POWER5
HTTP://WWW.RESEARCH.IBM.COM/JOURNAL/RD/494/MATHIS.PDF
MULTICORE
Multiple processor cores on a chip
Chip multiprocessor (CMP)
Sun’s Chip Multithreading (CMT)
UltraSPARC T1 (Niagara)
Intel’s Pentium D
AMD dual-core Opteron
http://www.sun.com/servers/wp.jsp?tab=3&group=CoolThreads%20servers
8 CORES VS 2 CORES
Is 8-cores too aggressive?
Good for server applications, given
Lots of threads
Scalable operating environment
Large memory space (64bit)
Good for power efficiency
Simple pipeline design for each core
Good for availability
Not intended for PCs, gaming, etc
SPECWEB 2005