Mata Kuliah Sistem Operasi Materi - 4, Struktur Sistem Operasi
Sistem Operasi 2
-
Upload
owen-clark -
Category
Documents
-
view
31 -
download
0
description
Transcript of Sistem Operasi 2
![Page 1: Sistem Operasi 2](https://reader035.fdokumen.com/reader035/viewer/2022062422/568135db550346895d9d4cf7/html5/thumbnails/1.jpg)
Sistem Operasi Sistem Operasi 22
““Sistem operasi”Sistem operasi”
![Page 2: Sistem Operasi 2](https://reader035.fdokumen.com/reader035/viewer/2022062422/568135db550346895d9d4cf7/html5/thumbnails/2.jpg)
Definisi SODefinisi 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](https://reader035.fdokumen.com/reader035/viewer/2022062422/568135db550346895d9d4cf7/html5/thumbnails/3.jpg)
Layanan SOLayanan 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](https://reader035.fdokumen.com/reader035/viewer/2022062422/568135db550346895d9d4cf7/html5/thumbnails/4.jpg)
Layanan SOLayanan 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](https://reader035.fdokumen.com/reader035/viewer/2022062422/568135db550346895d9d4cf7/html5/thumbnails/5.jpg)
Layanan SOLayanan SO
– Resource allocation – 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](https://reader035.fdokumen.com/reader035/viewer/2022062422/568135db550346895d9d4cf7/html5/thumbnails/6.jpg)
Sejarah SOSejarah 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, time sharing, 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](https://reader035.fdokumen.com/reader035/viewer/2022062422/568135db550346895d9d4cf7/html5/thumbnails/7.jpg)
Command Line InterpreterCommand 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](https://reader035.fdokumen.com/reader035/viewer/2022062422/568135db550346895d9d4cf7/html5/thumbnails/8.jpg)
User Operating System Interface - GUIUser 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](https://reader035.fdokumen.com/reader035/viewer/2022062422/568135db550346895d9d4cf7/html5/thumbnails/9.jpg)
Sistem CallsSistem 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](https://reader035.fdokumen.com/reader035/viewer/2022062422/568135db550346895d9d4cf7/html5/thumbnails/10.jpg)
System Call implementationSystem Call implementation• The caller need know nothing
about how the system call is implemented– Just needs to obey API and understand
what OS will do as a result call– Most details of OS interface hidden
from programmer by API • Managed by run-time support library (set
of functions built into libraries included with compiler)
![Page 11: Sistem Operasi 2](https://reader035.fdokumen.com/reader035/viewer/2022062422/568135db550346895d9d4cf7/html5/thumbnails/11.jpg)
Example of System CallsExample of System Calls
• System call sequence to copy the contents of one file to another file
![Page 12: Sistem Operasi 2](https://reader035.fdokumen.com/reader035/viewer/2022062422/568135db550346895d9d4cf7/html5/thumbnails/12.jpg)
Example of Standard APIExample 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 13: Sistem Operasi 2](https://reader035.fdokumen.com/reader035/viewer/2022062422/568135db550346895d9d4cf7/html5/thumbnails/13.jpg)
API – System Call – OS RelationshipAPI – System Call – OS Relationship
![Page 14: Sistem Operasi 2](https://reader035.fdokumen.com/reader035/viewer/2022062422/568135db550346895d9d4cf7/html5/thumbnails/14.jpg)
Standard C Library ExampleStandard C Library Example
• C program invoking printf() library call, which calls write() system call
![Page 15: Sistem Operasi 2](https://reader035.fdokumen.com/reader035/viewer/2022062422/568135db550346895d9d4cf7/html5/thumbnails/15.jpg)
System CallsSystem Calls• Tiga metode umum yang digunakan dalam
memberikan parameter kepada sistem operasi– Melalui registers– Menyimpan parameter dalam block atau
tabel pada memori dan alamat block tsb diberikan sebagai parameter dalam register
– Menyimpan parameter (push) ke dalam stack (oleh program), dan melakukan pop off pada stack (oleh sistem operasi)
![Page 16: Sistem Operasi 2](https://reader035.fdokumen.com/reader035/viewer/2022062422/568135db550346895d9d4cf7/html5/thumbnails/16.jpg)
Parameter Passing via TableParameter Passing via Table
![Page 17: Sistem Operasi 2](https://reader035.fdokumen.com/reader035/viewer/2022062422/568135db550346895d9d4cf7/html5/thumbnails/17.jpg)
Tipe System CallsTipe System Calls• Process Control• Manajemen file• Manajemen Device • Information Maintenance• Komunikasi• Proteksi
• Biasanya digunakan dalam system program
![Page 18: Sistem Operasi 2](https://reader035.fdokumen.com/reader035/viewer/2022062422/568135db550346895d9d4cf7/html5/thumbnails/18.jpg)
Process ControlProcess 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](https://reader035.fdokumen.com/reader035/viewer/2022062422/568135db550346895d9d4cf7/html5/thumbnails/19.jpg)
MS-DOS executionMS-DOS execution
(a) At system startup (b) running a program
![Page 20: Sistem Operasi 2](https://reader035.fdokumen.com/reader035/viewer/2022062422/568135db550346895d9d4cf7/html5/thumbnails/20.jpg)
FreeBSD Running Multiple ProgramsFreeBSD Running Multiple Programs
![Page 21: Sistem Operasi 2](https://reader035.fdokumen.com/reader035/viewer/2022062422/568135db550346895d9d4cf7/html5/thumbnails/21.jpg)
Manajemen FileManajemen File• Membuat dan menghapus file• Membuka dan menutup file• Read, write, reposition • Mengambil dan men-set file
attributes
![Page 22: Sistem Operasi 2](https://reader035.fdokumen.com/reader035/viewer/2022062422/568135db550346895d9d4cf7/html5/thumbnails/22.jpg)
Manajemen DeviceManajemen 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](https://reader035.fdokumen.com/reader035/viewer/2022062422/568135db550346895d9d4cf7/html5/thumbnails/23.jpg)
Information MaintenanceInformation Maintenance• Mengambil dan men-set waktu dan
tanggal• Men-set proses, file, or device
attributes
![Page 24: Sistem Operasi 2](https://reader035.fdokumen.com/reader035/viewer/2022062422/568135db550346895d9d4cf7/html5/thumbnails/24.jpg)
KomunikasiKomunikasi• 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](https://reader035.fdokumen.com/reader035/viewer/2022062422/568135db550346895d9d4cf7/html5/thumbnails/25.jpg)
Operating System Design & Operating System Design & ImplementationImplementation
• 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 goals and specifications • Affected by choice of hardware, type of system• User goals and System goals
– 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](https://reader035.fdokumen.com/reader035/viewer/2022062422/568135db550346895d9d4cf7/html5/thumbnails/26.jpg)
Operating System Design & Operating System Design & ImplementationImplementation
• Important principle to separatePolicy: What will be done? Mechanism: How to do it?
• Mechanisms determine how to do something, policies decide what will be done– The separation of policy from mechanism is a
very important principle, it allows maximum flexibility if policy decisions are to be changed later
![Page 27: Sistem Operasi 2](https://reader035.fdokumen.com/reader035/viewer/2022062422/568135db550346895d9d4cf7/html5/thumbnails/27.jpg)
Struktur Sistem OperasiStruktur 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 dan user-level
• Modular
![Page 28: Sistem Operasi 2](https://reader035.fdokumen.com/reader035/viewer/2022062422/568135db550346895d9d4cf7/html5/thumbnails/28.jpg)
MS-DOS Layer StructureMS-DOS Layer Structure
![Page 29: Sistem Operasi 2](https://reader035.fdokumen.com/reader035/viewer/2022062422/568135db550346895d9d4cf7/html5/thumbnails/29.jpg)
Traditional UNIX System StructureTraditional UNIX System Structure
![Page 30: Sistem Operasi 2](https://reader035.fdokumen.com/reader035/viewer/2022062422/568135db550346895d9d4cf7/html5/thumbnails/30.jpg)
Layered Operating SystemLayered Operating System
• Layer adalah implementasi dari object abstrak yang merupakan enkapsulasi daridata dan operasi yang bisa memanipulasidata tersebut• Layer paling bawah : hardware• Layer paling atas : user interface
![Page 31: Sistem Operasi 2](https://reader035.fdokumen.com/reader035/viewer/2022062422/568135db550346895d9d4cf7/html5/thumbnails/31.jpg)
Layered OSLayered 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](https://reader035.fdokumen.com/reader035/viewer/2022062422/568135db550346895d9d4cf7/html5/thumbnails/32.jpg)
MikrokernelMikrokernel• Fungsi utama: mendukung fasilitas komunikasi
antara program klien 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](https://reader035.fdokumen.com/reader035/viewer/2022062422/568135db550346895d9d4cf7/html5/thumbnails/33.jpg)
Mac OS X StructureMac OS X Structure
![Page 34: Sistem Operasi 2](https://reader035.fdokumen.com/reader035/viewer/2022062422/568135db550346895d9d4cf7/html5/thumbnails/34.jpg)
ModulesModules• 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 35: Sistem Operasi 2](https://reader035.fdokumen.com/reader035/viewer/2022062422/568135db550346895d9d4cf7/html5/thumbnails/35.jpg)
Solaris Modular ApproachSolaris Modular Approach
![Page 36: Sistem Operasi 2](https://reader035.fdokumen.com/reader035/viewer/2022062422/568135db550346895d9d4cf7/html5/thumbnails/36.jpg)
Virtual MachineVirtual 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 37: Sistem Operasi 2](https://reader035.fdokumen.com/reader035/viewer/2022062422/568135db550346895d9d4cf7/html5/thumbnails/37.jpg)
Virtual Machine (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 38: Sistem Operasi 2](https://reader035.fdokumen.com/reader035/viewer/2022062422/568135db550346895d9d4cf7/html5/thumbnails/38.jpg)
Virtual Machines History and BenefitsVirtual 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 39: Sistem Operasi 2](https://reader035.fdokumen.com/reader035/viewer/2022062422/568135db550346895d9d4cf7/html5/thumbnails/39.jpg)
Keuntungan VMKeuntungan 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 40: Sistem Operasi 2](https://reader035.fdokumen.com/reader035/viewer/2022062422/568135db550346895d9d4cf7/html5/thumbnails/40.jpg)
Kerugian VMKerugian 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 41: Sistem Operasi 2](https://reader035.fdokumen.com/reader035/viewer/2022062422/568135db550346895d9d4cf7/html5/thumbnails/41.jpg)
Virtual Machines (Cont)Virtual Machines (Cont)
Non-virtual Machine Virtual Machine
(a) Nonvirtual machine (b) virtual machine
![Page 42: Sistem Operasi 2](https://reader035.fdokumen.com/reader035/viewer/2022062422/568135db550346895d9d4cf7/html5/thumbnails/42.jpg)
VMware ArchitectureVMware Architecture
![Page 43: Sistem Operasi 2](https://reader035.fdokumen.com/reader035/viewer/2022062422/568135db550346895d9d4cf7/html5/thumbnails/43.jpg)
VMWareVMWare
![Page 44: Sistem Operasi 2](https://reader035.fdokumen.com/reader035/viewer/2022062422/568135db550346895d9d4cf7/html5/thumbnails/44.jpg)
Java Virtual MachineJava 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 45: Sistem Operasi 2](https://reader035.fdokumen.com/reader035/viewer/2022062422/568135db550346895d9d4cf7/html5/thumbnails/45.jpg)
The Java Virtual MachineThe Java Virtual Machine
![Page 46: Sistem Operasi 2](https://reader035.fdokumen.com/reader035/viewer/2022062422/568135db550346895d9d4cf7/html5/thumbnails/46.jpg)
System GenerationSystem Generation• 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 47: Sistem Operasi 2](https://reader035.fdokumen.com/reader035/viewer/2022062422/568135db550346895d9d4cf7/html5/thumbnails/47.jpg)
Operating-System Operating-System DebuggingDebugging
• Debugging is finding and fixing errors, or bugs• OS generate 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 first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.”
• DTrace tool 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 48: Sistem Operasi 2](https://reader035.fdokumen.com/reader035/viewer/2022062422/568135db550346895d9d4cf7/html5/thumbnails/48.jpg)
System BootSystem 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
– boot block at fixed location loads bootstrap loader
– When power initialized on system, execution starts at a fixed memory location• Firmware used to hold initial boot code
![Page 49: Sistem Operasi 2](https://reader035.fdokumen.com/reader035/viewer/2022062422/568135db550346895d9d4cf7/html5/thumbnails/49.jpg)
NEXTNEXT• Process