ikh311-07

30
Sistem Operasi IKH311 Masukan Luaran (Input/Output)

Transcript of ikh311-07

Page 1: ikh311-07

Sistem OperasiIKH311

Masukan Luaran (Input/Output)

Page 2: ikh311-07

2

Prinsip I/O

Page 3: ikh311-07

Device Controllers

I/O devices have components:● mechanical component ● electronic component

The electronic component is the device controller● may be able to handle multiple devices

Controller's tasks● convert serial bit stream to block of bytes● perform error correction as necessary● make available to main memory

Page 4: ikh311-07

Principles of I/O SoftwareGoals of I/O Software (1)

Device independence● programs can access

any I/O device ● without specifying

device in advance – (floppy, hard drive, or

CD-ROM)

Uniform naming● name of a file or

device a string or an integer

● not depending on which machine

Error handling● handle as close to the

hardware as possible

Goals of I/O Software (2)

Synchronous vs. asynchronous transfers● blocked transfers vs.

interrupt-driven

Buffering● data coming off a

device cannot be stored in final destination

Sharable vs. dedicated devices● disks are sharable● tape drives would not

be

Page 5: ikh311-07

Memory-Mapped I/O

Page 6: ikh311-07

Memory-Mapped I/O

Page 7: ikh311-07

Direct Memory Access (DMA)

Page 8: ikh311-07

Interrupt

Page 9: ikh311-07

Not Recently Used Page Replacement Algorithm

Each page has Reference bit, Modified bit

bits are set when page is referenced, modified

Pages are classified not referenced,

not modified not referenced,

modified referenced, not

modified referenced,

modified

NRU removes page at random

from lowest numbered non empty class

Page 10: ikh311-07

10

Device-Independent I/O Software (1)

Functions of the device-independent I/O software

Uniform interfacing for device drivers

Buffering

Error reporting

Allocating and releasing dedicate devices

Providing a deice-independent block size

Page 11: ikh311-07

FIFO Page Replacement Algorithm

Maintain a linked list of all pages in order they came into memory

Page at beginning of list replaced Disadvantage

page in memory the longest may be often used

Page 12: ikh311-07

12

Device-Independent I/O Software (3)

(a) Unbuffered input(b) Buffering in user space(c) Buffering in the kernel followed by copying to user space(d) Double buffering in the kernel

Page 13: ikh311-07

13

Device-Independent I/O Software (4)

Networking may involve many copies

Page 14: ikh311-07

14

DisksDisk Hardware (1)

Disk parameters for the original IBM PC floppy disk and a Western Digital WD 18300 hard disk

Page 15: ikh311-07

15

Disk Hardware (2)

Physical geometry of a disk with two zones A possible virtual geometry for this disk

Page 16: ikh311-07

16

Disk Hardware (3)

Raid levels 0 through 2 Backup and parity drives are shaded

Page 17: ikh311-07

17

Disk Hardware (4)

Raid levels 3 through 5 Backup and parity drives are shaded

Page 18: ikh311-07

18

Disk Hardware (5)

Recording structure of a CD or CD-ROM

Page 19: ikh311-07

19

Disk Hardware (6)

Logical data layout on a CD-ROM

Page 20: ikh311-07

20

Disk Hardware (7)

Cross section of a CD-R disk and laser● not to scale

Silver CD-ROM has similar structure● without dye layer● with pitted aluminum layer instead of gold

Page 21: ikh311-07

21

Disk Hardware (8)

A double sided, dual layer DVD disk

Page 22: ikh311-07

22

Disk Formatting (1)

A disk sector

Page 23: ikh311-07

23

Disk Formatting (2)

An illustration of cylinder skew

Page 24: ikh311-07

24

Disk Formatting (3)

No interleaving Single interleaving Double interleaving

Page 25: ikh311-07

25

Disk Arm Scheduling Algorithms (1)

• Time required to read or write a disk block determined by 3 factors

1. Seek time

2. Rotational delay

3. Actual transfer time

• Seek time dominates• Error checking is done by controllers

Page 26: ikh311-07

26

Disk Arm Scheduling Algorithms (2)

Shortest Seek First (SSF) disk scheduling algorithm

Initialposition

Pendingrequests

Page 27: ikh311-07

27

Disk Arm Scheduling Algorithms (3)

The elevator algorithm for scheduling disk requests

Page 28: ikh311-07

28

Error Handling

A disk track with a bad sector Substituting a spare for the bad sector Shifting all the sectors to bypass the bad one

Page 29: ikh311-07

29

Stable Storage

Analysis of the influence of crashes on stable writes

Page 30: ikh311-07

Pustaka

Avi Silberschatz, "Operating System Concepts" http://codex.cs.yale.edu/avi/os-

book/OS8/os8j/index.html Andrew Tanenbaum, "Modern Operating

Systems" http://www.cs.vu.nl/~ast/books/mos2/ Harvey Deitel, "Operating Systems" http://cs.nyu.edu/~yap/classes/os/resources/origin_of

_PV.html

tjerdastangkas.blogspot.com/search/label/ikh311