Matakuliah Tahun Versi/Revisi : T0316/sistem Operasi : 2005 :5 Pertemuan 24 Sistem Operasi Unix 1 Learning Outcomes Pada akhir pertemuan ini, diharapkan mahasiswa akan mampu : • mendemonstrasikan sistem operasi Linux, dari manajemen proses, memory, file sampai dengan I/O (C3) 2 Outline Materi • • • • • • • Sejarah Unix Overview Unix Shell Program Utiliti Proses pada Unix System Call System memory dan I/O pada Unix 3 LINUX • Sejarah Unix – Unics – PDP 11 Unix – Portable Unix – Barkeley Unix – Standar Unix – MINIX – LINUX 4 Overview of Unix • UNIX Goals – UNIX is an interactive system designed to handle multiple processes and multiple users at the same time. – It was designed by programmers, for programmers, to use in an environment in which the majority of the users are relatively sophisticated and are engaged in software development projects – Extensive facilities to work together 5 Interfaces to UNIX The layers of a UNIX system. 6 UNIX Kernel Approximate structure of generic UNIX kernel 7 Booting UNIX cp The sequences of processes used to boot some systems 8 SHELL • • • • • • • • Program Login Prompt Command Argument Redirect Pipe Shell Script Background process 9 Contoh • • • • • • • • • cp src dest head –20 file ls x.c y.c z.c sort < in > out sort < in > temp; head –30 < temp; rm temp sort < in | head –30 grep ter *.t | sort | head –20 | tail –5 > foo wc –l < a > B & sort < x | head & 10 Program Utiliti • • • • • • Manipulasi file dan direktori Filter Tool untuk pengembangan program Text processing Sistem administrator dll 11 UNIX Utility Programs A few of the more common UNIX utility programs required by POSIX 12 Process pada Unix • • • • • • • • • • • Sistem multiprogramming Daemonds Cron daemonds System fork Process parent PID Pohon process signal Group process UID Superuser (root) 13 System Calls for Process Management s is an error code pid is a process ID residual is the remaining time from the previous alarm14 POSIX Shell A highly simplified shell 15 Implementasi Process • Process Table (always in memory) – – – – Parameter scheduling Memory map Signal Etc • User Structure (only in memory when the program is executed) – Machine registers – System call state – File descriptor table – Accounting – Stack kernel 16 Handling Memory Process A Process B • Process A's virtual address space • Physical memory • Process B's virtual address space 17 Sharing Files Two processes can share a mapped file. A new file mapped simultaneously into two processes 18 Implementation of memory management • Swapping Tiga hal yang menyebabkan swapping ke disk 1. Fork 2. BRK (request for memory) 3. Stack increase 19 Implementation (2) Paging in UNIX •Page daemon •Core map information about the contents of page frame The core map in 4BSD 20 Implementation (3) • Page replacement algorithm Two handed clock – Two pointers – First, it clear the usage bit at the front end, and – Then, check the usage bit at the back hand • If two hands are kept close together, then only very heavily used pages have their R-bit stay 1 (after being zero-ed by the front hand) 21