Project Phase - PowerPoint PPT Presentation

1 / 23
About This Presentation
Title:

Project Phase

Description:

The fcntl() subroutine performs controlling operations on the open file specified. ... platter. cylinder. read-write. head. arm. Disk Speed ... – PowerPoint PPT presentation

Number of Views:38
Avg rating:3.0/5.0
Slides: 24
Provided by: chrisw50
Category:
Tags: phase | platter | project

less

Transcript and Presenter's Notes

Title: Project Phase


1
Project Phase 3
  • Implementing file redirection can be done using
    the fcntl() system call.
  • include ltfcntl.hgt
  • include ltunistd.hgt
  • The fcntl() subroutine performs controlling
    operations on the open file specified.

2
fcntl()
  • Append standard input to a file
  • fdo1 open(filename, O_WRONLY O_APPEND)
  • close(1)
  • fdo2 fcntl(fdo1, F_DUPFD, 1)
  • Write standard output to a file
  • fdo1 open(filename, O_WRONLY O_TRUNC)
  • close(1)
  • fdo2 fcntl(fdo1, F_DUPFD, 1)
  • Read standard input from a file
  • fdo1 open(filename, O_RDONLY)
  • close(0)
  • fdo2 fcntl(fdo1, F_DUPFD, 0)

3
Handling Signals
  • signal(SIGINT,SIG_IGN)
  • signal(SIGQUIT,SIG_IGN)

4
Magnetic Disk
read-write head
sector
track
platter
arm
cylinder
5
Disk Speed
  • Transfer Rate rate at which data flows between
    the drive and the computer
  • Positioning Time
  • Seek Time - time to move the arm to a desired
    cylinder
  • Rotational Latency time for the desired sector
    to rotate to the disk head
  • Bandwidth - total number of bytes transferred
    divided by the total time between the first
    request and the completion of the last transfer.

6
Disk Structure
  • Blocks are mapped to disk sectors
  • Sector 0 is the first sector of the first track
    on the outermost cylinder.
  • Then through the track, then the next track in
    the cylinder, then through the rest of the
    cylinders (outermost to innermost)

7
Disk Rotation
  • Constant Angular Velocity (CAV)
  • traditional
  • bits near outside are spread out compared to
    those near the inside
  • Constant Linear Velocity (CLV)
  • variable speed disk motor
  • bits are evenly spread
  • disk spins at a different speed when the disk arm
    is near the center compared to when near the
    outside edge

8
Disk Scheduling
  • When a process requests I/O to or from the disk,
    it specifies
  • Read or write
  • Disk address
  • Memory address for the transfer
  • Number of sectors
  • Disk I/O requests will be placed in a queue if
    they cannot be serviced immediately.
  • How do we choose which request to service next?
  • Disk Scheduling

9
First-Come, First-Served (FCFS)
Requests (cylinders) 98, 183, 37, 122, 14, 124,
65, 67
(assume head initially is at 53)
0
14
37
53
65
67
98
122
124
183
199
640 head movements
10
Shortest-Seek-Time-First (SSTF)
  • Select the request with the minimum seek time
    from the current head position.
  • Intuition since we must service this request
    eventually, we might as well service it while the
    disk head is close.

11
First-Come, First-Served (FCFS)
Requests (cylinders) 98, 183, 37, 122, 14, 124,
65, 67
(assume head initially is at 53)
0
14
37
53
65
67
98
122
124
183
199
236 head movements
12
SSTF Problems
  • Constantly switching directions slows things
    down.
  • Starvation
  • Suppose requests continually arrive for cylinders
    near the current position.
  • If a request is in the queue that is far away
    from the current head position, it may remain
    pending indefinitely.

13
SCAN Scheduling
  • Disk arm moves one direction, servicing requests
    as it moves, until it reaches the end of the
    disk.
  • Then it reverses direction, and continues to scan
    and service requests.

14
SCAN
Requests (cylinders) 98, 183, 37, 122, 14, 124,
65, 67
(assume head initially is at 53)
0
14
37
53
65
67
98
122
124
183
199
236 head movements
15
C-SCAN
  • Variant of SCAN where the disk head moves from
    one end of the disk to the other, then resets to
    its original position, and repeats.
  • Does not service requests as it resets

16
C-SCAN
Requests (cylinders) 98, 183, 37, 122, 14, 124,
65, 67
(assume head initially is at 53)
0
14
37
53
65
67
98
122
124
183
199
383 head movements (200 for reset)
17
LOOK and C-LOOK
  • LOOK is a variant of SCAN where the disk head
    only goes as far as the furthest request.
  • C-LOOK is a variant of C-SCAN where the disk head
    only moves as far as the furthest request.

18
C-LOOK
Requests (cylinders) 98, 183, 37, 122, 14, 124,
65, 67
(assume head initially is at 53)
0
14
37
53
65
67
98
122
124
183
199
322 head movements
19
Summary
  • SSTF or LOOK are often used.
  • SCAN and C-SCAN are better suited for systems
    will heavy disk loads since starvation is
    eliminated.
  • If disk requests are very sparse, all algorithms
    are about the same.
  • Disk manufacturers will often implement a disk
    scheduling algorithm in the controller.

20
RAID
  • Redundant Array of Independent Disks
  • Read/write speed
  • Reliability of data storage
  • Redundancy
  • Mirroring every write is carried out on each
    disk
  • If one disk fails, the data is read from another
    disk

21
Data Striping in RAID
  • Data Striping split data among multiple disks.
  • Bit-Level split the bits in a byte
  • Block-Level split blocks of a file
  • Increases throughput by load balancing
  • Reduces response time of large accesses

22
RAID Levels
  • RAID schemes have been developed that combine
    disk striping with parity bits.
  • Provides redundancy and speed increase
  • The various schemes are implemented as different
    RAID levels.

23
RAID Levels
  • Level 0 block striping
  • Level 1 disk mirroring
  • Level 2 parity bits and striping
  • Level 3 interleaved byte parity bits
  • Level 4 interleaved block parity bits
  • Level 5 distributed interleaved block parity
    bits
  • Level 6 like 5, but uses error-correcting codes
  • Level 01 Combination of 0 and 1
Write a Comment
User Comments (0)
About PowerShow.com