sistem operasi - 2

49
Sistem Operasi - 2 Sistem operasi Miracle God Answers Prayer in 3 Ways : 1. God Say YES and Gives You What U Want. 2. God Say No n Gives You Something Better Or 3. God Say WAIT n Gives You the Best

Upload: alexis-guerrero

Post on 03-Jan-2016

136 views

Category:

Documents


1 download

DESCRIPTION

Miracle God Answers Prayer in 3 Ways : 1. God Say YES and Gives You What U Want. 2. God Say No n Gives You Something Better Or 3. God Say WAIT n Gives You the Best. Sistem Operasi - 2. Sistem operasi. Definisi SO. Dari sudut pandang user - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Sistem Operasi - 2

Sistem Operasi - 2Sistem operasi

Miracle God Answers Prayer in 3 Ways : 1. God Say YES and Gives You What U Want.2. God Say No n Gives You Something Better Or3. God Say WAIT n Gives You the Best

Page 2: Sistem Operasi - 2

Definisi SO

• Dari sudut pandang user– Sistem Operasi sebagai alat untuk mempermudah penggunaan

Komputer– Sistem Operasi sebagai alat untuk memaksimalkan

penggunaan sumber daya komputer (dalam lingkungan multi-user)

• Dari sudut pandang sistem– Sistem Operasi sebagai alat yang menempatkan sumber daya

secara efisien (Resource Allocator)– Sistem Operasi sebagai alat yang mangatur eksekusi aplikasi

dan operasi dari alat I/O (Control Program)– Sistem Operasi sebagai sebuah program yang selalu berjalan

setiap saat pada komputer (Kernel)

Page 3: Sistem Operasi - 2

Layanan SO• Menyediakan layanan kepada user:

• User interface - hampir semua SO ada GUI-nya– Varies between Command-Line (CLI), Graphics User

Interface (GUI), Batch

• Program execution - SO harus bisa meload program ke memory dan mengeksekusinya, menghentikan eksekusi program, baik normal maupun tidak normal (abnormal exit)

• I/O operations - Program yang sedang berjalan butuh I/O, baik mengakses file ataupun I/O device

• File-system manipulation - Programs butuh read dan write baik file atau directories, create dan delete, search file/dir, list file information, dan permission management.

Page 4: Sistem Operasi - 2

Layanan SO

– Communications - proses harus berkomunikasi antar proses dalam komputer yang sama atau antar komputer dalam jaringan

• Menggunakan shared memory atau menggunakan message passing

– Error detection - harus mampu menangani error• Dalam terjadi pada CPU, memory hardware, dalam

I/O devices, dan dalam user program• Untuk setiap error, OS harus menanganinya dengan

aksi yang sesuai, benar, dan konsisten• Harus adanya fasilitas debugging

Page 5: Sistem Operasi - 2

Layanan SO

– Resource alocation - ketika multiple users atau multiple jobs berjalan bersama-sama (concurent), resources harus dialokasikan

– Accounting - menentukan berapa banyak dan berapa lama users menggunakan sumber daya sistem

– Protection and security• Protection menyakinkan hak akses yang

diperbolehkan• Security sistem, baik program atau I/O dari pihak luar

menggunakan autentikasi.

Page 6: Sistem Operasi - 2

Sejarah SO

• Generasi ke-0 (1940)– Tabung hampa; blm ada sistem operasi; plug board

• Generasi ke-1 (1950)– Komponen utama transistor; sistem batch; punch card

• Generasi ke-2 (1960)– Komponen utama IC; konsep: multi programming, multi

processing, spooling, real time• Generasi ke-3 (1970)

– VLSI (very larga scalable integrated circuit)– General purpose

• Genrasi ke-4 (1970 –now)– PC; sistem operasi jaringan; cloud computing; GUI friendly

Page 7: Sistem Operasi - 2

Command Line Interpreter

• Sistem Operasi menunggu instruksi dari pengguna (command driven). – Sometimes commands built-in, sometimes just

names of programs• If the latter, adding new features doesn’t require shell

modification• CLI: Program yang membaca instruksi dan mengartikan

control statements (keinginan user) umumnya disebut: – control-card interpreter– command-line interpreter– UNIX shell.

Page 8: Sistem Operasi - 2

User Operating System Interface - GUI

• User-friendly desktop metaphor interface– Menggunakan mouse, keyboard, and monitor– Icons merepresentasikan files, programs, actions, dll– Menggunakan directory = folder– Invented at Xerox PARC

• SO sekarang menggunakan antara CLI dan GUI interfaces– Microsoft Windows is GUI with CLI “command” shell– Apple Mac OS X as “Aqua” GUI interface with UNIX kernel

underneath and shells available– Solaris is CLI with optional GUI interfaces (Java Desktop, KDE)

Page 9: Sistem Operasi - 2

Sistem Calls

• System calls menyediakan interface antara proses (program yang sedang dijalankan) dan sistem operasi.

• Biasanya dibuat menggunakan bahasa tingkat tinggi (C or C++)

• Diakses menggunakan Application Program Interface (API) daripada pemanggilan langsung

• 3 API yang umum adalah: – Win32 API for Windows, – POSIX API for POSIX-based systems (including virtually all

versions of UNIX, Linux, and Mac OS X), – Java API for the Java virtual machine (JVM)

Page 10: Sistem Operasi - 2

Example of System Calls

• System call sequence to copy the contents of one file to another file

Page 11: Sistem Operasi - 2

Example of Standard API

• Consider the ReadFile()function in the

• Win32 API—a function for reading from a file

• A description of the parameters passed to ReadFile()

– HANDLE file—the file to be read

– LPVOID buffer—a buffer where the data will be read into and written from

– DWORD bytesToRead—the number of bytes to be read into the buffer

– LPDWORD bytesRead—the number of bytes read during the last read

– LPOVERLAPPED ovl—indicates if overlapped I/O is being used

Page 12: Sistem Operasi - 2

System Call implementation

• The caller need know nothingabout how the system call is implemented– Just needs to obey APIand understand what OS will do as a

result call– Most details of OS interface hiddenfrom programmer by API

• Managed by run-time support library(set of functions built into libraries included with compiler)

Page 13: Sistem Operasi - 2

API - System Call - OS Relationship

Page 14: Sistem Operasi - 2

Standard C Library Example

• C program invoking printf() library call, which calls write() system call

Page 15: Sistem Operasi - 2

System Calls

• Tiga metode umum yang digunakan dalam memberikan parameter kepada sistem operasi– Melalui registers

• In some cases, may be more parameters than registers– Menyimpan parameter dalam block atau tabel pada memori dan

alamat block tsb diberikan sebagai parameter dalam register• This approach taken by Linux and Solaris

– Menyimpan parameter (push) ke dalam stack (oleh program), dan melakukan pop off pada stack (oleh sistem operasi)

Page 16: Sistem Operasi - 2

Parameter Passing via Table

Page 17: Sistem Operasi - 2

Jenis System Calls - System Program

• Process Control• Manajemen file• Manajemen Device • Information Maintenance• Komunikasi• Proteksi• Biasanya digunakan pada system program

Page 18: Sistem Operasi - 2

Process Control

• Selesai, abort• Load, eksekusi• Membuat dan men-terminate proses• Mengambil dan men-set process attributes • Wait for time• Wait event, signal event• Allocate and free memory

Page 19: Sistem Operasi - 2

MS - DOS execution

Page 20: Sistem Operasi - 2

FreeBSD Running Multiple Programs

Page 21: Sistem Operasi - 2

Manajemen File

• Membuat dan menghapus file• Membuka dan menutup file• Read, write, reposition • Mengambil dan men-set file attributes

Page 22: Sistem Operasi - 2

Manajemen Device

• Meminta device, melepaskan device• Read, write, reposition• Mengambil dan men-set device attributes• Logically attach or detach device (mount / umount)

Page 23: Sistem Operasi - 2

Information Maintenance

• Mengambil dan men-set waktu dan tanggal• Men-set proses, file, or device attributes

Page 24: Sistem Operasi - 2

Komunikasi

• Menciptakan, menghapus hubungan komunikasi• Mengirim dan menerima pesan• Mentransfer status informasi• Attach atau detach remote device• Komunikasi dapat dilakukan melalui message passing atau

shared memory

Page 25: Sistem Operasi - 2

Operating System Design & Implementation • Design and Implementation of OS not “solvable”, but some

approaches have proven successful• Internal structure of different Operating Systems can vary

widely• Start by defining goalsand specifications• Affected by choice of hardware, type of system• Usergoals and Systemgoals

– User goals–operating system should be convenient to use, easy to learn, reliable, safe, and fast

– System goals–operating system should be easy to design, implement, and maintain, as well as flexible, reliable, error-free, and efficient

Page 26: Sistem Operasi - 2

Operating System Design & Implementation • Important principle to separate

• Policy: What will be done?• Mechanism: How to do it?

• Mechanisms determine how to do something, policies decide what will be done

Page 27: Sistem Operasi - 2

Struktur Sistem Operasi

• Struktur Sederhana– Tidak dibagi dalam modul-modul– Contoh : Struktur sistem MS-DOS:

• disusun untuk mendukung fungsi yang banyak pada space yang kecil

• Metode pendekatan Layer / Level– Contoh: UNIX, terdiri dari kernel (berisi device driver dan

interface) dan program

• Mikrokernel– Menyusun sistem operasi dengan menghapus semua

komponen yang tidak esensial dari kernel, dan mengimplementasikannya sebagai sistem program pada user-level

• Modular

Page 28: Sistem Operasi - 2

MS – DOS Structure Layer

Page 29: Sistem Operasi - 2

Traditional UNIX System Structure

Page 30: Sistem Operasi - 2

Layered Operating System

• Layer adalah implementasi dari object abstrak yang merupakan enkapsulasi dari data dan operasi yang bisa memanipulasi data tersebut

• Layer paling bawah : hardware

• Layer paling atas : user interface

Page 31: Sistem Operasi - 2

Layered OS

• Keuntungan: – Modularitas– mempermudah debug dan verifikasi sistem– layer pertama bisa didebug tanpa mengganggu

sistem yang lain• Kesulitan:

– hanya bisa menggunakan layer dibawahnya

Page 32: Sistem Operasi - 2

Mikrokernel

• Fungsi utama: mendukung fasilitas komunikasi antara program user dan bermacam-macam layanan yang juga berjalan di user-space

• Kernel menjadi lebih kecil• Komunikasi melalui message passing• Keuntungan:

– ketika layanan baru akan ditambahkan ke user-space, kernel tidak perlu di modif

– mendukung keamanan reliabilitas lebih, karena sebagian besar pada level pengguna, SO jadi terjaga

• Contoh sistem operasi :– Tru64 UNIX, MacOSX, QNX

Page 33: Sistem Operasi - 2

Monolithic vs Microkernel

Page 34: Sistem Operasi - 2

Mac OS X Structure

Page 35: Sistem Operasi - 2

Modules

• Most modern operating systems implement kernel modules– Uses object-oriented approach– Each core component is separate– Each talks to the others over known interfaces– Each is loadable as needed within the kernel

• Overall, similar to layers but with more flexible

Page 36: Sistem Operasi - 2

Solaris Modular Approach

Page 37: Sistem Operasi - 2

Virtual Machine

• Mesin virtual mengambil pendekatan layer secara logika.

• Mesin virtual memperlakukan hardware dan sistem operasi seolah-olah berada pada level yang sama sebagai hardware.

• Pendekatan Mesin virtual menyediakan sebuah interface yang identik dengan seluruh hardware yang ada.

• Sistem Operasi host membuat ilusi dari banyak proses, masing-masing dieksekusi pada prosesornya sendiri dengan virtual memorinya sendiri.

• Setiap guest menyediakan sebuah (virtual) copy dari semua hal yang ada pada komputer.

• VM dibuat dengan pembagian sumber daya oleh physical computer

• •VM ada 2: system VM dan application VM

Page 38: Sistem Operasi - 2

Virtual Machine (2)

• Sumber daya dari fisik dibagi untuk membuat VM:– Penjadwalan CPU bisa menciptakan penampilan seakan user

mempunyai prosesor sendiri– Spooling bisa menyediakan virtual card readers dan virtual line

printers– Sebuah time-sharing terminal,yang dapat melayani user dengan

tepat

• VM software membutuhkan disk space untuk menyediakan Virtual memory dan spooling, yaitu sebuah virtual disk

Page 39: Sistem Operasi - 2

Virtual Machines History and Benefits

• First appeared commercially in IBM mainframes in 1972• Fundamentally, multiple execution environments

(different operating systems) can share the same hardware• Protect from each other• Some sharing of file can be permitted, controlled• Commutate with each other, other physical systems via

networking• Useful for development, testing• “Open Virtual Machine Format”, standard format of virtual

machines, allows a VM to run within many different virtual machine (host) platforms

Page 40: Sistem Operasi - 2

Keuntungan VM

• Keamanan bukanlah masalah– VM mempunyai pelindungan lengkap pada berbagai sistem

sumber daya– Tidak ada pembagian sumber daya secara langsung

• VM sistem adalah kendaraan yang “sempurna” untuk penelitian dan pengembangan sistem operasi– Dengan VM perubahan suatu bagian tidak akan mempengaruhi

komponen yang lain

Page 41: Sistem Operasi - 2

Kerugian VM

• VM sulit diimplementasikan karena banyak syarat yang dibutuhkan untuk menyediakan duplikat yang tepat dari mesin host– Harus punya virtual-user mode dan virtual-monitor mode yang

keduanya berjalan di pysichal mode. – Akibatnya, saat instruksi yang hanya membutuhkan virtual

monitor mode dijalankan, register berubah dan bisa berefek pada virtual user mode, bahkan bisa me-restart VM

• Waktu yang dibutuhkan I/O bisa lebih cepat(karena ada spooling), tapi bisa lebih lambat (karena diinterpreted)

Page 42: Sistem Operasi - 2

Virtual Machines ( Cont)

Page 43: Sistem Operasi - 2

VMware Architecture

Page 44: Sistem Operasi - 2

VMWare

Page 45: Sistem Operasi - 2

Java Virtual Machine

• Program Java yang telah dicompile adalah platform-neutral bytecodes yang dieksekusi oleh Java Virtual Machine(JVM)

• JVM terdiri dari:– Class loader– Class verificatier– runtime interpreter

• Just In-Time(JIT) compilers meningkatkan performance

Page 46: Sistem Operasi - 2

The Java Virtual Machine

Page 47: Sistem Operasi - 2

System Generation / Firmware

• Sistem operasi dirancang untuk dapat dijalankan pada berbagai jenis mesin, sistemnya harus dikonfigurasikan untuk setiap komputer.

• Program Sysgen mendapatkan informasi mengenai konfigurasi khusus tentang sistem hardware dari sebuah data, antara lain sebagai berikut:– CPU apa yang digunakan, opsi yang ada– Berapa banyak memori yang tersedia– Peralatan yang tersedia– Sistem operasi opsi apa yang diinginkan atau parameter apa

yang digunakan

Page 48: Sistem Operasi - 2

Operating-System Debugging

• Debugging is finding and fixing errors, or bugs

• OSgenerate log files containing error information

• Failure of an application can generate core dump file capturing memory of the process

• Operating system failure can generate crash dump file containing kernel memory

• Beyond crashes, performance tuning can optimize system performance

• Kernighan’s Law: “Debugging is twice as hard as writing the code in the firstplace. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.”

• DTracetool in Solaris, FreeBSD, Mac OS X allows live instrumentation on production systems– Probes fire when code is executed, capturing state data and sending

it to consumers of those probes

Page 49: Sistem Operasi - 2

System Boot

• Operating system must be made available to hardware, so hardware can start it– Small piece of code – bootstrap loader, locates the kernel, loads it

into memory, and starts it– bootblock atfixed location loads bootstrap loader– When power initialized on system, execution starts at a fixed

memory location• Firmware used to hold initial boot code