Вы находитесь на странице: 1из 47

Mass-Storage Systems

Disk Structure
Disk Scheduling

Disk Structure
Disk drives are addressed as large 1-dimensional arrays

of logical blocks, where the logical block is the smallest


unit of transfer.
The 1-dimensional array of logical blocks is mapped into

the sectors of the disk sequentially.


Sector 0 is the first sector of the first track on the outermost

cylinder.
Mapping proceeds in order through that track, then the rest
of the tracks in that cylinder, and then through the rest of the
cylinders from outermost to innermost.

Disk Scheduling
The operating system is responsible for using hardware

efficiently for the disk drives, this means having a fast


access time and disk bandwidth.
Access time has two major components
Seek time is the time for the disk arm to move the head to

the cylinder containing the desired sector.


Rotational latency is the additional time waiting for the disk
to rotate the desired sector to the disk head.
Minimize seek time
Seek time seek distance
Disk bandwidth is the total number of bytes transferred,

divided by the total time between the first request for


service and the completion of the last transfer.

Disk Scheduling
Several algorithms exist to schedule the servicing of disk

I/O requests.
Disk scheduling algorithms can be illustrated with a
request queue
98, 183, 37, 122, 14, 124, 65, 67
Suppose the Initial Head Position (IHP) is 53

FCFS
Illustration shows total head movement of 640 cylinders.

SSTF
Selects the request with the minimum seek time from the

current head position.


SSTF scheduling is a form of SJF scheduling; may cause
starvation of some requests.
Illustration shows total head movement of 236 cylinders.

SSTF

SCAN
The disk arm starts at one end (say END1) of the disk

and moves toward the other end (say END2) while


servicing requests until it gets to END2 of the disk. Then
form there, the head movement is reversed and servicing
continues on its way to the END1. So, it keeps moving
from one end to the other end.
Sometimes called the elevator algorithm.
Illustration shows total head movement of 236 cylinders.

SCAN

C-SCAN
Provides a more uniform wait time than SCAN.
The head moves from one end (say END1) of the disk to

the other (say END2) while servicing requests as it goes.


When it reaches the END2, however, it immediately
returns to the beginning of the disk (END1) without
servicing any requests on the return trip.
Treats the cylinders as a circular list that wraps around
from the last cylinder to the first one.

C-SCAN

LOOK
The disk arm starts from the present

position and goes as far as the final


request in each direction.
It does not go to the end of the disk.
It looks for a request before continuing to
move in a given direction.

LOOK

C-LOOK
Version of C-SCAN
Arm only goes as far as the last request in each direction,

then reverses direction immediately, without servicing any


request while going all the way to the other side of the
disk.
Movement of the head is from request to request from
one side to the other side of the disk.

C-LOOK

TEST SAMPLE
50 REQUESTS
INITIAL HEAD POSITION AT 53

Head Move Sequence

Queue

FCFS

SSTF

LOOK-UP

LOOKDOWN

C-LOOK

SCAN

IHP

53

53

53

53

53

53

53

53

272

272

50

58

50

58

50

58

69

69

58

69

40

69

40

69

23

23

69

73

39

73

39

73

58

58

73

80

32

80

32

80

190

190

80

83

27

83

27

83

205

205

83

83

25

83

25

83

39

39

83

88

23

88

23

88

117

117

88

94

19

94

19

94

25

25

94

117

15

117

15

117

10

11

12

13

14

15

16

17

213

121

290

310

19

80

94

213

121

290

310

19

80

94

117

121

122

134

138

150

167

176

121

122

134

138

150

167

176

190

11

58

121

122

134

138

150

167

176

190

11

22

303

303

230

240

83

240

83

240

23

260

260

240

242

88

242

83

242

24

150

150

242

253

94

253

88

253

25

83

83

253

260

117

260

94

260

26

167

167

260

263

121

263

117

263

27

32

32

263

272

122

272

121

272

28

27

27

272

290

134

290

122

290

29

253

253

290

291

138

291

134

291

30

122

122

291

301

150

301

138

301

31

73

73

301

303

167

303

150

303

32

134

134

303

310

176

310

167

310

33

11

11

310

312

190

312

176

312

34

312

319

205

319

190

319

35

83

83

319

50

213

205

999

36

50

50

40

40

222

213

37

39

39

230

222

38

240

240

32

32

240

230

39

242

242

27

27

242

240

40

301

301

25

25

253

242

41

23

23

260

11

253

42

263

263

19

19

263

15

260

43

138

138

15

15

272

19

263

11

44

11

11

290

23

272

15

45

291

291

291

25

290

19

46

319

319

301

27

291

23

C SCAN

121

122

134

138

150

167

47

303

32

301

25

48

15

15

310

39

303

27

49

230

230

312

40

310

32

50

88

88

319

50

312

39

176

190
40

27

27

253

253

122

122

73

73

134

134

272

69

69

23

23

190

205

39

117

53

190

205

213

121

121

94

117

25

2 13

121
19

290

FCFS
5851 HEAD MOVES

94

222

40
11

11

83

83

50

50

240

240

290

310

242

242

301

301

19

263

263

138

138

291

291

80

176

50

94

253

122

73

13 4

83
240
242

9
15

312
303

1 67

32
27

11
5

260

150

83

301
26 3

138

310

80

80

190
205

117

213

19

58
39

39

25

310

272

69

58

25

290

75

50

53

23

58

350

32

325

32

300

167

275

167

250

83

225

83

200

150

175

150

150

260

125

260

25

272

303

FCFS

53

303

100

Queue

291
88

230

319

32

263

27

272

253

290

122

291

73

301

134

303

11

310

312

83

319

50

40

39

240

32

242

27

301

25

23

263

19

138

15

11

291

58

23

69

80

83

39

83

88

25

94

213

117

121

121

122

310

134

19

138

80

150

94

53
50
58
69
73
80
83
83
88
94

73

205

290

75

69

117

50

50

190

25

53

272

58

350

260

325

167

300

253

275

83

250

242

225

150

53

200

240

175

260

150

230

125

303
SSTF

100

Queue

167

176

40
39
32
27
25
23
19
15
11
9
8
7
254

117
121
122
134
138
150
167
176
190
205
213
222
230
240
242
253
260
263
272
290
291
301
303
310
312
319

SSTF
589 HEAD MOVES

32

272

27

290

253

291

122

301

73

303

134

310

11

312

319

83

50

50

40

39

240

32

242

27

301

25

23

263

19

138

15

11

291

69

23

73

83

83

39

88

94

25

117

213

121

121

122

134

310

138

19

150

80

167

94

53
58
69
73
80
83
83
88
94

80

205

290

75

69

117

50

58

190

25

53

272

58

350

263

325

167

300

260

275

83

250

253

225

150

53

200

242

175

260

150

240

125

303
LOOK-UP

100

Queue

176

190

50
40
39
32
27
25
23
19
15
11
9
8
7
254

117
121
122
134
138
150
167
176
190
205
213
222
230
240
242
253
260
263
272
290
291
301
303
310
312
319

LOOK-UP
583 HEAD MOVES

27

134

253

138

122

150

73

167

134

176

11

190

205

83

213

50

222

230

240

240

242

242

301

253

260

263

263

138

272

290

291

291

53

272

50

69

40

23

39

58

190

32

27

205

25

39

23

117

19

25

15

213

11

121

290

310

19

80

94

350

122

325

32

300

121

275

167

250

117

225

83

200

94

175

150

150

53

125

88

75

260

50

83

303

25

LOOKDOWN

100

Queue

58

53
50
40
39
32
27
25
23
19
15
11
9
8
7
5
4
2
58
69
73
80
83
83
88
94

LOOK-DOWN
368 HEAD MOVES

117
121
122
134
138
150
167
176
190
205
213
222
230
240
242
253
260
263
272

290
291
301
303
33113021 9

32

272

27

290

253

291

122

301

73

303

134

310

11

312

319

83

50

240

242

301

11

263

15

138

19

23

291

25

69

23

73

83

83

39

88

94

25

117

213

121

121

122

134

310

138

19

150

80

167

94

53
58
69
73
80
83
83
88
94

80

205

290

75

69

117

50

58

190

25

53

272

58

350

263

325

167

300

260

275

83

250

253

225

150

53

200

242

175

260

150

240

125

303
C-LOOK

100

Queue

176

190

2
4
5
7
8
9
11
15
19
23
25
27
32
34 905 0

117
121
122
134
138
150
167
176
190
205
213
222
230
240
242
253
260
263
272
290
291
301
303
310
312
319

C - LOOK
631 HEAD MOVES

32

121

27

122

253

134

122

138

73

150

134

167

11

176

190

83

205

50

213

222

240

230

242

240

301

242

253

263

260

138

263

272

291

290

40

23

39

32

27

205

25

39

23

25

19

15

213

11

121

290

310

19

80

94

75

69

117

50

50

190

25

53

272

58

350

117

325

167

300

94

275

83

250

88

225

150

53

200

83

175

260

150

83

125

303
SCAN

100

Queue

53
50
40
39
32
27
25
23
19
15
11
9
8
7
5
4
2
0
58
69
73
80
83
83
88
94

SCAN
372 HEAD MOVES

117
121
122
134
138
150
167
176
190
205
213
222
230
240
242
253
260
263
272
290
291
301
3 03331102

69

167

263

32

272

23

73

27

290

58

80

253

291

122

301

73

303

134

310

11

312

319

83

205

83

39

88

94
999

25

117
0

213

121

121

122

290

134

310

138

19

150

80

167

176

94

190

83

50

240

242

301

11

263

15

138

19

23

291

25

0
2
4
5
7
8
9
11
15
19
23
25
27
32
39
40
50

900

69

800

260

700

83

53
58
69
73
80
83
83
88
94
1 17
1 21
1 22
1 34
13 8
15 0
1 67
176
19 0
20 5
2 13
2 22
23 0
24 0
24 2
25 3
2 60
2 63
2 72
2 90
29 1
3 01
30 3
3 10
3 12
31 9

600

253

500

150

400

242

300

58

117

260

200

53

272

190

240

C SCAN

53

303

100

Queue

C SCAN
1995 HEAD MOVES

9 99

HEAD MOVEMENTS

7000
6000

5851

5000
4000
3000
1995
2000
1000

589

583

SSTF

LOOK-UP

368

631

372

0
FCFS

LOOKDOWN

C-LOOK

SCAN

C SCAN

DEADLINE BASED ALGORITHMS

Earliest Dead line First (EDF)


In this scheme, the blocks with the nearest deadlines are read first. It has poor
throughput and excessive seek time. Only the dead lines are taken into account, but not
the track numbers. It is very similar to FCFS
Disadvantage: Inefficient. Doesnt reflect the geographical position of tracks

SCAN EDF
This algorithm combines the advantages of SCAN and EDF. Requests with the
earliest deadline is read first. Amongst the requests with same deadline, requests
are served in accordance with track locations.

Accurate SCAN EDF


The algorithm is a variation of Scan EDF, in which along with the deadlines the time constraint
is also considered. This algorithm rearranges the request queue according to the time stamp
(i.e. the one with the lowest time stamp is entertained first) .The request with same time
stamp will be entertained by the deadline seniority criteria. The scan is carried out primarily on
the basis of time stamp and then on the basis of deadline.

TEST SAMPLE No 1

10 REQUESTS
INITIAL HEAD POSITION AT 0

Request Queue

Algorithms- Head Movement Sequence

Request
Number

Track
No

Deadline
( 0-9 )

Time
stamp

IHP

20

20

20

20

22

22

12

12

40

12

22

50

12

45

45

45

45

40

42

42

42

42

40

16

50

16

16

40

16

50

24

22

30

30

30

24

10

24

24

50

30

EDF

SCAN EDF

Accurate SCAN EDF

0
0
0
1
1
2
2
3
3
3

Request
Number

Track
No

Deadline
( 0-9 )

IHP

EDF

20

40

60

20

22

20

22

22
3

40

12

12

45

EDF

158 HAED MOVES

45

45
5

12
4

20

40

40

42

16

42

50

16

50

30

30

10

24

24

42
16
50
30
24

0
Request
Number

Track
No

Deadline
( 0-9 )

SCAN
EDF

20

40

60

0
20

0
IHP
1
2

0
20
22

12

0
20

12

22

45

42

2
2

22

SCAN EDF

40

12

45

42

40

50

16

2
3

124 HAED MOVES

45
42
40
16
24

16

24

30

30

10

24

50

30
50

Request
Number

Track
No

Deadline
( 0-9 )

Time
stamp

IHP

20

22

20

10

40

12

45

42

50

16

30

24

0
Accurate
SCAN EDF

20

40

0
20

12
0

12

50

45

42

16

40

50

45
0

42
1
1

16
40

0
2

60

22

24

30

22

24
3

30
3

ACCURATE
SCAN EDF
150 HAED
MOVES

HEAD MOVEMENTS
180
160
140
120
100
80

158

150
124

60
40
20
0
EDF

SCAN EDF

ASCAN EDF

TEST SAMPLE No 2

20 REQUESTS
INITIAL HEAD POSITION AT 0

Request Queue

Algorithms- Head Movement Sequence

Track No

Deadline
( 0-9 )

Time
Stamp
( 0-9 )

IHP

270

235

135

235

40

40

80

40

125

60

10

10

60

125

80

235

40

135

270

135

17

284

135

17

195

350

17

270

54

125

80

195

60

10

350

170

11

60

170

80

284

12

170

195

350

125

13

95

95

301

270

14

301

95

12

15

54

12

12

301

16

301

10

170

17

195

284

10

350

18

24

24

24

19

12

24

284

235

20

17

54

54

95

Request
Number

EDF

SCAN EDF

Accurate SCAN EDF

Request
Number

Track No

Deadline ( 0EDF
9)

IHP

270

235

235

40

40

125

10

60

80

135

270

284

135

350

17

125

80

10

350

11

60

170

12

170

195

13

95

95

14

301

15

54

12

16

301

10

17

195

284

18

24

19

12

24

20

17

54

100

200

300

400

0
235
40
125
60
0

EDF

270
135

2896 HAED
MOVES

17
80
350
170
195
95
301
12
10
284
7
24 54

Request
Number

Trac
k No

Deadline
( 0-9 )

SCAN EDF
0

IHP

40

270

60

235

125

40

0
235

10

80

135

1
1

100

40
60
125
235

284

270

350

195

125

170

10

80

11

60

12

170

350

13

95

301

14

95

15

54

12

12

16

301

17

195

10

4
4

19

12

284

20

17

54

SCAN EDF

135

135

24

400

18

300

17

24

200

17

2016 HAED
MOVES

270
195
170
80
350
301
95

10
24
54

284

Request
Number

Track
No

Deadline
( 0-9 )

Time
Stamp
( 0-9 )

IHP

1
2

270
235

1
0

3
6

Accurate
SCAN EDF
0

135

80

10

10

40

17

195

40

10

80

135

284

350

54

125

60

10

11

60

284

125

170

100

12

13

95

270

14

12

15

54

301

16

301

170

17

195

350

18

24

24

19

12

235

20

17

95

200

300

400

0
135
80

40
17

ACCURATE
SCAN EDF

195
54

2827 HAED
MOVES

60
7
284
125
270
12
301
170
350
24
95

235

HEAD MOVEMENTS
3500
3000
2500
2000
1500

2896

1000

2827
2016

500
0
EDF

SCAN EDF

Accurate SCAN EDF

TEST SAMPLE No 3

40 REQUESTS
INITIAL HEAD POSITION AT 0

Tr
No

DL
( 0-9 )

TS
( 0-9 )

SCAN
EDF

124

270

270

90

45

10

166

45

16

140

EDF

ACCURATE
SCAN EDF

Tr
No

DL
( 0-9 )

TS
( 0-9 )

SCAN
EDF

124

270

270

90

45

10

166

45

96

16

140

96

50

166

124

166

EDF

ACCURATE
SCAN EDF

166

124

16
6

23

90

95

85

23

90

95

40

55

24

50

40

55

24

55

140

42

99

55

140

42

99

60

42

40

11

124

23

40

60

42

40

11

70

55

16

23

124

23

40

96

10

10
0

70

55

16

23

96

10

100

80

270

50

85

50

27
0

24

24

10

86

24

24

10

30

30

40

96

30

30

40

50

50

14
0

90

50

50

140

85

85

91

85

85

99

99

50

95

99

99

50

99

100

100

85

99

100

100

85

100

11

70

100

11

70

270

70

11

70

270

70

11

70

80

86

96

90

91

95

Tr
No

DL
( 0-9)

124

270

45

Tr
No

DL
( 0-9 )

124

270

10

45

10

16

16

50

166

50

166

85

23

85

23

50

40

50

40

55

140

60

42

60

42

124

124

70

55

70

55

96

96

80

80

86

24

86

24

96

30

96

30

90

50

90

50

91

85

91

85

95

99

95

EDF

99

55

EDF

140

100

100

99

100

100

11

100

11

270

70

270

70

300

0
20
25
27
33
40

80
90
95

12
22

99

200

42
45

66

EDF

50
60

6
8

2014 HEAD
MOVES
86
91
270

10
16
23

166
40
140

42

124
55
1

24
30

11

96

50
85
99
100
70

Tr
No

SCAN
DL
( 0-9 ) EDF

Tr
No

DL
( 0-9 )

SCAN
EDF

124

270

124

270

45

166

45

166

140

140

50

124

50

124

85

90

85

90

50

55

50

55

55

42

55

42

60

40

60

40

23

23

70

16

70

16

10

10

80

80

86

24

86

24

96

30

96

30

90

50

90

50

91

85

91

85

95

99

95

99

99

100

99

100

100

70

100

70

270

11

270

11

1 00

20 0

30 0

0
20
25
27
33
40

22
12
8
6
5

80
90
95
91
86
66
60
50
45
42

SCAN EDF
907 HEAD
MOVES
27 0

90

1 40
12 4

55
42
40

23
16
10
24
30

11

50
85
99
1 00
70

1 66

Tr
No

DL
( 0-9 )

TS
(0-9)

124

ACCURATE
SCAN EDF

Tr
No

DL
(0-9 )

TS
(0-9)

90

124

ACCURATE
SCAN EDF
90

100
33
8
12

45

45

45

96

96

50

166

50

166

85

95

85

95

20
27

24

22

99

50

55

11

40

23

55

60

6
70

24

99

60

11

40

70

23

300

45

50

200

42
66
91

ACCURATE
SCAN EDF

80
60
55

2346 HEAD
MOVES

124
30
50
25
5

100

100

80

270

80

270

86

10

86

10

96

40

96

40

90

140

90

140

91

91

95

50

95

50

99

85

99

85

100

100

270

70

270

70

86
16
42
90
45
96
166
95
24
99
11
40
23
100
270
10
40
140
1
50
85
6

70

HEAD MOVEMENTS
2500
2000
1500
2346
1000

2014

500

907

0
EDF

SCAN EDF

Accurate SCAN EDF

Вам также может понравиться