Sunteți pe pagina 1din 3

>Returns status data from child to Resource Sharing threads share Process may be changing common

parent (via wait())


resources of
variables, updating table, writing file,
>Process resources are deallocated process, easier than shared memory or etc
by operating system
message
When one process in critical section,
<>Parent may terminate the execution passing
no other may be in its critical section
of children processes using the abort() Economy cheaper than process Critical section problem is to design
PROCESS MANAGEMENT
or TerminateProcess() system call. creation, thread
protocol to solve this
Processes
Some reasons for doing so:
switching lower overhead than context Each process must ask permission to
1.
Konsep "Process"
>Child has exceeded allocated switching
enter critical section in entry section,
<>An operating system executes a resources
Scalability process can take may follow critical section with exit
variety of programs:
>Task assigned to child is no longer advantage of
section, then remainder section
>Batch system jobs
required
multiprocessor architectures
2.
Peterson's Solution
>Time-shared
systems

user
>The parent is exiting and the 3.
Amdahl's Law (Speed up Good algorithmic description of
programs or tasks
operating systems does not allow a
of multicore systems)
solving the problem
<>Textbook uses the terms job and child to continue if its parent
Two process solution
process almost interchangeably
terminates
Assume that the load and store
<>Process a program in execution; <>Some operating systems do not
machine-language
process execution must progress in allow child to exists if its parent has 4.
instructions are atomic; that is, cannot
User to kernel thread
sequential fashion
terminated. If a process terminates, User threads - management done by be interrupted
<>Multiple parts
then all its children must also be user-level threads library
The two processes share two
>The program code, also called text terminated.
variables:
Three primary thread libraries:
section
>cascading termination. All children, POSIX Pthreads
int turn;
>Current activity including program grandchildren, etc. are terminated.
Boolean flag[2]
Windows threads
counter, processor registers
>The termination is initiated by the Java threads
The variable turn indicates whose
>Stack containing temporary data
operating system.
Kernel threads - Supported by the turn it is to enter the critical section
>Function parameters, return <>The parent process may wait for Kernel
The flag array is used to indicate if a
addresses, local variables
termination of a child process by using Examples virtually all general process is ready to enter the critical
>Data section containing global the wait()system call. The call returns purpose operating systems,
section. flag[i] = true implies that
variables
status information and the pid of the including: Windows, Solaris, Linux, process Pi is ready!
>Heap
containing
memory terminated process
3.
Synchronization Hardware
Tru64 UNIX, Mac OS X
dynamically allocated during run time
pid = wait(&status);
Many systems provide hardware
5.
Thread Library: pthread
<>Program is passive entity stored on >>If no parent waiting (did not invoke Thread library provides programmer support for implementing the critical
disk (executable file), process is active wait()) process is a zombie
section code.
with
>Program becomes process when >>If
parent
terminated
without API for creating and managing threads All solutions below based on idea of
executable file
invoking wait , process is an orphan
locking
Two primary ways of implementing
loaded into memory
and so on as detailed next
Protecting critical regions via locks
Library entirely in user space
<>Execution of program started via 4.
Inter
Process
Kernel-level library supported by Uniprocessors could disable
GUI mouse clicks, command line entry
Communication/IPC
interrupts
the OS
of its name, etc
(komunikasi intra proses)
Currently running code would
==pthread==
<>One program can be several Processes within a system may be May be provided either as user-level execute without preemption
processes
independent or cooperating
Generally too inefficient on
or kernel-level
>Consider multiple users executing Cooperating process can affect or be A POSIX standard (IEEE 1003.1c) API multiprocessor systems
the same program
affected by other processes, including for thread
Operating systems using this not
2.
Pengenalan
tentang sharing data
broadly scalable
creation and synchronization
"Process Scheduling"
Reasons for cooperating processes:
Modern machines provide special
Specification, not implementation
<>Maximize CPU use, quickly switch Information sharing
API specifies behavior of the thread atomic hardware instructions
processes onto CPU for time sharing
Computation speedup
Atomic = non-interruptible
library,
<>Process scheduler selects among Modularity
Either test memory word and set
implementation is up to development
available processes for next execution Convenience
value
of the library
on CPU

Cooperating
processes
need Common in UNIX operating systems
Or swap contents of two memory
<>Maintains scheduling queues of interprocess communication(IPC), two (Solaris, Linux, Mac OS X)
words
processes
models of IPC
4.
Mutex Locks
6.
Thread cancelation
>Job queue set of all processes in Shared memory
Terminating a thread before it has Previous solutions are complicated
the system
Message passing
and
generally
inaccessible
to
finished
>Ready queue set of all processes 5.
IPC: Shared Memory & Thread to be canceled is target applicationprogrammers
residing in main memory, ready and
Message Passing
OS designers build software tools to
thread
waiting to execute
===Shared Memory===
solve critical section problem
Two general approaches:
>Device queues set of processes An area of memory shared among

Asynchronous
cancellation Simplest is mutex lock
waiting for an I/O device
the
processes
that
wish
to terminates
the
target
thread Protect a critical section by first
>Processes migrate among the various communicate
acquire() a lock then release() the lock
immediately
queues
The communication is under the Deferred cancellation allows the Boolean variable indicating if lock is
3.
Operasi
terhadap control of the users processes not the target thread to periodically check if it available or not
"Process"
operating system.
Calls to acquire() and release() must
should be cancelled
System must provide mechanisms for:
Major
issues
is
to
provide 7.
be atomic
Thread Scheduler
process creation,
mechanism that will allow the user Both M:M and Two-level models
Usually implemented via hardware
<>Parent process create children processes to synchronize their actions require communication to maintain the atomic instructions
processes,which, in turn create other when they access shared memory.
appropriate number of kernel threads But this solution requires busy
processes, forming a tree of processes ===Message Passing===
waiting
allocated to the application
<>Generally, process identified and Mechanism for
processes to Typically use an intermediate data This lock therefore called a spinlock
managed via a process identifier (pid)
communicate and to
5.
Semaphores
structure
<>Resource sharing options
synchronize their actions
between user and kernel threads Synchronization tool that provides
>Parent and children share all Message system processes lightweight
more sophisticated ways (than Mutex
resources
communicate with each
locks)
process (LWP)
>Children share subset of parents other without resorting to shared
Appears to be a virtual processor for process to synchronize their
resources
variables
activities.
on which
>Parent and child share no resources
IPC facility provides two operations: process can schedule user thread to Semaphore S integer variable
<>Execution options
send(message)
Can only be accessed via two
run
>Parent
and
children
execute receive(message)
Each LWP attached to kernel thread indivisible (atomic) operations
concurrently
The message size is either fixed or How many LWPs to create?
6.
Classic
Problems
of
>Parent waits until children terminate variable
Synchronization
Scheduler activations provide upcalls
<>Address space
6.
Komunikasi dalam Client- - a
Bounded-Buffer Problem
>Child duplicate of parent
Server Systems:
communication mechanism from the n buffers, each can hold one item
>Child has a program loaded into it
Sockets
Semaphore mutex initialized to the
kernel to the
<>UNIX examples
Remote Procedure Calls
value 1
upcall handler in the thread library
>fork() system call creates new Pipes
Semaphore full initialized to the
This communication allows an
process
Remote Method Invocation (Java
value 0
application to
>exec() system call used after a fork() Thread
maintain the correct number kernel Semaphore empty initialized to the
to replace the process memory space 1.
Thread vs Process
value n
threads
with a new program
2.
Benefit of threads
Readers and Writers Problem
Process Synchronization
process termination,
Responsiveness may allow 1.
Readers only read the data set;
Critical-Section problem
<>Process executes last statement continued execution if part of process is Consider system of n processes {p0, they do not perform any updates
and then asks the operating system to blocked, especially important for user p1, pn-1}
Writers can both read and write
delete it using the exit() system call.
interfaces
Each process has critical section Dining-Philosophers Problem
7.
Monitors
segment ofcode

Nama : Abdul Chandra Irawan


NPM : 1306405244
CheatSheet OS
====================
===========

A high-level abstraction that Logical & Physical Address


-Average I/O time = average access pergerakannya. Kemudian langsung
provides a convenient and effective Alamat yang dibangkitkan oleh CPU time + (amount to transfer/transfer berbalik arah tanpa harus menuju
mechanism for process synchronization disebut alamat logika (logical address) rate) + controller overhead
ujung disk.
Memilih
Algoritma
Disk
Abstract data type, internal variables dimana alamat terlihat sebagai uni -For example to transfer a 4KB block on
Scheduling:
only accessible by code within the memory yang disebut alamat fisik a 7200 RPM disk with a 5ms average
procedure
(physical address). Tujuan utama seek time, 1Gb/sec transfer rate with -SSTF lebih umum dan memiliki prilaku
yang lazim kita temui -SCAN dan C Only one process may be active manajemen memori adalah konsep 1ms controller overhead =
within the monitor at a time
meletakkan ruang alamat logika ke 5ms + 4.17ms + 0.1ms + transfer SCAN memperlihatkan kemampuan
yang lebih baik bagi sistem yang
But not powerful enough to model ruang alamat fisik.
time
some synchronization schemes
2.
Swapping
Transfer time = 4KB / 1Gb/s * 8Gb / menempatkan beban pekerjaan yang
CPU Scheduling
Sebuah proses harus berada di memori GB * 1GB / 10242KB = 32 /(10242) = berat kepada disk
-Kinerja sistem sangat tergantung pada
1.
Basic Concepts
untuk dieksekusi. Proses juga dapat 0.031
Maximum CPU utilization obtained ditukar
(swap)
sementara
keluar Average I/O time for 4KB block = jumlah dan tipe permintaan ..
-Pelayanan permintaan disk dapat
with multiprogramming
memori ke backing store dan kemudian 9.27ms + .031ms = 9.301ms
dipengaruhi pula oleh metode alokasi
CPUI/O Burst Cycle Process dibawa kembali ke memori untuk 2.
Disk Structure
execution consists of a cycle of CPU melanjutkan eksekusi.
-Disk drive dialamatkan pada array 1 file
execution and
3.
Contiguous Memory Allocation dimensi dalam bentuk blok logik, -Algoritma penjadualan disk harus
I/O wait
Fragmentasi Int & Ext
dimana blok logik merupakan unit ditulis dalam modul terpisah dari
sistem operasi, jadi dapat saling
CPU burst followed by I/O burst
>Fragmentasi Eksternal terjadi pada transfer terkecil
CPU burst distribution is of main situasi dimana terdapat cukup ruang -Array 1 dimensi dalam blok logik mengganti dengan algoritma lain jika
.
concern
memori
total
untuk
memenuhi dipetakan ke dalam sektor pada diperlukan.
-baik SSTF mau pun LOOK keduanya
2.
Scheduling Criteria
permintaan,
tetapi
tidak
dapat sekuensial disk.
CPU utilization keep the CPU as langsung dialokasikan karena tidak >Sector 0 adalah sector pertama pada merupakan pilihan yang paling masuk
busy as possible
berurutan.
track pertama dari bagian luar silinder. akal sebagai algoritma yang paling
Throughput # of processes that >Fragmentasi Internal terjadi pada >Pemetaan diproses melalui track, dasar
Disk Management
complete their
situasi
dimana
memori
yang kemudian bergerak dari track terluar 5.
-Low-level formatting, or physical
execution per time unit
dialokasikan lebih besar dari pada silinder ke track terdalam
formatting Membagi disk ke dalam
Turnaround time amount of time to memori yang diminta tetapi untuk satu 3.
Disk Attachment
sektor dimana disk controller dapat
Disk Scheduling
execute a particular process
partisi tertentu hanya berukuran kecil 4.
-Sistem operasi bertanggung jawab membaca dan menulis.
Waiting time amount of time a sehingga tidak digunakan.
menggunakan
file
yang
dalam hal efisiensi hardware untuk -Untuk
process has been waiting in the ready 4.
Segmentation
5.
Paging
disk drive berarti dalam hal kecepatan disimpan pada disk, sistem operasi
queue
membutuhkan record dari struktur data
Response time amount of time it Memori fisik dibagi ke dalam blok-blok akses dan bandwith disk.
takes from when a request was ukuran tetap yang disebut frame. -Waktu akses secara umum terbagi ke yang ada pada disk
>Partisi disk ke dalam satu atau lebih
submitted until the first response is Memori logika juga dibagi ke dalam dalam:
produced, not output (for time-sharing blok-blok dgn ukuran yang sama yang >Seek time yaitu waktu disk untuk kelompok silinder.
disebut page. Semua daftar frame yang menggerakkan head ke silinder untuk > Logical formatting atau buat suatu
environment)
sistem.
bebas disimpan. Untuk menjalankan mencapai sektor yang diinginkan.
3.
Scheduling Algorithms
program dengan ukuran n page, perlu >Rotational latency waktu tunggu disk -Boot block Menginisialisasi Sistem
==FCFS Scheduling==
menemukan n frame bebas dan untuk berputar mengelilingi sektor ke >Bbootstrap disimpan di ROM.
==Shortest-Job-First (SJF)==
>Program Bootstrap loader ditaruh di
meletakkan program pada frame head disk.
==Round Robin (RR)==
boot block
tersebut.
-Meminimalkan seek time
==Multilevel Queue==
-Metode sector sparing digunakan
Virtual Memory
-Seek time seek distance
4.
Thread Scheduling
Background
-Disk bandwidth adalah total jumlah untuk menangani blok yang rusak.
Distinction between user-level and 1.
2.
Demand Paging
byte yang ditransfer, dibagi dalam -Booting from windows : MBR-Boot
kernel-level threads
Copy-on-Write
totoal
waktu
antara
permintaan Code-Partition Table- boot partition When threads supported, threads 3.
4.
Page Replacement
pertamama untuk dilayani hingga Partition X
scheduled, not processes
-Manajemen Swap Space
Many-to-one and many-to-many Page replacement diperlukan pada
> Swap-space Virtual menggunakan
models, thread library schedules user- situasi dimana proses dieksekusi perlu
disk space sebagai perpanjangan (atau
frame bebas tetapi tidak tersedia frame
level threads to run on LWP
space tambahan) dari memori utama.
Known as process-contention scope bebas. Ada:
> Swap-space berusaha agar file
(PCS) since scheduling competition is Algoritma FIFO
sistem secara normal dapat dipisahkan
Algoritma Optimal
within the process
dalam partisi disk
Typically done via priority set by Least Recently Used
6.
RAID Structure
EAT = (1-p) x ma + p x page_faultprogrammer
Biasanya untuk meningkatkan kinerja,
Kernel thread scheduled onto time
dilibatkan banyak disk sebagai satu
Allocation of Frames
selesai transfer
available CPU is systemcontention 5.
unit penyimpanan. Tiap-tiap blok data
Algoritma: (buat dalam grafik)
scope (SCS) competition among all Terdapat 2 bentuk algoritma alokasi
dipecah ke dalam beberapa subblok,
yaitu equal allocation dan proportional -First Come First Served
threads in system
allocation. Pada equal allocation, jika Queue: 98, 183, 37, 122, 14, 124, 65, dan dibagi-bagi ke dalam disk-disk
5.
Multiple-Processor Scheduling
tersebut. Ketika mengirim data disk CPU scheduling more complex when terdapat m frame dan n proses, maka 67
setiap proses dialokasikan sejumlah Hasil : 98, 183, 37, 122, 14, 124, 65, disk tersebut bekerja secara paralel,
multiple CPUs are available
sehingga
dapat
meningkatkan
Homogeneous processors within a frame yang sama (m/n frame). Pada 67
Seek
Time
First kecepatan transfer dalam membaca
proportional allocation setiap proses -Shortest
multiprocessor
atau menulis data. Ditambah dengan
secara
proporsional (menyebabkan Starvasion)
Asymmetric multiprocessing only dialokasikan
pada
rotasi
masingone processor accesses the system berdasarkan ukurannya. Jika ukuran Queue: 98, 183, 37, 122, 14, 124, 65, sinkronisasi
masing disk, maka kinerja dari disk
data structures, alleviating the need for virtual memori untuk proses pi adalah 67
si dan total jumlah frame yang tersedia Hasil : 65, 67,37, 14, 98, 122, 124, 183 dapat ditingkatkan. RAID Redundant
data sharing
-scan (elevator algorithm) : Arm disk Array
of
Independent
(atau
Symmetric multiprocessing (SMP) m, maka frame ke ai dapat dialokasikan
dimulai dari salah satu ujung disk dan Inexpensive) Disk.
eachprocessor is selfscheduling, all ke proses pi sama dengan:
bergerak menuju ujung yang lain Peningkatan
kehandalan
:
processes in common ready queue, or Ai=(si / S) . m
sambil melayani permintaan setiap kali Redundansi, paralelisme
Global
replacement
mengijinkan
suatu
each has its own private queue of
- Level Raid:
proses untuk menyeleksi suatu frame mengunjungi masing-masing silinder.
ready processes
menyimpan melakukan
yang akan dipindah dari sejumlah -Cscan : C-SCAN akan menggerakkan >Level 0 :
Currently, most common
meskipun
frame
tersebut head dari satu ujung disk ke ujung striping blok data ke dalam beberapa
Processor affinity process has frame,
lainnya sambil melayani permintaan disk tanpa redundansi
affinity for processor on which it is sedang dialokasikan ke proses yang
yang terdapat selama pergerakan >level 1: disk mirroring, menduplikat
lain.
Pada
local
replacement,
jumlah
currently running
tersebut; tetapi pada saat head tiba setiap disk
frame
yang
dialokasikan
untuk
proses
soft affinity
tidak berubah. Setiap proses dapat pada salah satu ujung, maka head >Level 2: pengorganisasian dengan
hard affinity
Deteksi
error
dari
frame-frame
yang tidak berbalik arah dan melayani error-correcting-code.
Variations including processor sets memilih
permintaan-permintaan,
melainkan dengan parity
dialokasikan untuknya.
6.
Linux Examples
akan kembali ke ujung disk asal >level 3: pengorganisasian dengan
6.
Thrashing & locality issues
7.
Algorithm Evaluation
paritas
bit
interleaved.
Tetapi
7.
Memory-Mapped
Files pergerakannya
MEMORY MANAGEMENT
menggunakan sebuah disk redundant.
(skipped)
Main Memory
8.
Allocating Kernel Memory
>level 4: menggunakan striping data
1.
Background
STORAGE MANAGEMENT
pada level blok, menyimpan sebuah
Binding
paritas blok pada sebuah disk yang
Pengikatan
alamat
adalah
cara Mass-Storage Systems
Overview of Mass Storage
terpisah untuk setiap blok data pada
instruksi dan data (yang berada di disk 1.
Structure
disk-disk lain yang bersesuaian.
sebagai file yang dapat dieksekusi)
HD
dan
Floppy
=
>level 5: pengorganisasian dengan
dipetakan ke alamat memori. Sebagian -Kapasitas
besar sistem memperbolehkan sebuah heads*tracks*sector per track*bytes -Clook : Arm disk bergerak paling jauh paritas blok interleaved tersebar.
hanya pada permintaan terakhir pada Disebar pada semua disk termasuk disk
proses user (user process) untuk per sector
meletakkan di sembarang tempat dari -Access Latency = Average access time masing-masin arah pergerakannya. tambahan.
= average seek time +average latency Kemudian
langsung
berbalik
memori fisik.

>level 6: RAID level 6 disebut juga 3.


Disk and Directory Structure
berbeda, Pencarian yang efisien, Tidak Sector= 32byte4096byte (umumnya
redundansi P+Q, seperti RAID level 5, -Directory: kumpulan node yang berisi perlu dikelompokkan
512)
tetapi menyimpan informasi redundan informasi dari semua file.
>Tree : efisien Search, Grouping, -file control block
tambahan
untuk
mengantisipasi -Baik struktur direktori maupun file Working Directory
-device driver
kegagalan
dari
beberapa
disk terletak di disk.
>Acyclic-Graph: share file, aliasing, -FS System Layer: App Programsekaligus.
- Each volume containing file system dangling pointer-> backpointers, entry- >Logical FS->File-org. Module-> Basic
> RAID level 0+1 dan 1+0: RAID level also tracks that file systems info in hold-count
FS->I/O Control->Devices
0+1 dan 1+0 ini merupakan kombinasi device directory or volume table >general Graph: Mengijinkan link >Device drivers: manage I/O devices at
dari RAID level 0 dan 1. RAID level 0 ofcontents
hanya pada file dan bukan pada the I/O control layer
memiliki kinerja yang baik, sedangkan -Backup kedua struktur tersebut dapat subdirektori, mengumpulkan sampah.
> Basic file system: manage memory
RAID level 1 memiliki kehandalan.
disimpan pada tape.
4.
File-System Mounting
buffer & cache
File-System Interface
-A collection of nodes containing Sistem file harus di-mount sebelum > File organization module understands
1.
File Concept
information about all files
diakses, Sistem file yang tidak di mount files, logical address, and physical
2.
Access Methods
-info pada device direktori: Name, Type, akan di mount pada titik mount.
blocks (translate), manage free space,
-Sequential Access,Akses dilakukan Address, Current length, Maximum 5.
File Sharing
allocation
dengan
satu
arah length, Date last accessed (for -Sharing
dapat
dilakukan
melalui > Logical file system manages
pembacaan/penulisan
(dari
awal archival), Date last updated (for dump), skema proteksi.
metadata information
hingga akhir) jika ingin mundur maka Owner ID (who pays), Protection - Network File System (NFS) adalah 2.
FS Implementation
perlu dilakukan rewind
information
bentuk umum sharing file terdistribusi. - Boot control block contains info
-Direct Access (random access),Akses -organisasi directory:
6.
Protection
needed by system to boot OS from that
dilakukan bisa pada posisi mana saja >Efficiency (penempatan file dengan -Three classes of users on linux: Owner, volume
dalam file
tepat)
Group, Public.
3.
Dir Implementation
-Metoda lain,
4.
Allocation Methods
>Naming (penamaan)
-Access Control List (windows)
5.
Free-Space Management
Abstraksi lebih tinggi dari direct access >Grouping )pengelompokan program)
File-System Implementation
6.
Recovery
Index file & relative file
-Macam direktori:
1.
FS Structure
>Satu tingkat: Naming dan Grouping Akibat efisiensi, transfer I/O antara
Problem
memory & disk dilakukan dalam satuan
>Dua Tingkat: Path name, Dapat block.
memiliki nama yang sama untuk user 1 block= satu/beberapa sector

S-ar putea să vă placă și