Sekolah Tinggi Teknologi Adisutjipto Yogyakarta

dokumen-dokumen yang mirip
Paralel processing Benefits Job level Process level Thread level

two/more processor operate in unison.

Bab 6: Sinkronisasi Proses. Latar Belakang

Bab 5. Sinkronisasi Proses POKOK BAHASAN: TUJUAN BELAJAR: 5.1 LATAR BELAKANG

Proses Sinkronisasi. Latar Belakang Masalah Critical Section Sinkronisasi Hardware Semaphores Monitors

7 Sinkronisasi. Proses Sinkronisasi. Overview (1) Overview (2) Latar Belakang Masalah Critical Section Sinkronisasi Hardware Semaphores Monitors

Sinkronisasi dan Deadlock

Process Synchronization

Sinkronisasi dan Deadlock

Sistem Operasi Pertemuan 5 Concurrency: Mutual Exclusion & Synchronization

Sistem Operasi Komputer. Pertemuan VI Proses Sinkronisasi

BAB 4. SINKRONISASI & DEADLOCK

The Critical Section Problem Algorithm III

Bab 3: Proses-Proses. Konsep Proses

Sekolah Tinggi Teknologi Adisutjipto Yogyakarta

Apa yang akan dipelajari?

The Critical Section Problem Algorithm III. Muhammad Fikry Hazmi (143) Kresna Ridwan (145) Guntur Kondang Prakoso (153)

Analisis Penerapan Semaphore dalam Mengatasi Masalah Sinkronisasi Dining Philosophers.

Bab 3: Proses-Proses. Konsep Proses

Konkurensi merupakan landasan umum perancangan sistem operasi. Proses-proses disebut konkuren jika proses-proses berada pada saat yang sama.

Pertemuan #3: Sinkronisasi dan Deadlock

Readers-Writers & The Dining Philosophers Problem

PROSES & THREADS 2 AGUS PAMUJI. SISTEM OPERASI - Proses & Threads

SISTEM OPERASI (MANAJEMEN PROSES)

B. Jawablah dengan ringkas dan lengkap. (Jawaban tidak lebih dari 10 kalimat) (Nilai 40) Solusi: kata kunci dalam huruf miring.

MODUL 5 MANAJEMEN PROSES (2) (PENJADWALAN PROSES)

Monitor. Process Synchronization. SISTIM OPERASI (IKI-20230) ProcessSynchronization Ch. 6. Johny Moningka

Process Synchronization (Background)

Sinkronisasi dan Deadlock Sistem Operasi

Bab 22. Perangkat Sinkronisasi II

Tahun Akademik 2014/2015 Semester II. DIG1I3 - Instalasi dan Penggunaan Sistem Operasi. Mutual Exclusion dan Sinkronisasi

PERANGKAT LUNAK SIMULASI DEADLOCK MENGGUNAKAN ILUSTRASI DINING PHILOSOPHERS PROBLEM

MANAJEMEN PROSES. Satu Empat Model program counter program counter Proses

BAB II MANAJEMEN PROSES

1/3/2013. Race Condition adalah situasi di mana beberapa proses mengakses

Komunikasi & Sinkronisasi Proses

Sistem Operasi. Critical section, konkurensi, mutasi exclusion, starvation dan deadlock. Juliansyahwiran, S. Kom, MTI. Modul ke: Fakultas FASILKOM

Sistem operasi menjalankan banyak dan beragam program :

Sequential Process. Keterangan SISTEM OPERASI KOMUNIKASI ANTAR PROSES

Concurrency 1 : Mutual Exclusion dan Sinkronisasi (P ( e P rtemuan ua ke-9) 9 September 2014

SOLUSI QUIZ 2 SISOP CS3613

Rencana Perkuliahan Sistem Operasi CSG3E3 2015/2016

4 Proses. Proses. Konsep Proses. Proses. Prosesor mengeksekusi program-program komputer Prosesor adalah sebuah chip dalam sistem

PENGATURAN PROSES. Proses adalah program yang sedangdieksekusi atau sofware yang sedang dilaksanakan.

Laporan Tugas Scheduling Pengantar Sistem Operasi

Concurrency 1: y Mutual Exclusion dan Sinkronisasi (Perte rt muan ke muan -10) 10 Oktober 2014

Sistem Operasi Pertemuan 6 Concurrency: Deadlock & Starvation. H u s n i Lab. Sistem Komputer & Jaringan Teknik Informatika Univ.

Soal-jawab Quiz 2. Oleh: Endro Ariyanto (END) Oktober 2008

Dosen pengampu : Mohamad Dani Sifat : Tutup buku dan peralatan elektronik

MODUL PRAKTIKUM SISTEM OPERASI PRAKTIKUM III Sinkronisasi Proses

MODUL 4 KONSEP PROSES, KONKURENSI, MANAJEMEN PROSES (1) M. R A J A B F A C H R I Z A L - S I S T E M O P E R A S I - M O D U L 4

Sistem Operasi. Proses dan Thread

Bab 19. Solusi Critical Section

Operating System. Synchronization & Deadlock. Fak. Teknik Jurusan Teknik Informatika Universitas Pasundan

CRITICAL REGION - SEMAPHORE MUTEX DALAM CPU OS SIMULATOR V

STRUKTUR FUNGSI CPU. Menjelaskan tentang komponen utama CPU. Membahas struktur dan fungsi internal prosesor, organisasi ALU, control unit dan register

Jawaban Soal UTS Instalasi dan Penggunaan Sistem Operasi Semester Genap 2014/2015 D3 Teknik Informatika, Fakultas Ilmu Terapan, Universitas Telkom

Organisasi Komputer. Candra Ahmadi, MT

Kuliah#7 TSK617 Pengolahan Paralel - TA 2011/2012. Eko Didik Widianto

CRITICAL REGIONS DAN MONITORS

Sistem Operasi PENGATURAN PROSES

Sistem Operasi Komputer

BAB II TINJAUAN PUSTAKA

Struktur Sistem Komputer

Process Control Block (PCB) Masing-masing proses Direpresentasikan oleh Sistem Operasi dengan menggunakan Process Control Block (PCB),

Bab 3. Proses Proses POKOK BAHASAN: TUJUAN BELAJAR: 3.1 KONSEP PROSES

Processes. Processes. SISTIM OPERASI (Operating System) IKI-20230

PROSES DAN THREADS DALAM SISTEM OPERASI

Struktur Sistem Komputer

T UGAS STUDI KASUS SISTEM OPERASI. Mutual Exclusion. Mata Kuliah : Sistem Operasi [ CF 1322] Disusun Oleh :

PENYELARASAN PADA MASALAH DINING PHILOSOPHERS MENGGUNAKAN ALGORITMA LOCK & RELEASE

Sleep and Wake Up. Tugas Kuliah. Mata kuliah : CF 1310 Sistem Operasi. Disusun oleh : UZLINA RAHMAWATI FIA MAHANANI

Thread. pada satu waktu. menjalankan banyak tugas/thread. yang sama

Sistem Operasi 3. Process

Aditya Wikan Mahastama

Kelas: Nilai (Diisi Dosen):... IF

TUGAS SISTEM OPERASI

Model Proses : 1. Sequential Process / bergantian 2. Multiprogramming 3. CPU Switching peralihan prosedur dalam mengolah 1 proses ke proses lainnya.

Critical Section Mutual Exclusion Semaphore Tugas. Sinkronisasi Thread. Praktikum Sistem Operasi. Ilmu Komputer IPB. Sinkronisasi Thread

BAB I MANAJEMEN PROSES

MAKALAH SISTEM OPERASI Perbedaan Proses dan Thread. Disusun Oleh : NOVITA ANGGRAINI PUTRI

Artikel Perbedaan Proses Dan Thread. Disusun Oleh : Nama : Rozy Putra Pratama NIM : Prodi : Sistem Informasi

Thread Proses merupakan sebuah program yang mengeksekusi THREAD tunggal. Kendali thread tunggal ini hanya memungkinkan proses untuk menjalankan satu t

Untuk mengatasi kondisi pacu harus dijamin tidak boleh dua proses atau lebih memasuki critical section yang sama secara bersamaan.

Rahmady Liyantanto liyantanto.wordpress.com

Sistem Operasi. Konkurensi

Mahasiswa dapat memahami konsep dasar deskripsi dan kontrol pada proses

Sistem Operasi Komputer. Pembahasan Deadlock

Bab 3.Proses dan Penjadualan

Sistem Operasi. Kongkurensi

Struktur Sistem Komputer. Abdullah Sistem Informasi Universitas Binadarma

Arsitektur Sistem Komputer. Operasi Sistem Komputer. Struktur Sistem Komputer. Review:

Kongkurensi LPOHLVSFOTJ!

Fairuz El Said Sekedar Berbagi Sistem Operasi (SO) Konkurensi KONGKURENSI

DEADLOCK. KELOMPOK : Aurora Marsye Mellawaty Vidyanita Kumalasari Y

SISTEM OPERASI. Sri Kusumadewi

Struktur Sistem Komputer

Sekolah Tinggi Teknologi Adisutjipto Yogyakarta

Monitor. Makalah Sistem Operasi. Disusun oleh :

Masalah Deadlock. Contoh Persimpangan Jalan. Resource-Allocation Graph. Deadlock

Transkripsi:

Sekolah Tinggi Teknologi Adisutjipto Yogyakarta Materi Kuliah : Sistem Operasi / OS Semester Genap E.N. Tamatjita 1

Pararel Processing Pertemuan Ke-5 Paralel processing is a situation in which two/more processor operate in unison. Executing instruction simultaneously Benefits: increase reliability & faster processing Evolution:Evolution: Job level : each job has its own processor and all processes and threads are run by the same processor Process level: unrelated process, are assigned to any available processor Thread level : threads are assigned to avaliable processor 2

Mengapa perlu Sinkronisasi? Sinkronisasi diperlukan untuk menghindari terjadinya ketidak konsistenan data akibat adanya akses data secara konkuren. Diperlukan adanya suatu mekanisme untuk memastikan urutan / giliran Diperlukan adanya suatu mekanisme untuk memastikan urutan / giliran pengaksesan suatu data yang saling bekerjasama sehingga terjadi sinkronisasi If we don t make process synchronization: Race Condition 3

Producer and Consumer #define BUFFER_SIZE 10 typedef struct {... } item; item buffer[buffer_size]; int in = 0; int out = 0; int counter = 0; 4

Producer while (true) { /* produce an item and put in nextproduced */ while (count ==BUFFER_SIZE){ } // do nothing buffer [in] = nextproduced; in = (in + 1) % BUFFER_SIZE; count++; } 5

Consumer while (true) { while (count == 0){ } // do nothing nextconsumed = buffer[out]; out = (out + 1) % BUFFER_SIZE; count--; /* consume the item in nextconsumed } 6

Automic Process The statements counter++; counter--; must be performed atomically. Atomic operation means an operation that completes in its entirety without interruption. 7

Bounded Buffer Perintah count++ diimplementasikan pada bahasa mesin: register1 = counter register1 = register1 + 1 counter = register1 Perintah count-- diimplementasikan pada bahasa mesin: register2 = counter register2 = register2 1 counter = register2 8

Race Condition Race condition: situasi dimana beberapa proses mengakses dan memanipulasi suatu data secara konkuren. Nilai akhir dari data tersebut tergantung dari proses mana yang terakhir mengubah data proses mana yang terakhir mengubah data Untuk menghindari terjadinya situasi tersebut, semua proses yang dapat mengakses suatu data tertentu harus disinkronisasi 9

Critical Section Lebih dari satu proses berlomba-lomba pada saat yang sama untuk menggunakan data yang sama. Setiap proses memiliki segmen kode yang digunakan untuk mengakses data yang digunakan secara bersama-sama. Segmen kode tersebut disebut critical section. Masalahnya: menjamin bahwa jika suatu proses sedang menjalankan critical section, maka proses lain tidak boleh masuk ke dalam critical section tersebut. 10

Solusi Masalah Critical Section Peterson s Algorithm The two processes share two variables: int turn; Boolean flag[2]; Boolean flag[2]; The variable turn indicates whose turn it is to enter the critical section. The flag array is used to indicate if a process is ready to enter the critical section. flag[i] = true implies that process Pi is ready! 11

Algorithm for Process Pi while (true) { flag[i] = TRUE; turn = j; while ( flag[j] && turn == j); CRITICAL SECTION flag[i] = FALSE; REMAINDER SECTION } Mutual exclusion, progress, and bounded waiting! If P0 want to access critical section, P0 will set flag[0] to true and turn to P1. 12

Bakery Algorithm Critical section for: n processes Sebelum memasuki critical section, setiap proses menerima sebuah nomor. Yang memegang ID terkecil yang dilayani dahulu. Skema penomoran selalu naik secara berurut, contoh: 1, 2, 2, 2, 3, 3, 4, 5 Diperkenalkan pertama kali oleh Leslie Lamport. Data yang digunakan bersama boolean choosing [n]; int number [n]; Struktur data diinisialisi awal ke false dan 0. (a,b) < (c,d) jika a < c atau jika a = c dan b < d 13

Contoh : Bakery Algorithm Lihat Whiteboard 14

Sinkronisasi Metode dalam sinkronisasi hardware Processor Synchronous ( Disable Interrupt ) Memory Synchronous ( Instruksi Test-And-Set ) Processor synchronous Dengan men-disable interupsi (interrupt) Dalam lingkungan multiprocessor: Hanya satu processor bisa didisable interruptnya Memory synchronous Instruksi Test-And-Set dan Semaphore Dalam lingkungan multiprocessor: Bisa dilakukan Semua processor tidak dapat memakai resource karena proteksi dilakukan di memory Instruksi harus bersifat atomik 15

Mutual Exclusion : Memory synchronous Kelebihan : Dapat diaplikasikan ke beberapa prosesor, dengan sharing memory Simpel Dapat digunakan untuk banyak critical section Kekurangan : Busy-waiting memakan processor time yang besar Mungkin terjadi starvation Deadlock (not responding) * Jika low priority process mendapat critical region dan higher priority process butuh juga, higher priority process akan mendapat processor dan low priority process akan menunggu 16

Semaphore Invented by Djikstra (1960) Semaphore digunakan untuk memberi sinyal/tanda Non negative integer, untuk melambangkan jumlah resources Jika proses menunggu sinyal, maka dia akan ditunda sampai sinyal yg ditunggu Jika proses menunggu sinyal, maka dia akan ditunda sampai sinyal yg ditunggu tersebut terkirim Operasi: wait dan signal Wait dan signal operations tidak dapat diinterupt Queue digunakan untuk menahan proses proses yang sedang menunggu semaphore 17

Semaphore, lanjutan Two standard operations modify S: wait() and signal() Originally called P() and V() Can only be accessed via two indivisible (atomic) operations Semaphore: Wait Semaphore: Wait Spinlock Semaphore: Wait Semaphore: Wait non spinlock Semaphore: Signal Contoh Semaphore & Implementasi Lihat whiteboard 18

Reader & Writers Diketahui dua macam proses: Pembaca (reader) Penulis (writer) Kedua jenis proses berbagi sumber daya penyimpanan yang sama, Misal: Basis data Tujuan: data tidak korup dan inkonsisten Kondisi: Proses-proses pembaca dapat membaca sumber daya secara simultan Hanya boleh ada satu penulis menulis pada setiap saat Bila ada yang menulis, tidak boleh ada yang membaca Contoh Reader Writers (Shared Data), Lihat whiteboard 19

Shared Data Data set Semaphore mutex initialized to 1, tanda mutual exclusion Semaphore wrt initialized to 1, tanda Semaphore wrt initialized to 1, tanda untuk menulis Integer readcount initialized to 0, tanda untuk membaca 20

Dining Philosopher Diketahui: Mie (Data) Sebuah meja bundar N filsuf duduk melingkar di meja bundar Antara dua filsuf terdapat sebuah sumpit Didepan setiap filsuf terdapat semangkuk mie Setiap filsuf hanya dapat berada pada salah satu kondisi berikut: Berpikir Lapar Makan 21

Dining Philosopher, lanjutan Shared data Bowl of rice (data set) Semaphore chopstick [5] initialized to 1 Dua hal yang harus diperhatikan: Dua hal yang harus diperhatikan: Deadlock: Semua filsuf ingin makan dan telah memegang sumpit Starvation: Ada filsuf yang kelaparan dalam waktu yang lama 22

The Structure of Philosopher i Philosopher I While (true) { wait ( chopstick[i] ); //kanan wait ( chopstick[ (i + 1) % 5] ); //kiri // eat signal ( chopstick[i] ); //kanan signal (chopstick[ (i + 1) % 5] ); //kiri // think } 23

*** Minggu Depan Penjadwalan CPU 24