1 pertemuan 24 sistem operasi unix matakuliah: t0316/sistem operasi tahun: 2005 versi/revisi: 5

21
1 Pertemuan 24 Sistem Operasi Unix Matakuliah : T0316/sistem Operasi Tahun : 2005 Versi/Revisi : 5

Post on 19-Dec-2015

223 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 1 Pertemuan 24 Sistem Operasi Unix Matakuliah: T0316/sistem Operasi Tahun: 2005 Versi/Revisi: 5

1

Pertemuan 24Sistem Operasi Unix

Matakuliah : T0316/sistem Operasi

Tahun : 2005

Versi/Revisi : 5

Page 2: 1 Pertemuan 24 Sistem Operasi Unix Matakuliah: T0316/sistem Operasi Tahun: 2005 Versi/Revisi: 5

2

Learning Outcomes

Pada akhir pertemuan ini, diharapkan mahasiswa

akan mampu :• mendemonstrasikan sistem operasi Linux, dari

manajemen proses, memory, file sampai dengan I/O (C3)

Page 3: 1 Pertemuan 24 Sistem Operasi Unix Matakuliah: T0316/sistem Operasi Tahun: 2005 Versi/Revisi: 5

3

Outline Materi

• Sejarah Unix• Overview Unix• Shell• Program Utiliti• Proses pada Unix• System Call• System memory dan I/O pada Unix

Page 4: 1 Pertemuan 24 Sistem Operasi Unix Matakuliah: T0316/sistem Operasi Tahun: 2005 Versi/Revisi: 5

4

LINUX

• Sejarah Unix– Unics– PDP 11 Unix– Portable Unix– Barkeley Unix– Standar Unix– MINIX– LINUX

Page 5: 1 Pertemuan 24 Sistem Operasi Unix Matakuliah: T0316/sistem Operasi Tahun: 2005 Versi/Revisi: 5

5

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

Page 6: 1 Pertemuan 24 Sistem Operasi Unix Matakuliah: T0316/sistem Operasi Tahun: 2005 Versi/Revisi: 5

6

Interfaces to UNIX

The layers of a UNIX system.

Page 7: 1 Pertemuan 24 Sistem Operasi Unix Matakuliah: T0316/sistem Operasi Tahun: 2005 Versi/Revisi: 5

7

UNIX Kernel

Approximate structure of generic UNIX kernel

Page 8: 1 Pertemuan 24 Sistem Operasi Unix Matakuliah: T0316/sistem Operasi Tahun: 2005 Versi/Revisi: 5

8

Booting UNIX

The sequences of processes used to boot some systems

cp

Page 9: 1 Pertemuan 24 Sistem Operasi Unix Matakuliah: T0316/sistem Operasi Tahun: 2005 Versi/Revisi: 5

9

SHELL

• Program Login

• Prompt

• Command

• Argument

• Redirect

• Pipe

• Shell Script

• Background process

Page 10: 1 Pertemuan 24 Sistem Operasi Unix Matakuliah: T0316/sistem Operasi Tahun: 2005 Versi/Revisi: 5

10

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 &

Page 11: 1 Pertemuan 24 Sistem Operasi Unix Matakuliah: T0316/sistem Operasi Tahun: 2005 Versi/Revisi: 5

11

Program Utiliti

• Manipulasi file dan direktori

• Filter

• Tool untuk pengembangan program

• Text processing

• Sistem administrator

• dll

Page 12: 1 Pertemuan 24 Sistem Operasi Unix Matakuliah: T0316/sistem Operasi Tahun: 2005 Versi/Revisi: 5

12

UNIX Utility Programs

A few of the more common UNIX utility programs required by POSIX

Page 13: 1 Pertemuan 24 Sistem Operasi Unix Matakuliah: T0316/sistem Operasi Tahun: 2005 Versi/Revisi: 5

13

Process pada Unix

• Sistem multiprogramming• Daemonds• Cron daemonds• System fork• Process parent• PID• Pohon process• signal• Group process• UID• Superuser (root)

Page 14: 1 Pertemuan 24 Sistem Operasi Unix Matakuliah: T0316/sistem Operasi Tahun: 2005 Versi/Revisi: 5

14

System Calls for Process Management

s is an error code

pid is a process ID

residual is the remaining time from the previous alarm

Page 15: 1 Pertemuan 24 Sistem Operasi Unix Matakuliah: T0316/sistem Operasi Tahun: 2005 Versi/Revisi: 5

15

POSIX Shell

A highly simplified shell

Page 16: 1 Pertemuan 24 Sistem Operasi Unix Matakuliah: T0316/sistem Operasi Tahun: 2005 Versi/Revisi: 5

16

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

Page 17: 1 Pertemuan 24 Sistem Operasi Unix Matakuliah: T0316/sistem Operasi Tahun: 2005 Versi/Revisi: 5

17

Handling Memory

• Process A's virtual address space• Physical memory• Process B's virtual address space

Process A Process B

Page 18: 1 Pertemuan 24 Sistem Operasi Unix Matakuliah: T0316/sistem Operasi Tahun: 2005 Versi/Revisi: 5

18

Sharing Files

Two processes can share a mapped file.

A new file mapped simultaneously into two processes

Page 19: 1 Pertemuan 24 Sistem Operasi Unix Matakuliah: T0316/sistem Operasi Tahun: 2005 Versi/Revisi: 5

19

Implementation of memory management

• Swapping

Tiga hal yang menyebabkan swapping ke disk

1. Fork

2. BRK (request for memory)

3. Stack increase

Page 20: 1 Pertemuan 24 Sistem Operasi Unix Matakuliah: T0316/sistem Operasi Tahun: 2005 Versi/Revisi: 5

20

Implementation (2)

Paging in UNIX•Page daemon•Core map information about the contents of page frame

The core map in 4BSD

Page 21: 1 Pertemuan 24 Sistem Operasi Unix Matakuliah: T0316/sistem Operasi Tahun: 2005 Versi/Revisi: 5

21

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)