Открыть Электронные книги
Категории
Открыть Аудиокниги
Категории
Открыть Журналы
Категории
Открыть Документы
Категории
2-
,
300
Cj^nriTEP'
- -
-- - - -
- -
2007
32.973-018.27
681.3.066(075)
68
:
. . , ,
-
,
. . , , ,
-
68
. .
: . 2- . - .: , 2007.
416 .: .
ISBN 978-5-94723-632-3
,
. ,
,
,
,
.
,
.
32.973-018.27
681.3.066(075)
.
.
, , , . ,
,
, .
ISBN 978-5-94723-632-3
, 2007
8
1-
11
2.
50
3- .... 72
4.
180x86
101
5- -
130
6.
163
7.
209
8.
247
9.
278
10.
311
1 1 . Windows
361
396
406
409
1 .
2.
3.
,
MS DOS
'
8
10
11
11
16
18
25
27
30
34
36
42
46
49
50
52
53
55
63
65
71
72
73
76
76
78
82
82
85
, -
-
86
87
93
97
99
4.
i80x86
101
180x86
32- 180x86
32- 180x86
5. -
-
-
, -
-
-
Windows NT/2000/XP
-
6.
FAT
DOS
VFAT FAT32
HPFS
NTFS
NTFS
NTFS
NTFS
101
103
105
105
110
113
115
115
118
122
122
124
128
130
131
134
136
138
143
145
145
146
155
156
161
161
162
163
163
166
167
170
171
177
188
189
190
194
7.
207
207
208
209
209
215
.... 215
224
229
230
236
240
242
242
244
246
8. ... 247
CR
CR SR
SR
9.
247
249
250
251
252
254
254
259
263
263
264
267
277
278
279
279
280
281
283
285
286
287
287
289
292
293
294
294
295
295
296
296
API
!
API
POSIX
API
10.
UNIX
Linux
FreeBSD
QNX
QNX
OS/2 Warp IBM
OS/2 Warp 4.5
1 1 . Windows
Windows 9
Windows NT/2000/XP
298
299
300
302
304
307
310
311
312
312
314
320
323
329
336
339
340
342
345
351
354
357
359
360
361
363
363
365
369
373
378
378
382
387
390
394
394
395
396
406
409
,
.
, ,
.
,
, ,
, ,
, . ,
.
,
. ,
()
.
, . ,
,
.
, , -,
- ,
.
,
. .
, (,
,
), ,
.
-
, ,
.
.
.
.
. , ,
,
,
,
, ,
. , ,
,
.
.
654600
.
, 220100 , , ,
220200 ,
220300 ~ , 220400 - .
, ,
.
, ,
,
,
, , ,
. ,
, ,
,
.
,
.
, ,
220100 -
.
,
.
,
2001
10
.
,
.
,
. ,
, , ,
. ,
.
: , ,
, , ,
, .
,
. , ,
.
, ,
comp@piter.com ( , ).
!
web-
http://www.piter.com.
1.
, , .
.
. ,
- ,
,
, , ,
, , ,
, . ,
;
.
,
.
.
.
, .
, ,
.
, ,
- .
50- .
.
,
^ , ? ,
.
. , -
12
1.
,
, ,
. .
,
. .
, ^ .
, , ,
, .
-
, . ,
( ^ ).
-
.
READ WRITE .
,
,
( ), ,
,
.
{) ,
- .
.
,
,
-.
,
- ,
.
.
- . -
, .
.
50-
, . - ( . coder )
, ()
, ,
, -.
,
.
. (
) ,
.
1[3
1.
,
() (
, , ).
2. ,
,
().
, .
, .
,
,
.
3.
, -
. , ,
.
.
()
,
,
.
.
, . ,
, 60-
.
. 70-
,
. , (interface)
,
.
, ()
^ ,
, , ,
.
14
1.
, ,
.
.
( ) , ,
, .
()
, (, ).
, , (, )
, (
, , , ,
.), .
.
,
.
( ,
).
.
.
(),
.
, (Ap
plication Program Interface, API) .
-.
() /
(),
.
,
,
.
.
.
.
,
,
.
(
).
15
,
^ , (login^)
, , , .
,
, , ( ,
)
(), , , .
( ).
,
.
.
. ,
.
, , . 1.1.
pBl^^ws
. 1 . 1 .
, ,
, Windows 9 Microsoft,
, .
70- log in, .
, log on, .
16
1.
,
,
,
. .
,
, .
, ,
.
,
,
. ,
,
, . ,
, , ,
,
()
.
, ,
. ( , )
,
.
;
, .
, ,
(API). ,
, ,
, API
, , . ,
. ()
,
. ,
, , ,
(native).
( )
.
,
, , .
17
,
. , DOS.
, -
, ,
DOS, ( )
MS DOS, PC DOS, Windows 9, Windows 2000, OS/2, Linux.
,
, ( )
. 32-
, ,
. , OS/2 Warp,
^ ,
:
, 32- ;
16- , OS/2 ;
16- ,
MS DOS PC DOS;
16- , Windows 3.x;
Windows 3.x
.
Windows
, Win32API, 16-
Windows 3.x, 16- DOS-, 16-
OS/2.
:
. , , , Linux
(
shell), Norton Commander, Midnight
Commander, , X-Window
KDE, Gnome .
, Linux
, ( ).
( )
, Linux,
, , Windows NT.
,
. , Windows,
Linux; Linux
Windows, Windows-
. , ,
,
, .
18
1.
,
, ,
( ),
.
50- ,
,
.
.
- .
( )
,
.
.
1. ( )
(
, 4).
2. .
, ,
( , , , 180x86
CS IP [1,8, 48]),
, (,
) .
3. .
,
. , 32-
Intel ( i80386
Pentium IV) ,
(
32- i80x86 4).
4. ,
2 .
.
5. , .
, -
IS!
3,
.
6. , (,
4).
7. .
1-3 , 4-7 .
. 1.2 ,
. (
, ) ,
.
,
, .
.
, .
, :
;
;
.
.
,
.
, (system stack).
, ,
: ( )
().
,
, :
;
( -);
;
;
.
,
.
:
20
1.
(
,
);
;
;
;
(, ,
).
,
,
(
.
. 1.2.
,
.
, .
. ,
, -
21
, , .
-
,
. ,
, ,
.
, .
,
,
. ,
, , . ,
,
.
, ,
, .
,
. , ,
(,
, ). . 1.3
()
. ,
,
-
. , ,
.
<
. 1.3.
.
: , () -
22
1.
. (
)
,
;
; .
.
,
,
.
, ( ) .
,
.
(
) .
,
.
.
.
,
.
. ,
.
.
, , , LCFS (Last Come
First Served , ),
.
.
,
1-4 6-7. ,
.
,
.
,
( ), ,
.
(, ),
,
.
23
,
, ,
, (
. . ,
- ,
.
,
, ,
. . 1.2 ,
.
,
, 2, ,
, , , .
,
() ,
.
( LCFS)
.
, (
LCFS)
.
.
,
,
.
,
. ,
, ()
. , , ,
.
. ,
(.
2). , ,
(
)
, .
. 1.4.
,
.
24
1.
,
.
, LCFS.
5
Q.
Q.
7|
/1
,
,
()
,
,
I I
rN
(
)
!
, |
!
. 1.4.
,
, '} ,
, ,
,
. , .
/ . ,
,
( )
, .
25
, , .
4,
180x86.
^ , ,
.
,
, [47].
, ^ (task),
, . ,
,
.
,
. .
.
, .
7,
.
: -,
, -, ,
.
()
, .
- ,
, , . -
,
,
, ,
, .
. ,
, ,
, .
, 70- ,
,
.
, .
.
26
1.
. , , ,
, .
,
, ,
. ,
, .
,
( ) (
), (. 1.5).
. 1.5.
, ,
- [22, 53].
.
,
.
,
. , ,
, ,
, .
.
,
,
.
, -
. ,
, .
27
()
.
,
-.
, , .
,
,
( , )
-, ( ,
) (. 1.6).
(,
, ) ()
, .
CPU
; ;' ;\
<
',.
^'"s"'^"':'"'. '"'-'''!'/''')
'^{';,^Ji"'i'.;bS/
- / i V , _;.
<
CPU
'''rki'^''"';?'.''**'",. ' " ' ; ' ' "
><
CPU
. 1.6.
,
-
28
1.
^ , .
( ).
,
, .
,
,
(
^
).
60- XX
, , ,
.
, ,
.
, ,
,
,
, ,
. ,
,
, ,
.
,
.
, .
.
, ,
.
.
,
.
. , ,
, ,
, , ,
. .
,
.
, - PC-DOS 7.0,
. -
29
. ,
,
.
.
, ,
.
, ,
.
,
, .
( . 2).
,
, ,
, (time
sharing). 60-70 ,
.
, ().
,
.
, ,
, ,
.
.
- ( , -,
. .) () ^ (su
pervisor) (,
) . ,
, . ,
, .
,
(. ),
. ( )
: ( ) . ,
-
, ,
, . . ,
.
() .
, -, ,
, . .
.
30
1.
(),
, :
;
;
( ).
,
, , , ,
, ().
,
.
( )
, ,
-
. , ,
, .
, ^
, ,
, ,
, .
,
.
, , .
,
.
,
.
,
:
,
[46].
,
,
- . ,
,
.
31^
, :
. ,
,
, .
, ,
.
,
.
,
. . ,
(. 9)
,
.
QNX
Quantum Software Systems. UNIX-,
,
,
.
, ( )
,
- , ,
.
,
.
. , ,
. ,
,
.
. ,
.
, .
,
, ,
( ) .
, ,
(
/ ). ,
:
(
,
);
32
1.
,
;
, ,
, -.
, ,
,
, -
.
, ,
- . (,
)
, ()
. .
() .
() . ,
(, , ,
, ,
.). ,
. , ()
, . 1.7,
.
(
)
(
)
. 1.7.
,
,
, , -
33
, -,
.
.
.
.
().
, ,
,
(
, ).
(
, ).
(
, , , ,
).
} (
).
.
,
,
.
, ,
( - ),
. ,
.
.
,
.
( ), .
, , , ,
.
:
. ,
,
.
,
.
34
1.
.
( )
- ( ,
),
, (
. ,
- 3),
,
.
( -
, ,
. .)
.
, , ,
.
.
,
.
,
( , ).
, , :
(Process Identifier, PID);
( ) ,
;
,
(
);
, ,
( , , - . .);
, (
), ,
, ;
, /
( ,
- .);
( ) ;
35
( ,
, );
,
, ( -
,
).
, ,
, ()
. (
)
, .
, ,
. ,
- ,
- .
(
, ),
)^ .
, OS/2,
,
CONFIG.SYS. , THREADS=1024
CONFIG.SYS ,
1024 , .
Windows NT/2000/XP
. ,
.
. , Windows NT/2000/XP,
Ctrl+Shift+Esc, .
.
()
. . .
, , , (
) .
(
)^ .
- .
36
1.
.
( ),
.
,
, .
(- , ) ,
. , ,
, .
,
.
( )
. , , Intel 80x86
(. 4) TR (Task Register),
(Task State Segment, TSS),
[1,8, 48].
, .
, - . ,
. ,
-1^ -
, , .
,
. , ,
.
-
.
, .
. ,
, .
, .
,
.
, .
. .
37
.
.
:
, ,
. ,
. ,
.
,
,
.
^,
.
,
,
, , -
. ,
.
.
.
.
.
, ,
. ;
, ,
. ,
.
(thin) , , ,
\ , (threads).
(process), ,
:
,
, , . . ,
, ,
, .
, .
(thread) (stream).
38
1.
, ^
.
.
.
, .
. ,
, ,
.
^
, .
, ,
.
, ,
( , ,
),
(, ),
().
,
, ,
, ,
, ,
, .
, .
() ,
,
, -
.
,
.
( ,
, )
, (, ).
, ,
,
.
,
. , ,
,
,
,
, .
39
. ,
. ,
OS/2 ,
, . 90-
,
. Windows,
, ,
SQL Server, Oracle. Word, Excel, Internet Explorer
,
.
.
, ,
. , ^ , . -
,
.
. , ,
, ,
.
,
.
, ,
,
, . , ,
,
,
- .
. , , , .
( ,
), .
(
), .
, ,
.
,
. ,
. ,
.
40
1.
, .
, , -, , -
, .
,
njrrcM .
. , ,
, ,
, , . .
? , ,
, -, .
, , ,
,
, ,
. , ,
,
,
, ,
.
( ), )
, .
(task).
, ().
, .
,
,
, ,
. 132
(Task State Segment, TSS). A
,
TSS. , ,
32-
i80x86 4,
. ,
, TSS, ,
, , , .
(
. , -
3) ,
, ( )
.
41^
, CONFIG.SYS,
OS/2 ,
, , THREADS=1024
, .
, .
,
,
, .
- .
, .
. ,
, .
, [28].
,
. ,
, ,
.
,
-.
, . ,
, -
.
, ( ) .
,
, ,
,
.
,
.
. ,
, .
,
.
, .
,
.
,
.
, . (.
, 3)
,
, .
42
1.
,
.
,
. , ,
.
.
,
, ,
- .
,
(. 7).
, , .
.
.
.
, .
,
, .
(. . 1.5). ,
\ .
().
(. 2).
.
(
, , ,
), (
).
. ,
.
.
, ,
,
.
.
.
43
.
3.
,
. (,
), ^
. .
. ,
.
, , ,
, .
,
. ,
, .
, ,
, ( ) ,
, ,
, , .
. , ,
.
, , ,
, .
, ,
,
. ,
,
.
. ,
,
.
,
( ) .
,
, :
, , .
,
. , , ,
. ,
, .
, ,
.
44
1.
,
,
.
, ,
, ^ .
.
, ( ,
),
. ,
,
( ).
, (
, , )
,
.
. 1.8.
. ,
,
. , ,
.
,
.
. 1.8.
,
. ,
,
,
, ,
.
, ^
( ).
,
(
re-enterable).
45
,
. :
.
,
(. 1.9).
()
,
.
>
. 1.9.
, ()
, (
) .
.
.
.
,
()
. , ()
46
1.
. .
,
,
,
. ,
, ,
, ,
.
, ,
, ,
,
:
. -
, \
(re-entrance). ,
, ,
, .
,
- .
,
, ,
. ,
() . ,
( ).
, ,
.
, , .
,
. ,
.
, 9 10.
().
,
,
.
. 5.
47
,
. ,
, ,
. , ,
: ,
, , ,
( ).
, .
, ,
,
, . .
.
,
.
,
() .
, , ,
MS DOS. ,
,
.
(, -
) ( )
. , ,
,
, .
,
, ,
,
( ;
,
).
, , ,
.
-
. ,
, ,
, .
,
.
,
.
() -
48
1.
.
, .
,
. ,
.
Linux.
Windows .
( )
.
,
,
. ,
.
.
()
, .
(
),
. ,
,
(
,
), ,
,
.
( ) .
,
.
.
, .
QNX.
().
,
QNX, Windows
95/98 Linux. Windows ,
()
, Linux , ,
,
( ).
49
1. ?
.
2. ? ?
?
3. ? ,
?
4. ?
? ?
5. ; ,
.
6.
, ?
7.
? ,
, ?
8. ,
.
9. , , ?
?
10. ^ ? ,
, ()?
?
11. .
?
?
12. ,
? ?
13.
? ?
14. ?
,
?
2.
(process) (thread) .
, , .
. ,
. ,
.
(task), .
,
.
.
, , ,
,
.
, .
,
( ) ,
.
, .
, ,
. ,
Windows 9x/NT/2000/XP ,
. Windows NT Windows 95 Microsoft
(, ). ,
, .
-
51^
.
.
,
, .
, , ,
ia32, 32- Intel.
,
,
4. ,
( ) .
(Task State Segment, TSS), , ,
, .
,
, (
, , ).
, ia32.
,
, ,
.
, ,
:
;
;
, .
, .
. .
.
, , .
,
.
.
, .
, -
, . -
52
2.
.
, ,
,
, .
, ,
, .
,
.
,
( ).
,
. ,
, .
,
, . ,
, ,
. ,
. ,
,
, ,
,
.
,
, ,
, (-
), , ,
. ,
,
.
.
,
. .
(
) ,
, .
53
^. ,
,
.
, :
30 100 ,
( ;
).
, ,
,
, .
. ,
, -,
,
.
, ,
, .
, ,
.
, , ,
, ,
. , ,
,
.
.
,
, .
,
. , , :
( )
, ;
;
( )
, .
, .
, , (scheduler).
, - ,
, ,
. , .
54
2.
, ,
, , ,
().
IBM- , Windows
Microsoft.
.
, ,
,
. , , ,
. Windows
, ,
,
, Windows
.
Windows NT/2000
.
, -
, Windows NT/2000.
, , ,
,
. ,
. ,
(foreground task),
.
, -
.
, ,
- .
, Windows 2000 ,
,
.
,
, . Windows
NT 4.0
.
( ), . ,
-
55
. ,
, ,
-. ,
,
,
,
. ,
. ,
(
) .
,
Windows ,
( ) .
,
, -, ,
.
,
,
,
.
,
,
(). ,
, .
,
. . ,
, , ,
.
, :
.
^
.
.
. 2.1.
:
, , ;
{
).
56
2.
0)
>s
(D
Z
S
Q.
Q.
S
2
ffl
>s
2
z
5
. 2 . 1 .
,
.
,
, .
.
( )
.
FCFS (First Come First Served
, ),
, . , -
57
( - ,
- -),
. . (
) ~
. .
,
, . ,
(. 2.2): ,
, .
.
,
. ,
W
1
(
^
^
^
^
^
^
^
^
. 2.2. FCFS
.
, ,
( )
:
(preemptive) (non-preemptive).
.
, ,
(Windows 9x/NT/2000/XP, Linux, OS/2),
( ).
58
2.
, .
SJN SRT. FCFS
. , ,
,
, .
57/'( Shortest Job Next
) ,
.
,
. , ] (Job Control Language
) .
,
( ),
.
, .
,
!^ .
SJN ,
, . ,
(, ),
. , ,
,
, .
SRT (Shortest
Remaining Time) ,
.
,
.
. ,
,
. ,
,
,
. , UNIX- ,
.
,
, , ,
59
, , .
, ,
(,
, ),
, .
,
(Round Robin, RR),
.
RR ,
, , (time slice) q.
q ,
. ,
. . 2.3.
,
.
. 2 . 3 .
q
( ,
)
. ,
, .
()
, ,
,
( ).
q ,
. q ,
60
2.
, .
,
. ,
OS/2 CONFIG.SYS TIMESLICE
q. , ,
TIMESLICE=32,256 , 32 ,
256. ,
q,
, ( 32 ), ,
,
TIMESLICE. OS/2
,
. ,
, ,
.
,
. , , .
,
. , (
) , .
.
.
,
,
. -
.
RR
. ,
. ,
,
(
,
) [7, ]. ,
.
,
,
.
, , , ,
( ) .
,
6^
, ,
.
, .
, , ,
.
, .
, .
OS/2,
Windows 9, Windows NT/2000/XP .
,
.
(
) ,
.
,
. ,
. ,
. ,
.
,
, .
, , ,
.
, ,
(non-preemptive multitasking), ,
(cooperative multitasking), ,
, ,
, ,
, .
FCFS, SJN, SRT .
,
(preemptive multitasking),
,
,
.
,
, ,
( ).
: ,
,
, . RR
, , .
62
2.
. ,
,
. ,
, ^ ,
(,
)
.
, .
,
,
( ,
) [27].
- (,
), (,
,
). ,
, .
,
, ,
. ,
.
,
. ,
.
, Windows 3.x 16-
|[ .
, .
,
.
, , ,
, -,
, -,
, -,
.
,
,
63
,
. ,
, ,
, ,
. ,
.
,
. ,
,
(!) .
.
,
,
.
, ,
, ,
.
,
. ,
( ) ,
. ,
- .
, ( -
64
2.
), .
.
, , .
, . ,
20 % 10 , 40 %
2 10 % 5 (
) .
, .
G ,
.
.
(CPU utilization).
2-3 %,
100 %. ,
(, ) ,
15-40 % (
) 90-100 % ( ).
(CPU throughput).
,
.
(turnaround time).
,
.
,
,
, -.
(waiting time).
.
(response time).
, ,
.
,
, .
. ,
.
65
.
, (
) ,
( ,
, ,
).
,
,
(. 7). (
).
:
, ()
( );
,
,
, ;
(hints) (
), , Mach
: -, (
) , -,
, .
.
, -
( , , ),
,
() -
. , ,
,
.
>1 ( ).
.
( )
(dynamic priority variation) .
, .
, ,
UNIX, , , . -
66
2.
UNIX .
, UNIX-,
.
RR
.
[39]. -,
p_nice _.
.
( )
. ,
.
:
, ,
( nice number, nice).
UNIX.
,
.
.
, (
) 127 ( ). ,
, , .
0-65, 66-95 (
). , 96-127,
, ,
.
, ,
,
, .
,
.
, ,
. ,
, ,
.
,
. , ,
, .
p_priuser,
, p_nice
_:
p_pr1user = X _1 - b _
.
67
.
. ,
, .
,
( ;
65),
. ,
.
:
_ = _/2
. ,
, ,
_,
_.
, (
nice number)
.
UNIX _
:
_ = _ X (2 X load)/(2 load + 1)
load ,
,
.
_ = __/2,
_ .
,
,
.
(). , ,
, , ,
( ). (,
)
. ,
, _ , ,
.
, OS/2
Windows NT/2000/XP. ,
. , Windows NT/2000/XP
,
68
2.
, ,
, . 2.4. ,
.
,
. ,
.
.
,
, ,
. ,
, Windows
; ,
.
,
.
,
. ,
(preempts), ,
.
.
Windows NT/2000/XP .
32 . :
. ,
16 31, , .
69
,
( Microsoft).
, .
,
, . ,
, ,
. ,
, 0.
( ) 1 15.
(variable priority),
. cef ,
.
,
. ,
, , (
). ,
.
,
,
, . , ,
, ,
, -,
.
16.
OS/2
, ^ OS/2 .
31. , 128 , , 128
().
, ,
(time critical). ,
,
.
(
, ,
,
).
, .
, Microsoft OS/2
IBM.
OS/2 OS/2 ver. 3.0,
Windows NT.
70
2.
.
,
( -,
, . 9 10),
. ,
,
, ,
.
,
(regular), .
, .
, , OS/2 .
,
, .
,
, .
,
, RR.
, ,
(
).
OS/2
, .
(priority boost).
[26].
(foreground boost).
, .
.
- (Input/Output boost).
- ^
.
-.
(starvation boost). ^ (
MAXWAH CONFIG.SYS^), OS/2
, .
. MAXWAIT = 1 ,
.
71[
.
.
.
, PRIORITY = ABSOLUTE CONFIG.SYS
; PRIORITY
DYNAMIC.
1. ,
.
2.
?
3. ?
.
4. ?
, .
5. ,
, .
6. ,
?
7. ? ?
8. , UNIX.
9. Windows
NT OS/2.
?
3.
,
(, , )
. 1 ,
.
, , ,
.
,
, . ,
-,
,
,
- .
, , -
. ,
, .
, , .
,
, ,
.
73
,
(
), ,
, , ,
. ,
,
(, ).
.
.
,
, ,
.
, ,
, ().
.
,
.
(. 3.1):
, .
,
, .
.
,
,
.
, ,
.
, ,
,
.
,
, .
, -. , (, , ) -
74
3.
- , ,
, - ,
.
( )
. 3 . 1 .
. -
75
. ,
] ,
,
.
.
,
, ,
( ,
).
.
.
,
. ,
(
), .
,
.
,
(, Basic).
. -
, , ,
,
. . ,
.
,
, ,
,
( ), .
,
.
,
.
, ,
.
,
:
V^
Vp (Vv < Vp);
V^
Vp (Vv = Vp);
76
3.
V^
Vp (Vv > Vp).
(V^ < Vp) , , ,
. , 16- -
, - 2^^ = 64
(
). -
.
,
( ),
(/
). ^ ,
, .
, (,
. .) , , ,
, , .
64 ,
.
(V^ = Vp) ,
.
.
, ,
}^
(Vv > Vp) ,
. ,
,
, .
,
:
, ;
, ;
() .
,
.
,
,
77
. , ,
,
. ,
.
(, ,
),
, ,
. .
,
,
.
. ,
.
,
, .
, ( ),
,
. ,
, - (
), ,
.
, ,
-,
, ,
^ . ,
.
, , , .
,
.
,
, , ,
,
( overlay ~
, -). ,
.
(main) (segments),
.
,
. ()
, : ( -
78
3.
) ; ,
; ,
, (
), ,
, .
,
( ).
, ,
.
. ,
, ,
, ,
.
(
) ,
,
.
,
, . ,
Turbo Pascal
, .
.
,
DOS Turbo Pascal.
MS DOS
, MS DOS^
IBM PC. , ,
, TSR-^,
, MS DOS
.
.
( ).
, IBM PC 16- 18088,
(Disks Operating System, DOS)
. MS DOS ( Microsoft) 10.
MS DOS.
TSR (Terminate and Stay Resident) ,
. , , [3,23, 24,35].
7^
1 .
(IBM PC AT, 386 .)
, DOS
.
, . 3.2. ,
, 1 ,
,
[2].
, , MS DOS
.
BIOS (Base Input-Output System -
), POST (Power On Self Test
)^
,
-.
.
. BIOS
.
MS DOS BIOS. ,
.
BIOS IO.SYS ( DOS-
, _BI0.COM).
, , DOS MSDOS.SYS.
.
( ) C0MMAND.COM.
, .
MS DOS (Boot Record, BR),
(
. 6).
IBM PC
.
( 1024 )
(. 32-
i80x86 4).
18088. ( i80286)
,
. , ,
180x86
.
POST, ROM BIOS, ,
.
80
3.
0000-003FF
00400-005FF
512
1
BIOS;
DOS
1
00600-
35-60
10. SYS;
MSDOS. SYS:
- ;
- ,
;
- ;
COMMAND. :
-
;
-
;
-
COMMAND.
MS DOS.
*. *.
580
18
A0000-C7FFF
160
8000-0000
^^^^ ^
96
COMMAND.
.
100000
^^^
,
.
COMMAND.
BIOS
F0000-FFFF
64
MSDOS , ,
CONFIG. SYS
ROM BIOS
(System BIOS)
32 ,
128 ,
^
.
XMS EMS
. 3.2. MS DOS
MS DOS .
B1i_
, , , ,
(conventional memory).
,
-
. UMA (Upper Memory Area
, ).
,
,
, -.
, -,
, j .
CONFIG.SYS. BIOS IO.SYS
( MSDOS.SYS) CONFIG.SYS
. ,
CONFIG.SYS ,
, -, ,
(
,
).
i80x86 HIMEM.SYS IO.SYS MSDOS.SYS
,
(High Memory Area ).
, lOFFFFh, DOS ,
(, i80286 24- , i80386
32-).
,
lOFFFFh.
: XMS (Extended Memory Specification) EMS (Expanded
Memory Specification). MS DOS
. ,
,
. ,
, EMS XMS, ,
, .
MS DOS ( ,
) . ,
, .
,
, TSR-.
, MS DOS
,
82
3.
, C0MMAND.COM .
,
,
.
, ,
,
C0MMAND.COM.
,
. MS DOS
.
/
( ).
( )
,
( ).
.
, ,
,
(partitions, regions). ,
, ( , ).
()
() (
). .
(
, )
.
.
. 3.3.
().
,
. ,
-
83
^ .
.
,
.
,
. - (
). ;
, , ,
.
>
>
3
:t:t...LJ..
.1'..
. 3.3.
* ( )
. 90 %
, 4-5.
, m 10-15.
84
3.
, ,
(
, -)
, (swapping).
( ),
,
, .
()
, .
,
,
,
.
, ,
.
, ,
. ,
,
. ,
.
.
, .
, ,
,
. ,
, .
(. . 3.3).
.
, ,
,
,
.
:
, ;
,
.
. ,
.
85
,
, , ,
. ,
, OS MVT^ (Multiprogramming with
a Variable number of Tasks
). ; (
) .
, , ,
, .
.
, .
, .
:
;
;
.
, (
, ).
, . )^,
, .
.
,
, , ,
,
.
,
.
,
.
- .
,
- . ,
,
, .
.
, , , ,
IBM
360 (370).
86
3.
.
. ,
, , ,
, , ,
.
, ,
, -
,
. , -
, ,
.
. ,
, (,
, ).
,
.
, ,
.
, ,
,
,
.
(
) . ,
, 16-
Intel.
,
-
,
() , .
,
,
, .
,
. ,
.
, ,
,
.
,
, .
, -
87
.
.
,
, ( ,
) ,
.
.
. (
) ,
,
.
.
. ,
.
.
,
. .
,
.
,
.
. 3.4 ,
11
, 612. ,
, 19700.
, , ,
, .
,
.
,
. ,
( present).
, ,
(limit) .
,
, , ,
. -
88
3.
, ()
.
(
)
612
11
31500
S (Segment)
D (Destination)
^
31511
19700
R-X 1
^""->^
. 3 . 4 .
,
, (, ),
, -
89
. ,
, , (
), ( ,
), (
,
, ! ,
, ; , ).
. , ,
,
.
, .
, ,
,
; ,
, ,
, , .
/, ,
. , ,
,
, .
, ,
.
,
. ,
.
.
, ,
,
.
, . ,
, -
.
, .
,
- .
.
(
90
3.
).
, , ,
,
,
.
,
, ,
, .
( ,
, )
^:
FIFO (First In First Out );
LRU (Least Recently Used );
LFU (Least Frequently Used );
(random) .
,
, , ,
, ,
. ,
, ,
,
, , '
.
FIFO
. , .
.
, ^
. ,
,
.
.
LRU LFU ,
. ,
,
,
(, ,
, ).
.
, -
9^
. ,
( LRU), (
LFU).
,
, .
, ,
.
,
,
.
.
.
-,
, . ,
, ,
, ,
, ,
; , .
-, .
,
.
,
.
.
(. . 3.4),
. ,
, ,
. ,
,
, (
, ).
,
, . ,
.
.
,
.
, ( -
92
3.
), ,
().
.
.
OS/2 \
i80286.
,
.
OS/2 V.1 ,
.
, .
, .
,
. OS/2 v.l
, .
, OS/2
: .
OS/2 UNIX,
.
, ,
. , .
, , ,
OS/2 ,
.
().
, .
,
DOS- OS/2, . ,
, -
, - .
,
,
.
.
,
, .
OS/2 V.1 1984 1987 .
, -
93
OS/2 . OS/2 . ,
,
.
. OS/2
DOS. ,
. OS/2,
.
,
, (
), ^ .
, .
,
, .
,
. ,
^ (
),
(paging file).
5)-, ,
.
,
^
,
, ,
.
,
( ). ,
(, i), (^, i), ^
, , i
. , , ,
, ,
. ,
, ^
, i.
UNIX- ,
, , .
94
3.
,
,
.
, ,
.
, ,
.
().
, ,
, ,
. ,
, .
. . 3.5.
, ,
. ,
:
;
;
.
.
.
.
,
, ,
, .
. ,
(LRU, LFU, FIFO,
) ,
. ,
, .
, LFU ,
.
LRU .
, .
LRU LFU
.
( . 3.5 , ),
.
95
, -
17
32000
612
(Page)
i (index)
32017
. 3.5.
,
. , ,
,
. , .
, ( ,
),
.
96
3.
LRU . ,
OS/2 Linux.
Windows NT/2000/XP ,
,
FIFO. -
FIFO, ,
^ .
.
,
. ,
,
FIFO. ,
.
, Win
dows NT/2000/XP , ,
.
.
, ,
.
( ) , , ,
,
. .
[, 17, 22],
,
, .
,
,
,
.
,
,
.
.
.
32- i80x86. i80386,
,
32 .
Windows NT PageFile.sys.
. ,
11 , Windows NT.
Windows 2000 PageFile.sys
.
, -
97
4 ,
128 .
,
.
, ,
;
, .
,
. ,
. , ;
.
,
,
, . , ,
, , , ,
.
,
,
-. ,
.
-
,
.
:
. , ,
: , .
. 3.6.
,
.
,
(). , ,
, .
, , , ,
. ,
.
98
3.
(
)
32000
17
11
S (Segment) (Page)
612
i (index)
32017
20
R-X
/ 11000
/
/
/
11011
R-X
23
Z
/
23000
23
W
W
23612
. 3 . 6 . -
,
, -
99
, (, ),
.
, ,^
.
,
,
( , ,
). , .
,
.
,
.
- .
.
, .
,
.
,
, ,
.
. .
.
,
, .
-
180x86, ,
.
1. , ?
( )
?
2. ,
DOS?
, MS DOS Windows NT/2000/XP.
3. MS DOS.
4. DOS-?
5. ,
,
.
100
3.
6. ?
?
7. ? ?
8. .
( ) ?
9. ? ?
10.
. .
. ?
?
12. ?
?
13. 5^ ? Windows NT/
2000/
?
4.
i80x86
, ,
32- ,
,
, ,
180x86 32- ,
, 32-
Intel 80386, ,
Intel. SSE,
,
. ,
,
, .
, ,
IBM PC, Intel 8088.
16- Intel (
8086), , , 8- , 16-
( 8086). -
102
4. i80x86
, ,
.
,
,
.
: (real mode)
16-
(protected mode), ,
- .
16-
18086/18088 ,
. , ,
18086/18088 16-
Intel. , , ,
, , [12, 24, 40] . ,
( ,
180x86 )
1
(. 4.1). ,
16 20 ,
, ,
.
CS
CS
0 0 0 0
0
15
+
IP
15
=
19
. 4 . 1 . 8086
,
,
. ,
(Code Segment, CS)
16 ( ) ,
-
180x86
103
180x86
i80x86,
, . 4.2.
:
(EIP) 32- , 16
IP;
(EFLAGS) 32- , 16
FLAGS;
, , , EDX, ESP, ,
ESI, EDI 32-, 16
, , CX,DX, SP, , SI, DI;
CS, SS, DS, ES, FS, GS 16-,
( ,
) 64- ,
;
,
2^^ - 1 = 65 535 = 64 , ,
FFFFFFFFOOH, FFFFFFFFH.
, 32- (
i80286) 64 .
104
4. 180x86
EIP
IP
FLAGS
EFLAGS
31
31
15
16
ESP
SP
ESI
Si
EDX
DX
EDI
Di
63
15
47
CS
15
; ;
SS
1
161
0!
DS
'-----.-.-----.-.----J
ES
1
_______J
FS
- - - - - - - - - - - - - - - - J
GS
18,
LDTR
TR
GDTR
IDTR
47
16
CR3
CR2
CR1
CRO
. 4.2. 180x86
16- - (Lo
cal Descriptor Table Register, LDTR) (
) 64- ,
, ,
;
16- (Task Register, TR)
, ^ -
32- 180x86
105
32-
180x86
,
,.
.
:
106
4. i8Qx86
(,
) ,
;
() .
i80x86
.
.
,
. . 4.3.
31
23
( 31-24)
19
15
11
D
19-16
Limit
( 15-0)
31
DPL
23-16
( - limit)
( 15-0)
15
()
. 4 . 3 .
( , )
, , , -,
, -, ^
( i80286 16-
).
, , . 4.3,
. (
), , ,
^ (
) .
LDT (Local
Descriptor Table).
. ^ GDT
(Global Descriptor Table). , (
) .
LDT GDT .
, ,
^ , , ,
, -
.
32- i80x86
107
. ,
: , ,
. , CS,
SS, DS, ES, FS, GS .
(. 4.4).
(Index) 13 (3-15)
( ).
(Table Index, TI) 2
(
). TI = ,
(GDT),
. TI = 1,
; (LDT).
(Requested Privilege Level, RPL).
1
<ci
1 I
T
I
I
r
I
I
r
I
I
I
I
I
1
I
i
T
I
i
1
I
I
1
I
I
:-T
I
I
( )
1
I
I
1
I
1
'
1
'
^
^
TI
'
I
^
I
T
'
I
RPL
. 4.4.
, GDTR.
(GDT) . , GDT
.
, (.
1). I32
, .
, ,
(Task State Segment, TSS). TSS
. 4.5. , .
(Task Register, TR).
TR () GDT.
TSS.
(. . 4.2). TSS , ,
TSS ()
.
LDTR .
TR .
, LDTR ,
GDT.
LDTR LDT . ,
108
4. i8Qx86
, ,
^
. ,
.
,
(
)
31
16
15
68h
LTDR
60h
48h
(, , EDX, , ESX,
, ESI. EDI)
>
TSS
(108 )
28h
EFLAGS
24h
( EIP)
20h
Link
. 4 . 5 .
TI ,
, GDT LDT
(), ( 3-15 . 4.4).
() CS.
EIP (Extended Instruction Pointer
) ,
,
, EIP ,
.
. , 180x86 ,
(S, d) 32- .
109
32- i80x86
, .
, (
),
. EIP
, ,
.
^--'''"^''.-''"'-^./'"'^v^j
EIP
CS
LTDR
> LDT
LDT
GDTR ( GDT)
. 4 . 6 .
> GDI
110
4. 180x86
. 4.6.
, ,
, ,
EIP
. ,
.
, ,
. ,
.
, ,
. ,
,
,
. ,
, . ,
, .
i80386
. ,
(32 ),
.
, ,
, -,
. ,
.
,
, -
( , ),
. ,
(2^^ = 4096 = 4 ),
20 , ,
.
.
32 : 20
( , 12
),
, . 4.7. ,
.
.
111
32- i80x86
31
12
11
00
<
S
LD
00
(0
/)
(0
(0
3
. 4-7.
,
, ,
,
,
. , (dirty),
, ,
.
(access) ,
. ,
LRU LFU. ,
.
10 (Page Table
Entry, ), 10
.
,
.
. 4.8.
, ()
, (Page Directory
Entry, PDE).
CRO.
(PDE ) 1024 (2^^ = 1024).
, ( ) 4 (32 ),
.
.
4 . , ,
1024 , 4 .
, , 55 (
, ,
, ^),
14 (14 4 = 56 ),
. , PDE (
), 14 , Picture Element
. .
112
4. 180x86
. PDE ).
, 55
15 , 60 , .
CR3
. 4.8. 180x86
32- i80x86
113
,
4 2^^ =
4 ! , .
, , TSS,
PDE .
2^^,
,
. , ,
, ,
, ,
.
.
, , ,
. 32-
, 180x86,
. , 64-
^ ,
32- ,
.
,
, 16- ,
. 16-
,
, ,
, ()
. , i80x86
. 16- DOS-
( ),
, DOS-,
32- .
180x86 (
18086, V86,
),
DOS-.
.
114
4. i8Qx86
VM
(Virtual Mode) EFLAGS.
, (
) 64 ,
1 ,
, .
16-
.
,
, 32- ,
.
, , 16-
,
.
. ,
18086. ,
, ,
.
, -,
(. ), .
(-) ,
,
. IN, OUT, INS, OUTS, CLI, STI ,
( ) ,
.
,
^ ,
, , ,
.
,
. , , Windows NT
, OS/2
DOS-, ,
Win 16. , ,
,
Win32 API.
, -, .
115
180x86 .
,
. ,
,
,
.
,
.
( )
. (
, , )
;
.
.
,
. ,
.
,
. ,
( )
, ,
.
, ,
, , ,
. ,
,
.
, ,
.
,
. ,
,
. -
116
4. 180x86
: .
.
,
,
, ,
.
-
,
.
180x86
, ,
.
, , 3 .
( ),
.
. , () 1 , ,
, ,
-. 2
,
, ,
.
, , OS/2 :
,
-,
.
.
, 180x86
, PLO (Privilege Level
0). , ,
,
/
.
,
, .
.
, .
(. . 4.3),
DPL (Descriptor Privilege Level ,
),
. , DPL
(Current Privilege Level, CPL), -
117
. -
(. . 4.4) (Requested
Privilege Level, RPL)^
,
.
,
().
,
( ), CALL, JMP, INT, IRET, RET.
: (
) , .
CPL, RPL, DPL
(Effective Privilege Level, EPL)^
, ,
.
CPL < EPL.
,
. ,
, , , .
,
.
.
, :
CPL = DPL = RPL
)^ .
, ,
. , SS,
, .
,
, .
,
. ,
. ,
,
( , -, RPL ( ). DPL
RPL .
,
, RPL DPL.
118
4. 180x86
).
, .
.
180x86
, , , [1, 8].
,
, 180x86 ,
. 4.9.
,
,
.
,
. ,
....
,
, ,
(gates).
,
, . ,
,
.
( ),
(. 4.10).
,
, ( ),
, 32-
. . 4.11.
CALL FAR CALL (
). ,
, ( ) . ,
(FAR CALL), ,
, .
.
119
. 4 . 9 .
:
DPL ; CPL;
DPL
RPL ;
DPL DPL
;
DPL
CPL.
.
( , ,
),
( , ) . ,
.
120
4. i80x86
,
. ,
, , .
,
}^ ( ) .
, ( )
, .
.
CALL
. 4.10.
31
23
19
15
' 11
( 31-16)
DPL
1100
31
000
DWORD
( 15-0)
15
()
. 4 . 1 1 .
121
.
,
, [8].
.
, - .
(PLO-).
,
.
.
, ,
.
.
.
8- 16- , 32-
. ,
32-
.
. ,
,
( IF = 0).
.
DF .
Q RET RET
WC (Word Counter ) ;
= 4 X WC, , .
,
(. ).
.
Q (.
),
, .
.
, -
, ,
.
122
4. i80x86
.
, 13-^ PLO- .
-,
, ,
. PLO-
, - .
32-
i80x86
i80x86
, , ,
,
, ,
, .
.
,
, (
),
, , .
, , :
IP,
CS. 1024 .
, 256 . 18086
00000H-003FFH.
i80286 IDTR
(Interrupt Descriptor Table Register ).
i80x86 .
IDTR
.
()
, , , .
, ,
. , (
)
IDTR,
.
, 3. , 3.
32- 180x86
123
, ,
. ,
.
IBM PC, ,
: .
, ,
, ,
(INT, INTO). :
( 0);
TF (Trap Flag )^
DEBUG (
1);
, INT (Interrupt
) INTO (Interrupt if Overflow ),
.
INT ,
, INT .
,
,
.
- .
,
. NMI (No Mask
Interrupt ) INTR (Interrupt Request
). ,
.
^. (
18259) () ;
^.
.
PSW (Program Status Word
),
.
PSW Intel 80x86 .
(
) ,
-.
, ,
,
.
124
4. 8086
,
. ^
, ; .
1. ; PSW.
2. - IF TF,
PSW,
.
3. CS IP PSW.
4. ,
, IP CS.
,
STI (Set Interrupt Flag
), IF 1,
,
, .
,
IRET (Interrupt Return), 16-
IP, CS PSW
. ,
, .
.
1.
, , INTR (
), .
2. IF PSW. 1,
3. .
, , ,
. ()
.
3. INTA ( ).
.
.
. , ,
, .
i80x86
. , ,
32- 180x86
125
, (Interrupt
Descriptor Table, IDT). , ,
IDT
, (
), ()
. ( )
Morjrr ,
, IDTR (. . 4.2).
GDTR ,
. ,
IDTR , ,
18086, ()
4 32- . (CS:IP).
,
. ^
. , , IDTR
, .
IDTR
.
,
, 8- ,
, .
,
,
,
. IDT
, ,
- ,
.
,
.
:
(interrupt gate);
(trap gate);
(task gate).
, ,
(),
.
,
. ,
oc^ecec (
) / . ( ),
^
(TSS). .
126
4. 180x86
. 4.12.
()
)
CS
1
>
RPL
IDT
EFLAGS
GDT
225
71=0
5
!
j
0
LDT
2.3
^
^
2.2
Ti=1
2.1
0
. 4.12.
IDT,
IDTR ,
8 ( ).
,
, .
1. :
SS SP,
;
EFLAGS;
CS IP.
2. ,
( IF = EFLAGS).
,
.
32- 180x86
127
3.
.
,
.
, ,
,
,
. ( ,
) , .
, .
( , )
.
, ,
, .
,
.
,
, ,
(. 4.13).
,
, (
) TSS.
,
.
1. TSS,
TR (. 32-
180x86 ).
2. .
3. TSS (
TR) .
, LDTR, EFLAGS,
, EIP .
4. NT (Next Task).
5. TSS .
6. CSrIP, TSS,
.
,
,
. TSS -
128
4. i80x86
(LDT),
LDTR . ,
,
.
, RPL CS,
TSS. ,
,
IFLAGS, CS IP,
,
.
I
GDT
TSS
TSS
|>
W
. 4 . 1 3 .
,
,
,
, .
,
.
1. 180x86
?
129
2.
180x86?
3. 180x86 - TR?
?
4. 180x86
?
5. ?
?
?
6.
?
180386 ,
?
7. ?
( , ) ?
8. ? 1
?
9. 180x86
?
10. ?
180x86?
?
. ? , ?
?
12.
.
13. . ,
?
14. 180x86
.
15.
180x86
?
16. ,
?
17. ,
?
18. ,
?
5.
-
,
, ,
,
, -.
, -
, . ,
-,
, ,
. ,
-. , .
, -
. , -
,
. ,
, ,
( Linux FreeBSD,
),
API, -. ,
Windows Microsoft . ,
, .
. ,
, ,
- , , ,
, -
131
, ,
-, .
, -
,
. ,
- ,
.
-,
-,
,
. -,
, .
, ,
, , , -
. , -
, ,
.
:
-
.
.
, .
, - ,
. -
^,
.
,
-.
, , ,
, ,
-
,
.
- (
) .
. , -,
, -, , ,
, , .
132
5. -
,
-. .
, .
. ,
,
.
,
.
-. ,
.
,
,
, .
,
,
. -
- () -,
, .
-.
, /
( ) .
, ,
, , ,
.
- .
-
, - .
-
, - .
, -,
.
, -
, -.
, .
1. ,
,
, -. ,
, -
133
. ()
()
.
2. - -
.
3. -
, - (
- , ).
- ,
.
4. - - (
) -
, , .
5. -
(. 1)
.
6. - ,
-.
7. -
-, .
^, - ^,
-
(
).
, (
) -
, (
), ,
-
, .
-,
.
-,
( -,
). , , ,
, , ,
, -
. , ,
.
, ,
,
.
134
5. -
- API
, .
, -,
, API,
, . ,
,
,
.
( , ,
)
. ,
,
.
,
.
-
, -:
- (. 5.1).
_
-
'
. 5 . 1 . -
-
.
( ,
- ).
, ,
135
, - .
, ,
, .
, ,
, , -.
- ( )
, ,
.
-
( ),
,
. ,
, ^1 ,
. ,
,
. ,
. , ,
. , -,
-
.
-.
(. 1).
. (
), * ,
-
. ,
-
, -.
, ,
,
. /
.
, ,
: ,
.
-.
-
-.
( ,
,
) .
, , -
136
5. -
.
- ,
, , ,
.
,
,
.
-
.
-
~
.
. , Windows ( Windows 9, Windows NT/
2000)
, , ,
100- . ,
, , ,
,
,
.
,
-
, , ,
.
,
.
,
-.
-, ,
.
.
, ,
(spooling Simultaneous Peripheral Operation On-Line,
).
-,
.
, , ,
,
, .
, -
137
.
, ,
( )
( - spool-file) ,
,
-
, . ,
-, (spool-reader)
(spool-writer).
Windows 9x/NT/2000/XP Microsoft.
. Microsoft
. ,
, ,
. .
, .
,
,
.
, -
, .
,
. ,
, , -
.
( Microsoft ,
: , ).
.
. ,
,
. ,
, ( ), -,
.
,
.
, ,
.
, -
138
5. -
.
.
,
.
-
-
, ,
. ,
, :
- ;
,
-;
() -,
;
-
,
;
- , ;
, ;
, ,
- (
).
-,
, , .
-, (
, ) .
,
-, ,
.
,
,
. ,
, ,
Hewlett Packard -.
-
, - -
139
,
.
( ) , .
(equipment table),
(Unit Control Block -).
UCB , ,
:
, ,
;
( , ,
. .);
( ),
;
, ,
;
,
, ( ) ,
;
- -;
;
, ;
, .
.
(, ,
), UCB
, ,
. ,
,
. ,
.
,
, .
- .
, (/
) -, (
) .
, -. ,
140
5. -
()
.
, C-H-S (Cylinder-Head-Sector
, ) .
, (. 6).
,
(, HDD IBM IC35L 120AW207-0,
WDI200JB -).
, ,
- .
,
.
,
. -
. ,
(),
.
, ,
.
, ,
, ,
,
. (Device
Reference Table, DRT).
() ,
( ).
, -
, (
) .
:
,
( )
, .
,
-.
UCB,
.
,
,
-. ,
-.
-,
. ,
141
(),
UCB.
.
,
32- ,
,
-. ,
, , (Data Control Block, DCB).
DCB -
,
. ,
- ,
, , .
,
,
-.
. 5.2.
1-
1-
1-
i-
j-
^
^
h-
j-
^
^
W.
W
. 5 . 2 . -
- ,
(. 5.3).
-
( 1).
API.
, .
, ,
142
5. -
. .
( 1-1).
, -
( 2). ()
DRT UCB .
, ,
-, , .
, - UCB
,
,
( 3),
- , -
( 4).
, -
( ) ,
( 5). ,
- ,
,
( 6). ,
, ,
. ,
,
-.
J
1
1
....
1-1
-
(
)
2'
>
DRT
> >
5
^
^
UCB
()
W
W
i
3
>
-
k
WW
-
(
. 5.3. -
143
,
- ( ),
,
- ,
.
.
-
, -,
.
, ,
,
. -. -
.
,
-.
,
-,
,
. )^
,
.
-. ,
-. ,
, , -, -
, -, -
, UCB.
.
, ,
- ( ).
,
-, ()
,
() ,
. (
,
, ),
144
5. -
. ,
-
-,
. ,
, ,
-.
, , , ( ),
(
)
.
, -
-,
.
-
, .
- , ,
.
-
, ,
().
. ,
( )
, ,
, -
. , -,
, ,
. ,
(
) {)
.
.
. ,
(. 7).
() (
) ,
.
(
),
( ).
,
.
,
145
, , ,
- . -
,
.
, , ,
-.
,
. , ,
().
, .
^ ,
-.
,
, .
,
.
,
. ,
,
. ,
,
. , ,
, (
) ,
,
.
,
().
-
,
146
5. -
. -.
,
. , ,
, ,
(). ,
, ,
, (). ,
. ( )
.
, .
.
,
, { track),
(sectors).
512 . ,
,
. (), , .
() ,
, (cylinders).
.
(head) / , . ,
C-H-S , .
,
.
.
, () .
,
,
.
.
(partitions), .
; .
, , ,
. , UNIX- .
. -, . , -
147
,
. -,
, . ,
Linux \
( ) .
,
.
,
,
.
, ,
, . ,
, ,
,
,
(Master Boot Record, MBR). MBR ,
0-0-1. , MBR,
(Non-System Bootstrap, NSB).
512
,
, , (Partition Table,
), 64 . MBR
0x1 BE .
. 5.1. ,
: C-H-S ,
LBA^ (Logical Block Ad
dressing) . ,
. MBR 0-0-1,
0-1-1 (
LBA 64).
Boot
Indicator ( , 128 (80(h)) ~ ).
, .
, Linux UNIX- ,
6 . (swap partition)
. () , /, /usr, /home,
/var /boot. .
,
: LBA = c x H + h)xS + s - l .
; S ; , h s
.
148
5. -
, .
, NSB, MBR.
5 . 1 .
,
. ,
,
. System ID (
),
.
, , . 5.2
, (
).
5.2.
OOOh
085h
001 h
FAT12
086h
002h
Xenix root
087h
003h
Xenix /usr
08Ah
AiR-Boot
004h
FAT16(<32Mb)
08Bh
005h
Extended
08Ch
006h
FAT16
08Dh
FreeFDISKFAT12
007h
NTFS, HPFS
08Eh
Unux LVM
008h
AIX Boot
090h
009h
AIX Data
091 h
OOAh
092h
OOBh
FAT32
093h
Amoeba native
149
OOCh
FAT32 LBA
094h
Amoeba BBT
OOEh
FAT16LBA
095h
MIT EXOPC
OOFh
Extended LBA
097h
010h
Opus
098h
011h
Hidden FAT12
099h
DCE376
012h
Compaq Setup
09Ah
013h
B-TRON
09Bh
014h
09Fh
BSDI
016h
Hidden FAT16
OAOh
Laptop hibernation
017h
OAlh
NEC hibernation
018h
0A5h
019h
Photon
0A6h
Open BSD
01 Bh
Hidden FAT32
0A7h
NextStep
01 Ch
0A8h
Apple UFS
01 Eh
0A9h
Net BSD
020h
0FS1
OAah
Olivetti service
022h
Oxygen
OAbh
Apple Booter
024h
NEC DOS
OAeh
ShagOS native
035h
O S / 2 JFS
OAfh
ShagOS swap
035h
Theos 3.x
OBOh
BootStar Dummy
039h
0B7h
03Ah
Theos 4.x 4G
0B8h
03Bh
OBBh
OS Selector
03Ch
Partition Magic
OBeh
Solaris 8 boot
040h
Venix 8 0 2 8 6
OCOh
041 h
OCIh
DR-D0SFAT12
042h
LinuxSwp/DR-DOS, SFS,
Win2K D D M
0C6h
043h
LinuxNat/DR-DOS
0C2h
045h
Eumel/Ergos 4 5 h , Boot-US
0C3h
046h
Eumel/Ergos 46h
0C4h
047h
Eumel/Ergos 47h
0C7h
048h
Eumel/Ergos 48h
OCBh
DR-DOS FAT32
04Dh
OCCh
04Eh
OCDh
CTOS memdump
04Fh
OCeh
050h
ODOh
REAL/32 big
150
5. -
5.2 ()
051 h
DM6Aux1,DMR/W
ODIh
052h
0D4h
053h
0D5h
054h
0D6h
055h
EZ-Drive
0D8h
CP/M-86
056h
ODBh
057h
Drive Pro
ODDh
05Ch
Priam Edisk
ODFh
DG/UX
061 h
Speed Stor
OEOh
STAVES
063h
Unix
OEIh
064h
0E3h
065h
NetWare 3.x
0E4h
067h
Novell 67h
OEbh
BeOS
068h
Novell 68h
OEeh
EFI header
068h
Novell 69h
OEfh
070h
DiskSecure Multi-Boot
OFOh
Linux/PA-RISC boot
074h
Scram Disk
OFIh
Storage Dimensions
075h
PC/AX
0F2h
DOS Secondary
078h
XOSL
0F4h
07Eh
F.I.X
0F5h
Prologue multi
OBOh
MINIX 1.1-1.4a
OFBh
VMware nat^ve
081 h
MINIX1.4b+,ADM
OFCh
Vmware swap
082h
OFDh
Linux RAID
083h
Linux native
OFeh
084h
OFFh
Xenix BBT
,
. ,
,
, ,
.
MBR 55(),
1. ,
. 55^^),
, .
: (primary) (ex
tended). .
, .
, , -
151
. DOS-
, DOS,
. (hidden).
Windows 9.
, , ,
(logical disks).
primary
, .
.
MBR (Secondary MBR, SMBR),
(Logical
Disks Table, LDT). LDT
, ,
SMBR. ,
, SMBR, .
( ) .
, NSB
,
(System Bootstrap, SB)
, .
MBR (. 5.4).
MBR, , BIOS.
^, .
. )
(bootstrap loader) (BIOS
INT 19h).
( ,
-, ZIP-drive Iomega,
- )
-.
, ,
(NSB) MBR, .
,
. ,
.
. , ,
, , ( )
BIOS. , BIOS,
, , ,
152
5. -
,
.
'''
DOS
( :)
D:
:
//
/
D:
\\
//
\
DOS
D: :
0 -
. 5.4.
,
.
. (boot managers) ,
. .
OS Selector Acronis.
:
,
DOS (MS DOS, DR-DOS .), Windows (9/, NT/2000/XP), OS/2,
Linux, FreeBSD, SCO Unix, BeOS .;
153
FAT16/FAT32,
, ;
, , ; ;
, ,
BIOS ;
FAT16/FAT32,
, ;
;
;
MBR;
BIOS;
.
. FDisk ( Form Disk ).
, ,
FDisk Microsoft. ,
,
,
.
( FAT, FAT32, NTFS).
Win32API,
.
Partition Magic
Power Quest.
,
OS Selector Acronis.
:
FAT16, FAT32, NTFS, Ext2FS (Linux), Linux ReiserFS, Linux Swap,
;
;
;
Q FAT 16 FAT32 ;
FAT16, FAT32, NTFS, Linux Ext2FS, Linux
ReiserFS Linux Swap;
154
5. -
;
^ ,
, ;
.
Microsoft
. , Windows NT
4.0 (Disk
Manager), Windows 2000 Windows
(Disk Management).
, ,
() ,
.
, MS DOS Windows 95/98,
, Windows NT,
.
, , ,
.
( :, D:, : . .)
. : 1,
D: 2, : 3, . .
boot.ini, Windows NT/2000/XP,
.
, Linux
. IDE-
, (master),
hda. , hdb^ ,
hdc ,
, . .
MBR, .
, ,
5. ,
() MBR, SMBR.
, (. . 5.4), 1 Linux
1. ,
, hdal.
, Windows D:
2, Linux hda5. :,
Windows 3, Linux 6
hda6. , . 5.4
, IDE-,
1 (slave).
IDE- (26 ).
155
. MBR
. , ,
. 4 ,
. 1
:. SMBR,
D:. ,
MBR. Linux . :
6, 9, ,
. ,
.
, ,
, ( Windows F:)
7.
Windows NT/2000/XP
Windows NT
, , Windows NT/
2000/ .
boot.im*.
. ntldr, , ,
.
boot.ini .
5.1.
5.1. boot.ini
[boot loader]
timeout=10
clefault=mult1(0)disk(0)rdisk(0)part1tion(2)\WINNT
[operating systems]
mult1(0)d1sk(0)rd1sk(0)part1tion(2)\WINNT="IT.MTC.EDU Microsoft Windows 2000 Server RUS"
/fastdetect
multi(0)disk(0)rdisk(l)partition(2)\WIN2KP="Staff.MTC.EDU Microsoft Windows 2000
Professional RUS" /fastdetect
multi(0)disk(0)rdisk(0)partition(4)\WIN2K_S="SQL server on M$ Windows 2000 Server RUS" /
fastdetect
multi(0)disk(0)rdisk(2)partition(2)\WIN2K.PR0="Microsoft Windows 2000 Professional RUS"
/fastdetect
C:\="Microsoft Windows 98"
C:\CMDCONS\BOOTSECT.DAT="Recovery Console Microsoft Windows 2000" /cmdcons
156
5. -
default. timeout - 1 ,
,
Enter.
default , (
) , .
:
clefault=mult1(0)d1sk(0)rcl1sk(0)part1t1on(2)\WINNT
multi , ntldr
BIOS ( intlSh).
0.
disk
IDE- ,
, . SCSI SCSI ID .
rdisk .
IDE- 4 ;
3.
, partition ,
. ,
.
, [operating systems],
,
. ntldr,
.
Windows NT/2000/XP -
(, DOS, Windows 9, Linux . .), .
,
( ).
:, ntldr
. , MS DOS Windows 9
,
:. , ,
, bootsect.dos.
-
,
.
. ,
, ,
, , , ( -
157
, ,
)
0,5 (!).
;
. ,
20 ,
,
-. ,
(, , 512 ,
).
, 2-3
,
.
, /
(disk cache).
.
, ,
. .
,
. ,
.
, ,
.
, ,
,
. - ,
, , , ( ,
).
,
. :
, ,
. ,
.
(lazy write^).
, .
.
( ), ,
.
, ,
, ,
( ) , .
158
5. -
.
. , ,
,
, - (, )
,
5 .
, , ,
,
.
.
(read ahead),
,
.
,
. , ,
. , ,
, , .
, ,
.
,
, . ,
.
. , ,
.
,
. , ,
, .
, .
, ,
, .
,
.
,
. ,
.
.
100- - ,
,
. ,
159
,
,
,
.
,
.
, Windows 9 ,
, (chunk^) ,
, , .
SYSTEM.INI,
( Windows), [vcache] ,
, :
[vcache]
M1nFneCache=4096
MaxFileCache=32768
ChunkSize=512
, 4
, 32 ,
, , .
,
, 256 ,
MaxFileCache.
262 144 . -
^
.
Microsoft
, .
,
, ,
, .
,
.
Windows NT 4.0, Windows 2000 Windows
. ,
.
, [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management] lOPageLockLimit
163777216, , 16 384 ' .
^ VCACHE , 256 -
160
5. -
.
. , , ,
Microsoft ,
,
, . ,
^ ,
( ). ,
.
.
, 16
128 .
,
(., ,
HPFS 6).
, ,
/ ,
. ,
,
;
. ,
.
, .
,
.
:
(
,
-), ,
.
.
,
/ [].
557^ (Shortest Seek Time First ).
,
,
-.
,
. -
161
,
, .
.
Scan ().
, ,
. /
, ,
Next-Step Scan ( ).
, ,
. ,
/,
, ,
.
'Scan ( ).
,
, .
, ,
, ,
,
.
[].
.
1. -
?
2. -
?
3. , -?
4. ^ - ?
5. - ? .
6. spooling swapping?
7.
-, ?
8. -?
9. ( ).
( ) ?
162
5. -
10.
? ,
? ?
11. -
.
,
Disk Editor.
1. .
BIOS .
2. , .
3. ( MS DOS
).
4. Disk Editor .
.
5. . MBR
.
6.
. . Disk Editor.
7. FDisk. , ,
?
8. FDisk.
9. , ,
, .
10. Disk Editor, ,
,
Disk Editor.
6.
. , UNIX
,
.
. , -,
. -,
. ,
,
.
,
. ,
, .
, .
FAT, FAT32 NTFS.
,
.
NTFS,
.
, ,
.
.
, .
-
164
6.
. ,
,
.
, , , , ,
,
, .
,
,
.
:
, , ( )
()
,
;
;
, ,
( );
( API );
.
,
.
( ,
).
(
), .
, ,
, ,
API. ,
API . ,
, ,
.
,
.
, FAT (File
Allocation Table )
. , ,
, FAT (
165
FAT12^). ,
.
,
FAT 16.
MS DOS,
OS/2,
FAT, super-FAT;
.
FAT Windows 95/98, Win
dows NT . . , ,
,
; .
,
, ,
,
.
FAT,
,
. MS DOS, OS/2, Windows 95/98/
ME, Windows NT/2000/XP, Linux, FreeBSD ,
FAT.
. ,
. ,
. ,
, ,
;
, . ,
,
,
, .
, , ,
, .
,
.
,
,
.
, , . ,
, ,
, . ,
12 , ,
, 12 .
166
6.
.
.
(directory). ,
. ,
. ,
,
. ,
,
, . -
;
. - (subdi
rectory). - ,
-,
.
, , -,
,
.
- ,
.
FAT
FAT (File Allocation Table )
, :
,
;
;
(
).
FAT
(. 6.1): .
BR
RSec
FATi
FAT2
RDIr
. 6 . 1 . FAT
, .
-;
, . -
FAT
167
, ,
-. , ,
.
(
):
(Boot Record, BR);
(Reserved Sectors, ResSec);
(File Allocation Table, FAT);
(Root Directory, RDir).
. , ,
,
.
.
( ).
, (
). ,
.
.
,
.
,
(. 6.1). FAT , (
-), .
FAT 16 16- , ,
2^^ = 65 536 ( 65 535).
6 . 1 . FAT16
,
16-127
128-255
256-511
16
512-1023
32
16
1024-2047
64
32
168
6.
.
2.
:
, FAT;
;
,
, .
, .
,
. . 6.1 , 32 (
512 1023 ), 16 ,
8 , ^
100 .
( 512 4 ),
.
,
, . 6.2.
Directory Entry
MYFILETXT
01
02
00 ID
FF
03 h .04.
00
00
hi
00
10 00
03
00
1 i i 11 1i 1i
04
Lo5.
00
time
data
05
06
07
09
OA
.FF
00
00
09.
.0AM0B1J15
16.
17.
19
F7
IB.
OB
size
08
OD
OE
OF
00
00
00
00
,1C. ^ J D .
^ .FF
00
00
. 6.2. FAT
, MYFILE.TXT , .
MYFILE.TXT 12 . (chain)
: 8,9,0 , , 15,16,17,19,
^ , 10 000-15 000 ( ,
) 1000 .
FAT
169
1 , IB, 1, ID. 18 F7
(bad), .
, ,
, FAT .
ID FF ( ) ,
. ()
00;
. ,
FAT, . 6.2.
6.2. FAT
OOOOh
fff0h-fff6h
fff7h
fff8h-ffffh
0002h-ffefh
(, ,
),
,
,
, . ,
.
, FAT
, ( -
) , .
, , , ,
, .
FAT
, .
FAT , .
- ,
. , , ^
ScanDisk Windows 9
FAT ,
.
- ,
.
, . 6.3.
DOS,
FAT, Disk Editor
170
6.
. . ,
, MS DOS,
. ,
, ,
FAT , .
, FAT32 NTFS.
Partition Magic,
Acronis.
6.3.
,
11
FAT
DOS
, DOS,
:. ,
; 0-0-1.
, , : (Disk Parameter Block,
DPB) (System Bootstrap, SB).
,
DOS.
. 6.4.
(JMP) SB. 90 (NOP ).
,
- .
, .
DOS,
, Disk
FAT
171
Editor . , ,
,
. [2].
6.4. FAT16
,
(0)
JUMP
(3)
0(11)
SectSize
(13)
ClastSize
0(14)
ResSecs
(16)
FATcnt
FAT
11(17)
RootSize
Rdir
13(19)
TotSecs
,
32 ;
15(21)
Media
16 (22)
FATsize
FAT,
18(24)
TrkSecs
1 (26)
HeadCnt
HidnSecs
1(28)
20 (32)
,
32
24 (36)
( ,
80 )
25 (37)
26 (38)
29
27 (39)
2 (43)
11
36 (54)
(62)
1FEH(510)
( 55)
(volume) .
.
VFAT FAT32
FAT
8.3. FAT (
FAT16) , -
172
6.
Microsoft ( Windows 95
Windows NT): VFAT ( FAT) FAT32,
Windows 95 Windows 98.
FAT32 , Windows Millennium
Edition, Windows 2000 Windows XP. FAT32 Windows
NT, Linux.
VFAT Windows 3.11 (Windows for Work
groups). Windows 95 VFAT
(Long File Name, LFN). , VFAT
FAT; ,
8.3,
8.3 , .
VFAT Windows 95, Windows NT 4, Windows
2000 Windows XP. VFAT
, VFAT . ,
DOS ,
) FAT.
, VFAT ( FAT32).
, VFAT ,
VFAT.
FAT VFAT,
, (
),
. Microsoft Windows 95 OEM Service Release 2^
VFAT FAT32,
32-
FAT.
, FAT32
. ,
, ,
65 535 (
). ,
8 FAT32 4-
. FAT 16
( 10-15 %). FAT32
,
2^^ ^.
FAT32
FAT . FAT32
Windows 95 Windows 95 OSR2.
32- FAT32, ,
28 , ,
2^* .
173
FAT
;
FAT32
. FAT32
, ,
,
(512 ).
Windows 95 0SR2 Windows 98 VFAT,
Windows NT. ,
VFAT VFAT, FAT32.
FAT ( FAT32 , FAT VFAT)
,
FAT32 ,
FAT32.
1 0 1 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 11011111231141151167811912012112212312412512612712812913013]
(FAT16 FAT12)
(0
;
(8
3 - )
*=
8
Afe
8-5
(0
(FAT32)
5
.
S
(8
3 - )
>i
(
(0
h Is
m
S
&
CO
|i
ffl
1-5
Unicode
6-11
Unicode
11
12-13
Unicode
1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 11011lll2ll3ll4M5l16l17l18l19l20l21l22i23l24l25l26l27l28l29l30i31
. 6.3. FAT, VFAT FAT32
174
6.
, FAT32
.
, FAT
. 512 .
FAT Microsoft
:
, . ,
,
FAT32 512 2048. ,
-
, Microsoft
.
VFAT (. 6.3).
11 DOS .
:
,
, .
,
. ,
^
.
,
.
,
,
.
. () ,
, .
,
,
, . .
.
DOS^. .
(Archive ). ,
, . DOS
.
(, , ,
, , BIN.
, Novell Netware,
.
FAT
175
) .
,
,
.
D (Directory ). ,
, .
V (Volume ).
. .
^ ,
.
S (System ). ,
,
.
(Hidden ).
S (), DIR.
R (Read only ). ,
. , ,
, , ,
.
,
.
, ,
, . ,
, ,
.
FAT 12 FAT 16 10 .
.
FAT32 10
. , NT,
, , , DOS Win
dows 9, Windows NT.
,
FAT 12 FAT 16,
FAT32. ,
FAT32,
10
FAT 12 FAT 16.
. 6.3,
. ,
, .
256 ,
25 FAT (1 8.3 24
176
6.
). ,
VFAT 21. , ,
Microsoft
OTcjrrcTBHH FAT32,
^
FAT32
FAT16. , , FAT32 DPB
, , FATI 6
, . ,
FAT16, ,
FAT32, ,
FAT32. FAT32 -
OEM ID,
59 (PDB).
DPB (. 6.5).
6.5. FAT32
,
"
JUMP
(0)
""
(3)
(11)
SectSize
(13)
ClastSize
0(14)
ResSecs
,
FAT32 32
(16)
FATcnt
FAT
11(17)
RootSize
13(19)
TotSecs
15(21)
Media
16(22)
FATsize
18(24)
TrkSecs
1 (26)
HeadCnt
1(28)
HidnSecs
(
) .
, , (
8.3), 260 . FAT32
,
. Microsoft
75-80 , (180-185 ).
HPFS
,
177
20 (32)
24 (36)
FAT
28 (37)
2 (38)
2 (39)
34 (43)
36 (54)
12
, FAT32 ,
FAT 16 FAT12, . , ,
7-9.
HPFS
HPFS (High Performance File System
) OS/2 1.2
LAN Manager.
IBM Microsoft IBM
MVS, VM/CMS ^ HPFS
.
HPFS ,
[26]. HPFS, FAT,
, ,
(Extended Attributes, EAs)^,
.
, , HPFS
,
FAT.
.
, HPFS,
,
. :
^ , Microsoft
(Gordon Letwin).
^ . ,
(,
), , , . .
178
6.
;
;
, (
) .
, , HPFS
, , ,
(extents)^ .
(seek time)
/ (rotational latency)l
, HPFS , FAT,
:
;
;
,
;
.
HPFS.
(. 6.4).
>s
>5 X
)S
(0
>
S
X
.
0)
(D
Q.
Q.
g
.
<5
iC
:
^
CSi
(0
00
5
Q.
.
(Q
LQ
^
^
1-
. 6.4. HPFS
.
HPFS ,
(bands).
,
. 8
(bit map) , ,
, FAT, , , , . ,
, , , .
/
. , ,
, /.
HPFS
179
. ,
, .
.
1, , .
,
.
: , , , ,
, . .
16
.
,
, FAT,
/ . ,
, HPFS .
( )
.
HPFS , FAT, .
, ,
, . , .
,
256 . ,
, . ,
FAT 512 1023
16 . ,
8 (8192 ) ,
HPFS 256
. , 8 .
. 6.4 ,
(volume)^ HPFS .
(boot block), (super block)
(spare block). OS/2 15;
, , BIOS^
. 0S2LDR,
, , , OS/2
0S2KRNL. 0S2KRNL CONFIG.SYS
.
(bitmap
block list). ,
, , , .
BIOS
, . HPFS
(), 32- .
180
6.
, .
(bad block
list), (directory band),
(File node, F-node) ,
CHKDSK.
() . ,
.
, .
, HPFS 8 .
, .
16 ,
HPFS.
(HotFix map), (HotFix
areas), ^
(directory emergency free block list),
, .
17-
HPFS,
.
HPFS ,
\ HPFS,
FAT .
.
(
). 15
, , ,
(Access Control List,
ACL) , ,
. .
,
. HPFS
. ;
.
,
.
( 8.3) ,
FAT,
. 8
, 3 ,
. ,
HPFS,
3 .
,
.
HPFS
181
HPFS
, , ,
. , 32 .
, , ,
\ ,
32- .
, ,
, . ^
.
HPFS
,
/ . HPFS ,
4 ,
.
, , ,
.
8 .
,
(allocation block), 40
, , ,
. ,
480 ,
7,68 . 2 ,
[26].
. , 8 .
, HPFS
.
/, .
, /
,
, FAT.
HPFS FAT.
NTFS,
, (.
NTFS). , HPFS
.
HPFS (
) , (2^^ -1)512 = 2 .
182
6.
. , FAT
,
.
HPFS
, (. 6.5). ,
(Binary Tree, B-Tree), ,
,
, ,
, , ,
, .
Directory F-Node
Leaf Block
Leaf Block
Leaf Block
. 6.5.
HPFS
, ,
, . ,
,
, , ,
,
. ,
( ), ,
. . ,
, ,
FAT. (
, F-node),
,
.
.
, , , 4096 ,
FAT 64
, HPFS 2-4
( ) .
HPFS FAT. , , 40
1640 -
HPFS
183
, 65 640 . ,
65 640
. FAT,
4000 .
,
HPFS, 2 . , ,
. 13 ( 8.3) 2- 40 .
( )
.
. , -
,
. HPFS
, .
. .
.
. HPFS ,
, .
, .
HPFS ,
,
. FAT,
,
. HPFS
, , ,
.
/ .
, HPFS 4
. ,
.
HPFS ,
.
, HPFS 4
/
.
,
, ,
.
. ,
2-3 , HPFS,
184
6.
, ,
, .
, , ,
. () ,
, - ^
, 2 % ,
[26]. ,
, 3 %.
.
HPFS.
,
. HPFS
(HotFix).
HPFS
, .
HPFS ,
, , ^.
HPFS.
HPFS
.
.
, 32-
. , ,
.
, ,
. ,
,
. ,
,
,
.
CHKDSK HPFS.
() CHKDSK
( ) .
,
. CHKDSK
^ , HPFwSOPT GammaTech
, , ,
, 2 3 , (
, ,
, 8 ).
HPFS
185
, HPFS,
.
.
HPFS, ,
, 32-
. , ,
.
HPFS CHKDSK
,
, .
, CHKDSK ,
. CHKDSK
. , ,
.
HPFS .
, ,
. HPFS IPS (Installable File
System ) CONFIG.SYS. IFS
.
IFS () HPFS
2 , 8
: D:.
IFS=E:\0S2\HPFS.IFS /:2048 /CRECL:4 /AUTOCHECK:CD
CONFIG.SYS :
RUN=E:\0S2\CACHE.EXE /Lazy:On /Bufferldle:2000 /D1skldle:4000 /MaxAge:8000 /DirtyMax:256
/ReaclAhead:On
,
,
,
. , Lazy
On , Off .
Bufferldle ,
,
. (
) 500 . Diskldle (
),
, .
1 .
.
( ),
. 5 .
186
6.
OS/2 Warp.
HPFS
, OS/2.
HPFS386.IFS.
HPFS.IFS, , ,
(ACL). , ,
NTFS. ,
HPFS386.IFS, HPFS.IFS, ,
. ,
, HPFS.IFS
, . ,
HPFS386.IFS
.
,
,
, /
. /
. ,
(C-Scan).
CONFIG.SYS,
HPFS386.IFS
:
IFS=E:\IBM386FS\HPFS386.IFS /AUTOCHECK:EGH
RUN=E:\IBM386FS\CACHE386.EXE /Lazy:On /Bufferldle:4000 /MaxAge:20000
.
, ,
, HPFS386.IFS
:, G: :.
20 .
, , ,
HPFS386.INI, E:\IBM386FS.
,
. , , HPFS386.INI
. [ULTIMEDIA]:
[ULTIMEDIA]
QUEUESORT={FIFO|ELEVATOR|DEFAULT|CURRENT}
QUEUEMETHOD={PRIORITY|NOPRIORITY j DEFAULT|CURRENT}
QUEUEDEPTH={1... 2551DEFAULT|CURRENT}
HPFS
187
QUEUESORT .
FIFO, ELEVATOR, DEFAULT CURRENT. FIFO,
,
, .
.
ELEVATOR,
. ELEVATOR
( C-SCAN, [, 26]). ,
, /
(, ),
, .
QUEUESORT DEFAULT,
, ELEVATOR. CURRENT,
,
(DASD-manager).
QUEUEMETHOD ,
. PRIORITY, NOPRIORITY, DEFAULT
CURRENT. NOPRIORITY,
, . PRIORITY,
,
.
,
, . .
HPFS386.IFS, .
1.
- . .
2. .
3. (foreground session), ,
.
4. (background session), ,
,
(,
). 3 4 , CONFIG.SYS :
RIORITY_DISK_IO=NO
5. (
).
6. , .
7. . .
QUEUEMETHOD DEFAULT,
, PRIORITY. CURRENT,
,
.
188
6.
QUEUEDEPTH .
(1...255), DEFAULT CURRENT,
^ QUEUEDEPTH ,
,
. , SCSI-
,
. ,
, ,
SCSI- .
QUEUEDEPTH , ;
. QUEUEDEPTH
DEFAULT,
, .
CURRENT, .
CURRENT DEFAULT.
, HPFS386.IFS :
QUEUESORT=FIFO
QUEUEMETHOD=DEFAULT
QUEUEDEPTH=2
:
QUEUESORT=ELEVATOR
QUEUEMETHOD=PRIORITY
=< >
, ,
/QF:
BASEDEV=0S2DASD.DMD
/QF:{1|2|3}
,
(Installable File System, IFS),
() ,
.
. , , OS/2 IFS-
VFAT (FAT ), FAT32, Ext2FS (
Linux), NTFS (, ).
- CDFS.IFS.
FTP.IFS, ftp- .
Windows NT.
NTFS
NTFS (New Technology File System
) . ,
NTFS FAT16 ( FAT32)
NTFS
189
.
- ,
Windows (folders).
.
NTFS
NTFS ,
,
, .
OS/2 v.3,
HPFS.
,
NTFS. NTFS
.
, ,
.
()
. , ,
. , -
.
,
.
,
.
NTFS ,
, ,
HPFS,
. ,
, ,
,
.
NTFS
Windows NT ,
. NTFS
. , ,
,
. , ^ .
190
6.
(ACL) .
, ; 5^
. (. Win
dows NT/2000/XP 11)
Windows NT, .
NTFS .
, , ,
,
. ,
. , , NTFS
. , , ,
, ,
.
, Windows 2000/ ^
NTFS ,
.
NTFS .
300-400
. ,
, NTFS FAT16 FAT32.
( ) 16 ( 2^ , 16 000 ),
Windows NT/2000/XP FAT 16
4 , FAT32 32 .
NTFS .
NTFS ,
, NTFS
( FAT). ,
, NTFS
,
. ,
, (
).
NTFS
NTFS.
[16] [42]. .
NTFS
191
, , NTFS,
(volume). ,
,
( ) .
. ,
, RAID-.
RAID Redundant Array of Inexpensive Disks,
. RAID-
,
,
, . ,
NTFS5, Windows 2000/, RAID-
, Windows
NT 4.0, , .
,
,
.
Microsoft
. ,
,
,
, Windows 2000//2003, .
,
( Microsoft
) .
,
.
Veritas Software.
Microsoft ,
.
, NTFS
, .
NTFS 512 64 ;
2 4 . ,
4
.
NTFS (. 6.6).
12 % MFT (Master File Table
). MFT (
), ,
. MFT ,
MFT . 88 %
.
192
6.
t
8
fr
^
IS
(0
<8
CD
Q.
. 6.6. NTFS
, , ,
. MFT
, MFT. MFT
1 ,
- ( ). 16
, MFT.
,
. 16 MFT ( ,
) . MFT
, ,
MFT.
MFT.
16 NTFS () ;
- .
NTFS. $,
- . . 6.6
. ,
, , ,
$MFT.
6 . 6 . NTFS
$MFT
MFT
$MFTmirr
16 MFT,
$LogFile
$Volume
, . .
$AttrDef
$Bitmap
$Boot
( )
NTFS
193
$Quota
,
(
Windows 2000 NTFS 5.0)
$Upcase
.
NTFS Unicode (
65 ,
)
, MFT.
, : , ,
. .
MFT, ,
. ,
:
MET . ,
, ,
.
NTES
(file reference), 64- .
,
, .
, ,
NTES .
NTES
(streams)\ , .
( ), ,
. ,
( )
. , ,
, , , .
. , ,
,
, Windows 2000 (
).
HPES. ,
: (
) . , , ,
, -
(
) .
' (threads).
194
6.
( ),
.
, NTFS
, .
NTFS
(. 6.7).
6 . 7 . NTFS
( , ,
, ), ,
, ,
MFT,
.
, MFT
Unicode. ,
UNIX. ,
POSIX
8.3
,
(ACL) .
,
, . NTFS
.
,
,
,
(
)
HPFS
,
HPFS OS/2, OS/2- -
Windows NT
NTFS
NTFS (NTFS permissions)
(),
. ,
NTFS. ,
, ;
( ,
), , .
NTFS
195
. ;
Windows NT/2000/
. ,
.
.
NTFS , ,
, , .
,
. ,
: ,
, .
. ,
,
,
, ,
. NTFS:
,
, No Access ( )^
.
NTFS :
. ,
,
, . , ,
ACL,
,
.
, .
,
. -,
, ,
.
NTFS.
, .
. .
,
.
.
( ) NTFS ,
, .
, NTFS .
Windows 2000/ No Access (deny)
.
196
6.
ACL. . NTFS
.
DACL (Discretionary ACL ).
,
,
. ,
(change permissions)
. ( permissions
).
SACL (System ACL
). ,
. SACL ,
. ,
,
SACL. :
SID - - /
NTFS
197
Read_EA, Write_EA , ,
. ,
, Execute,
.
;
. ,
Generic_Read, ,
: Read_Control, File_Read_Data, Fi4e_Read_Attributes,
Fi4e_Read_EA, Synchronize.
Ha ,
, , ,
. ,
, ,
.
NTFS,
.
Windows 2000/
,
, , ,
,
NTFS, .
, NTFS - Win
dows NT 4.0 Windows 2000/. , ,
, (Explorer) -
,
.
Windows 2000/ ,
, ,
, Windows NT 4.0.
NTFS Windows NT 4.0.
, ,
.
198
6.
6 . 8 .
NTFS
(R Read)
,
,
,
,
,
(W Write)
;
;
,
;
;
(X execute)
;
;
,
;
( )
(D Delete)
( change
Permissions)
( take Ownership)
NTFS.
.
NTFS .
of Access ( ) Fi4e Permissions Directory Permissions
Explorer () Windows NT.
.
,
NTFS, .
( Microsoft)
.
.
NTFS 4
(. 6.9).
NTFS,
.
, .
List (RX, ) .
( ) -
199
NTFS
, ,
.
Add (WX, ) .
,
.
Add & Read (RWX, RX) .
,
,
, ,
.
Change (RWXD, RWXD) . ,
,
.
Full Control ( , ) .
, ,
,
.
6.9.
No Access
Ust
(RX)
Read
(RX)
(RX)
Add
(WX)
(RWX)
(RX)
Change
(RWXD)
(RWXD)
Full Control
No Access ( ) ,
,
q)ynnbi, . No Access
, NTFS.
: ,
,
.
Full Control ( ) Change () ,
, ;
() (0).
. , .
R, W, X, D, , -
200
6.
. NTSF
(File Permissions Directory Permissions)
. ,
- NTFS,
-
.
(Special Directory Access), (Special File
Access). ,
NTFS.
NTFS
NTFS
, .
,
, .
NTFS
.
, , .
, Properties
() Security ().
. () Permissions (
) / ,
DACL. () Audit ()
SACL. , () Owner
() / .
, /
NTFS .
:
CACLS [/] [/] [/] [/G :] [/R [...]] [/
: [...]] [/D [...]]
:
;
;
/ ;
/ ;
/G
, :
R ,
(),
F ;
/R (
/);
NTFS
201
/ ,
:
N ^,
R ,
(),
F ;
/D .
.
.
. ,
NTFS,
.
, ; .
Administrators (),
Administrators.
.
, ,
. , ACL,
, , DACL. DACL
(Access Control Entry ~ );
(SID)^
,
. ,
. ,
:
Everyone List;
Managers Change;
202
6.
NTFS
203
, NTFS,
. ,
,
Full Control Take Ownership.
,
No Access. ,
Take Ownership , , ^
NTFS.
Traverse Folder ( )
,
(
, Everyone
);
Execute File ( ) (
).
List Folder ( )
( );
Read Data ( ) (
).
Read Attributes ( ). ( )
, .
NTFS.
Read Extended Attributes ( ). (
) .
.
NTFS .
.
204
6.
Create Files ( ) (
);
Write Data ( )
( ).
Create Folders ( ) (
);
Append Data ( )
, , (
).
Write Attributes ( ). ( )
, .
NTFS.
Write Extended Attributes ( ). (
) .
.
Delete Subfolders and Fi4es ( ). (
) Delete.
Delete (). ( ) .
( )
Delete Subfolders and Files
.
Read Permissions ( ).
, Full Control, Read Write.
Change Permissions ( ).
, Full Control, Read Write.
Take Ownership ( ).
.
,
.
.
NTFS4.
NTFS4 NTFS5 , 6
5 .
.
(allow) (deny).
, ,
. ,
: ( ), , . ,
NTFS
205
, DACL. ,
DACL , ,
, ,
, .
, . ,
, ,
,
.
,
.
Advanced ().
, .
Add (), Change () Delete (),
, .
, ,
.
.
,
.
( ) (
) .
Inherit from parent the permission entries that apply to child objects.
Include these with entries explicity defined here (
).
:
( ),
.
: ,
,
.
.
. , , ,
. ,
, ,
.
,
.
,
,
, Full Contorol (-
206
6.
207
1. ?
?
?
2. FAT.
FAT? , ?
3. FAT16 FAT32.
?
4. HPFS.
HPFS ?
5. ? ?
6. NTFS.
NTFS.
7. ,
NTFS.
208
6.
8. ,
?
NTFS4.
9.
NTFS5. , Windows 2000/
.
1. Windows NT
Windows 2000/, ,
NTFS. .
2. (
) , ,
, , .
3. Examen, Students
,
, , .
7.
^
, .
.
, .
, ,
,
.
.
,
,
.
,
. ,
, ,
.
,
()
.
210
7.
,
. ,
,
-, ,
.
, , , ,
,
,
(
).
,
, -
. (independed processes)
(cooperating processes).
,
. ,
,
.
, .
,
.
()
, .
,
. ,
, ,
,
.
,
. ,
, .
,
,
. ,
, , ,
.
,
, .
, -
211
. , ,
,
. ,
. ,
, .
, ,
.
,
. ,
, .
,
. , .
.
1 2 X.
, , (, )
X, Ri\
(. 7.1). ,
, X.
.
7 . 1 .
1
R1:=X
R1:=R1 + 1
R2 := R2 + 1
X:=R2
X:=R1
2
R2:=X
,
. ,
1, 2 (. 7.1) , ,
4-6, 1-3, X
, X + 2.
1: (1) R1 :=; (2) R1 :=R1+1; (3) X:=R1;
2:
. 7.1.
Ri i.
212
7.
1 3
4-6 (. 7.2), X
(X + 2), (X +1).
1: (1) R1 :=;
2:
(4)R2:=X;
(2) R1 :=R1+1;
(3) X:=R1;
(5)R2:=R2+1;
(6)X:=R2;
'
. 7.2.
, . , 1 2
X
,
. ,
, , .
,
.
( MS DOS)
TIME, (, Ctrl+T)
18:20:59, ,
, , , 18,20 59
, ( ,
, , ). TIME
59 ,
: 18:21:00.
TIME, ,
, : (21), (18).
: 18:21:59.
.
59 + 1 = 60 00
Ctrl+T,
, , , 18:20:00.
.
, ,
- [17].
,
.
. ,
. ,
, ,
.
213
, ,
, , , ,
.
,
,
.
, ,
,
,
.
- (produces-consumer), ,
, -.
,
, ,
, ,
. ,
, .
, ,
() , . ,
, ,
, ,
, . ,
, , (pool)^ ,
. ,
, .
, .
, .
, , ,
. , , ,
. ,
.
, . ,
, . ,
,
, ,
.
,
. ,
.
214
7.
. ,
(
). ,
, (Critical Section, CS).
,
. ,
, ,
, , ,
. ,
,
.
- ,
, , ,
. ,
() . ,
,
. ,
, ,
(
).
.
[17, 54].
.
.
. :
,
( ),
, ( ,
, ,
);
,
, ,
.
, ,
,
,
.
215
:
; ;
.
.
: ,
,
, , ,
.
,
, .
,
,
, [10]. ,
,
.
, , ,
.
(
) ,
.
( ) ,
. ,
. ,
,
,
( ,
).
, . ,
,
.
, , .
216
7.
,
.
, :
, ()
.
,
,
. . 7.3.
^
'1
:#-
CS1
CS2
(
1)
(
2)
PR1
PR2
(
1)
(
2)
. 7.3.
, , 1 2
.
, .
, , 7.1.
7.1.
Var : integer;
Begin := 1: { =1 1}
Parbegin
217
While true do
Begin
while = 2 da begin end:
CSl; { 1 }
:= 2:
PRl: { 1 }
End
And
While true do
Begin
while = 1 do begin end;
CS2; { 2 }
:= 1;
PR2; { 2 }
End
rend
End.
:
parbegin...Sll; S12: ... ; S1N1
and... S21; S22; ... ; S2N2
and... SKI: SK2: ... : SKNlk
parend
, begin end .
, , 7.1,
.
PR1 , PR2, 1
PR1, 2
, 2
CS2, 1 CS1.
,
.
,
, ,
. 1
2 , true,
, false .
,
. true,
. -
218
7.
.
7.2.
7.2.
Var 1.2.: boolean;
begin nepeMl:=false;
nepeM2:=false;
parbegin
while true do
begin
while 2 do
begin
end;
1;;
CSl { 1 }
epel:=false;
PRl { 1 }
end
and
while true do
begin
while ! do
begin
end;
2:=1;
CS2 { 2 }
epe2:=false;
PR2 { 2 }
end
parend
end.
, ,
.
, , . ,
, 2 1
!
2 2 true,
! true. ,
.
() ( 7.3)
, 1 2
! true (
2).
7.3.
!. 2 : boolean:
begin 1:=fIse; 2:=15;
parbegin
1: while true do
begin
!:=true:
219
while 2 do
begin end;
CSl { 1 }
1:=1$;
PR1 { 1 }
end
and
2: while true do
begin
2::
while ! do
begin end;
CS2 { 2 }
epe2:=false;
PR2 { 2 }
end
parend
end.
, 7.3, .
, ,
true .
.
, , ,
,
.
,
, , .
,
; , ,
.
( 7.4):
!, 2 . - !
true , 1 (
2 ), ,
,
.
7.4.
label 1. 2:
van !. 2: boolean;
: integer;
Begin !:=false; 2:=1$;
:=!;
parbegin
while true do
begin !:=true;
220
7.
7.4 ()
1: i f 2=1 then
1f 0=1 then go to 1
else begin epel:=fa1se;
while 0=2 do
begin
end
end
else begin
CSl { 1 }
:=2; epel:=false
end
end
and
while true do
begin 2:=1:
2: i f 1 then
i f 0=2 then go to 2
else begin epe2:=false:
while 0=1 do
begin
end
end
else begin
CS2 { 2 }
:=1: epe2:=false
end
end
parend
end.
2 = true ! = false,
2 . 2 = false ! = true.
, 2 =
= true ! = true, ,
,
.
! 2
. ! 2 ,
; ,
,
,
.
- , ,
N .
, ,
, -
221
.
. , IBM 360 (370)
TS (Test and Set ). TS
(). ,
,
^ . TS
,
.
TS ,
common, ,
.
, -
. ,
, , ,
. TS
common common .
^
7.5.
7.5.
var common, local 1. local2 : integer;
begin
common:=0;
parbegin
1: while true do
begin
locall:=l;
whil e local 1=1 do TS(loca11,common)
CSl; { 111
common:=0;
PRl; { 1 }
end
and
2: while true do
begi n
loca 12:=1;
whil loca12=1 do TS(loca12.common)
CS2; { 112
common:=0;
PR2; { 2 }
end
parend
end.
, 1.
^ locall ,
TS(locall,common) . common
. 1 .
common ,
, 2
.
222
7.
, , ,
common := .
.
.
: common,
. ,
, 1
, 2, ,
. ,
1 , 2
.
ia32,
, ,
, BTS, BTR,
. BTS.
BTS (Bit Test and Reset )
[20].
, , CF (Carry Flag
)^ , 1.
BTS .
8- .
32, ,
31. .
.
^ ,
( 7.6).
7.6.
L:
JC L
:
AND .
,
31,
.
223
. 3
5 (3 16- , 5 32- ),
( ),
,
.
[20].
( 32- ), ^
:
Effective Address + (4 (BitOffset DIV 32))
( 16- ) ,
:
Effective Address + (2 (BitOffset DIV 16))
, .
,
. ,
-. MOV
BTS
.
, ,
,
, . ,
, ,
, -
-, .
,
, , '
,
.
, .
.
, ,
, , ,
.
().
,
.
,
. ,
, ,
.
,
, -
224
7.
,
.
.
. ,
, . ,
, ,
, , ,
. , , ,
, , ,
. ,
,
. ,
, ,
. ,
.
[10]. (sema
phore) ,
,
V\ ,
.
, V
.
,
, ,
.
.
.
. ,
,
.
.
,
.
[41]. ,
,
Proberen (), V Verhogen ().
225
, , ,
.
P(S)
S. ,
.
.
, ,
.
, - .
V(S)
.
, V
,
.
( 7.7).
.
,
. , . ,
, N-.
, ,
, ,
.
7.7.
PCS):
S:=S-1:
if S<0 then { S }:
V(s): if S<0 then { S
};
S:=S+1:
,
, .
InitSem; ,
,
InitSem ( _. __ );
1 2
. , ,
7.8.
7.8.
van S:semafor:
begin InltSem(S.l);
(. ).
226
7.
7.8 ()
parbegin
1: while true
begin
P(S);
CSl :
{
V(S)
end
and
2: while true
begin
P(S):
CS2 :
{
V(S)
end
parend
end.
do
1 }
do
2 }
S , 1. 1 2
P(S),
. , 2,
S, . 1
S.
.
V(S) 2 S ,
-
. 1
.
,
V:
( )
, ;
,
, , .
. 2
P(S). S .
1 P(S). 1
S, S ,
- 1 . 2
V(S), S ,
1 .
1 , ,
.
P(S), , S=0. 1 ,
- 1 . 2
P(S), . ,
227
, 1 2
.
. ,
2 V(S).
V(S) , S=0. 1
.
.
, .
1 V(S).
1 2 P(S), S
.
. V(S) 1
2 .
,
, ,
, .
:
P(S):
else WAIT(S){ S }
V(S): if S<0 then RELEASE(S){ S
};
S-S+1.
WAn(S) ,
, S. RELEASE(S)
, S, .
, ,
,
. , 2
P(S). S .
1 P(S). 1
S, S=0, S .
2 V(S),
S , 1
. 1
, P(S) .
V
. S
( 7.9.).
S, ,
S.
7.9. V
type Semaphore = record
:integer;
:pointer;
#
228
7.
7.9 ()
end:
var S :Semaphore;
procedure P ( var S : Semaphore);
begi n _;
S.C4eT4MK:= S.C4eT4MK-l;
i f S. < 0 then
WAIT(S); { S.
}
_
end;
procedure V ( var S : Semaphore);
begin ;
S.C4eT4HK:= S.C4eT4HK+l;
i f S. <= 0 then
RELEASE ( S ) ;
{ S. }
_
end;
procedure InitSem (var S : Semaphore);
begin
S.C4eT4HK:=l;
S.yaaeb:=nil;
end;
,
. S }^ ,
,
. ,
.
,
.
(TS).
( 7.10).
7,10. V
type Semaphore = record
; integer;
: pointer;
; boolean;
end;
var S : Semaphore;
procedure InitSem (var S : Semaphore);
begin
With S do
begin
:=1;
;=nil;
:=true;
end;
end;
229
, 5(,5.) , .
, (
) .
(mutex). mutex
mutual exclusion semaphore,
.
,
( )
. ,
(
). - ,
, ,
. ,
.
( )
,
.
( ),
, ,
,
. (CreateMutex),
, , , -
230
7.
. true, ,
, , .
false
,
.
.
(CreateMutex), (OpenMutex), (WaitForSingleObject WaitForMultipleObjects) , ,
(ReleaseMutex).
.
.
,
.
.
-
-
.
.
,
,
.
7.11.
7 . 1 1 . -
var 5_.$_,5_ : semaphore;
begin
In1tSem(S_CBo6oflHO.N);
1115(5_.);
In115(5_ ) :
parbegin
: while true do
begin
{ }
(5_);
($_):
{ }
\/($_):
\/($_);
end
and
231
: while true do
begin
(5_);
(5_):
{ }
V(S_CBo6oflHO);
\/(5_);
{ }
end
parend
end.
$_, 5_ ,
5_ . 5_
, N, N ,
. ,
N; , .
5_ ,
, .
5_ 5_
.
, S_CBO (5_),
$_
\/($_). ,
5_
(5_), 5_
\/(5_). 5_, 5_
.
,
, 5_
(5_).
, $_
($_).
.
.
,
.
, 1 2. ,
1 2 , 1
, 2
. , ,
7.12.
232
7.
7.12.
var S : Semaphore:
begin
InitSemCS.O):
1: begin
: { 1 }
ON ( 2 ): { 2 }
P(S):
12: { 1 }
STOP
end:
2:
begin
2: { 2 }
V(S):
STOP
end
end
S . 1
, 2,
P(S) ,
. 2, ,
V(S) , 1
.
-
,
, -.
.
, - .
( , ).
,
, ).
, , ,
.
. .
. , ,
. ,
, .
,
.
-
.
. -
233
, .
, .
, ,
7.13.
.
7.13. -
var
R. W : semaphore;
N_R : integer;
procedure ;
begin
P(R);
Inc(NR);
{ NR:=NR +1 }
i f NR = 1 then P(W);
VCR);
Read_Data; { }
P(R);
Dec(NR);
if N_R = 0 then V(W);
VCR)
end;
procedure ;
begin
PCW);
Write_Data; { }
VCW)
end
begin
NR;=0;
InitSemCS.l); InitSemCW.l);
parbegin
while true do
and
while true do
and
while true do
and
while true do
and
while true do
and
while true do
parend
end.
R W,
NR, ,
. -
234
7.
W. R
.
,
P(W) .
, NR ,
, W,
. ,
, , V(W)
W. R
NR, P(W) V(W).
, W
, R.
W.
V(W), ,
.
,
, .
,
, ,
. .
7.14.
7 . 1 4 . -
var
S. W. R : semaphore;
NR : integer;
procedure ;
begin
PCS); P(R);
Inc(NR);
i f NR = 1 then P(W);
V(S); VCR);
Reacl_Data; { }
PCR);
DecCNR);
i f NR = 0 then VCW);
VCR)
end;
procedure ;
begin
PCS); PCW);
Write_Data; { }
VCS); VCW)
end;
begin
NR;=0;
InitSemCS.l); InitSemCW.l); InitSemCR.l);
parbegin
235
while true do
and
while true do
and
while true do
and
while true do
and
while true do
and
while true do
parend
end.
, S ,
. ,
S .
,
,
. ,
,
. ,
.
, -,
, , ,
,
.
, .
, , ,
^ . ,
. , 7.15
-,
.
, ,
( ,
), , , .
7.15.
Var VI. V2 : integer:
Procedure ;
Begin
Inc(Vl);
Write_Data;
V2:=V1
End;
236
7.
7.15 ()
Procedure ;
Var V: i n t e g e r
Begin
Repeat
V:= V2;
Read_Data
U n t i l VI = V
End;
Begin
VI ;= 0;
V2 := 0;
Parbegin
while true do
and
while true do
and
while true do
and
while true do
parend
end.
,
VI V2.
1 VI, V2.
V2 , VI .
VI V2 , , .
, .
,
, ,
,
.
. ,
, V := V2
:
Repeat V ;= V2 Until VI = V
,
.
, ,
(, ,
), .
, -
237
, , .
,
.
,
,
,
.
, [52].
0
,
,
.
, , ,
- [17]. ,
- , -
. ,
, .
,
.
. -
.
, ,
, ,
. ,
, ,
, .
- (,
) .
,
. , ,
, ,
.
.
, .
,
,
.
(
), (
).
; , , ,
, .
238
7.
.
,
.
,
, WAIT
. , ,
,
. , ,
, .
, , ,
.
, ,
, .
, ,
. ()
SIGNAL,
. (
) ,
, , ,
, , . ,
, ,
,
.
, , ,
, ,
, , .
,
.
,
.
.
( 7.16).
7.16.
monitor Resourse;
condition free; { - }
var busy : boolean; { }
procedure REQUEST; { }
begin
i f busy then WAIT ( free );
busy:=true;
TakeOff; { }
end;
procedure RELEASE:
begin
TakeOn; {
busy:=false:
SIGNAL ( free )
end;
239
begin
busy:=false:
end
,
REQUEST () RELEASE ().
REQUEST , ,
busy () true, REQUEST
WAIT(free). REQUEST,
, ,
, free ().
, , RELEASE,
SIGNAL , ,
.
REQUEST
WAIT(free), . SIGNAL(free)
, , free,
.
. ,
, , ,
.
(
,
).
, ;
.
,
. -, .
,
. ,
-
. -,
. -, -
240
7.
, .
, ,
,
. ,
.
,
, .
.
. , ,
. ,
1 2, 1
, ,
. 2
- , 1 ,
2 .
2 ,
( ). , 2
.
,
. ,
,
.
,
, , ^ , .
, ,
, ,
. ,
-,
.
, -
, -.
.
241
, ,
. ,
, (),
.
.
[17].
. 1 ,
. , 1 ,
. 2
, .
, , .
.
, ,
.
, .
, ,
, ,
, . - ,
,
. ,
.
,
.
,
,
.
, V - ,
( ),
, , .
SEND_MESSAGE ( . , )
,
. ,
SEND_MESSAGE, .
WAIT_MESSAGE ( . . )
, , ,
- .
, ,
. ,
.
242
7.
SEND_ANSWER ( . . )
, ,
, (
), .
, .
WAIT_ANSWER ( . . )
, , ,
; .
, ,
, ,
. ,
, ,
( ) .
:
,
^ ;
;
,
, ;
- ,
.
, . .
)" :
.
, ,
.
Microsoft
(mailslots). ,
. ,
,
. . (first-class delivery)
;
. (second-class delivery) ,
.
(pipe), , , ,
, ,
243
. -
UNIX, , , ,
, ,
, .
, ,
, UNIX-. , ,
, ,
. ,
( ) .
- .
, ,
FIFO, .
;
.
\ 64
. ,
, .
:
( head), ( tail).
.
,
, 1 ( ).
,
.
( ) (
)
. () ()
, ,
.
( ,
).
, ,
,
. . 7.4.
.
,
. .
,
. ,
, .
, UNIX-, 64 ,
16- -, ,
.
244
7.
'....:i^i/.jk'i-.*.>,f.'i
. 7.4.
, API OS/2.
:
DosCreatePipe (&ReaclHandle. &Wr1teHanclle. PipeSize);
ReadHandle , Wn'teHandle
, PipeSize .
:
DosRead (&ReadHandle, (PVOID)&Inforni. sizeof(Inform). &BytesRead);
ReadHandle , Inform
, sizeof(Inform) Inform, BytesRead
.
,
.
:
DosWrite (&WriteHandle. (PVOID)&Inform. sizeofCInform). SBytesWrite);
WriteHandle , BytesWrite
.
,
.
. , -
.
(queues)
,
.
-.
- , -
245
- .
, .
, .
. -,
:
FIFO , , ;
LIFO , , ;
;
.
FIFO.
-, ,
,
.
-, ,
.
, ,
.
, ,
API,
,
, , .
- :
(Process Identifier, PID), ;
;
, ;
;
, .
, ,
( ,
):
CreateQueue ;
OpenQueue ;
ReadQueue ;
PeekQueue ;
WriteQueue ;
CloseQueue ;
PurgeQueue ;
QueryQueue .
246
7.
1.
? ,
?
2. ,
.
3. , .
BTS BTR, ia32.
4. .
V?
5. ,
?
6. ?
7. -
.
8. -
.
9. ? .
10. ?
. ( )?
12. ?
?
8.
,
,
.
,
.
.
,
,
, .
, , .
-
, .
, (dead lock^), . ,
,
, . -
,
.
Dead lock (.) .
248
8.
:
(Reusable Resource, RR), (System Re
source, SR), )
, , (Consumable Resource, CR).
(SR)
, [54]:
;
,
( ,
, ,
);
( ),
,
, .
, ,
, () ,
, , ,
, ,
.
(CR) SR
[17].
CR ,
()
(). )
,
,
, .
,
() . ,
, ,
().
, , ,
,
CR . :
-; ; ,
,
.
, ,
.
[54].
() ,
249
.
^ .
.
() . ,
,
. , ,
. SR
, ,
,
. .
SR
. 8.1.
2
R2
. 8.1.
1 R1
R2. 2 R1,
R2. , 1 ^ R2.
, )^
, ,
1 : 1 ,
2 R1, 2
, 1 R2.
,
.
250
8.
CR
1, 2 ,
Ml, 2 .
CR. 1 , 2
Ml, 2 2.
, ,
, (. 8.2)
().
. 8.2.
, 8.1, .
^
( 8.2).
8 . 1 .
1:
251
8.2.
1:
(. . 1):
(2. Ml. 2);
2:
...
(1. Ml. 2):
(. 2. ):
...
(2. 2. );
(1. . 1):
,
, , ,
.
CR SR
1 2
R, 1
, 2
. R.
REQUEST(R, N) N R, RELEASE(R, N)
() N R.
MB. 1 2 8.3.
8.3. CR SR
1:
REQUEST ( R. 3 ) ;
SEND_MESSAGE ( 2. . MB ):
WAIT ANSWER ( . MB );
RELEASE ( R. 3 );
2:
WAIT_MESSAGE ( 1 . . MB ) :
REQUEST ( R. 2 ) ;
;
RELEASE ( R. 2 ) ;
252
8.
8.3 {)
SEND_ANSWER ( . MB );
, . ,
2, ,
1, R,
1. 1, R,
2, ,
2 R, 1.
, 2 1
R, . ,
, .
SR
, 1 2,
SR: R1 R2.
S1 S2 . 1 2
, . 8.3 [17].
1
1:
P(S2);
(5):
P(S1):
2:
P(S1);
(6):
P(S2);
3:
V(S1):
(7):
V(S1):
4:
V(S2):
(8):
V(S2);
. 8.3. ,
( ) .
, .
. 8.4.
1,
2. , 1 4,
1-4 1; , 5 8,
5-8 2.
. ,
, 1 , 1,
2 6, 7. -
253
, 1,
, 2.
2
I
r-f-
/V
'^0
5h
_ 1
1
. 8.4.
, R1 R2
, . 1-8
25 ,
.
-
1 2 R1 R2.
1-2-5-3-6-4-7-8,
1. 2 R1 ( 5),
( , ). 2
. 1 3, 2
R1. 2
R2 ( 6). 1
4, 2 R2.
, , 1-5-2-6, 1 X 2, 2
Y 6. 1 , 2
7, 2 , 1 4.
, 1, 2 .
, ,
254
8.
,
. : ,
D, .
,
[17,
54]:
,
;
, , , ,
. ,
;
,
, ;
,
, , .
, ,
Y (. . 8.4).
.
, .
,
,
.
,
,
.
35 ,
, 1962 1
[36].
, , .
, ,
, . -
255
,
.
( ),
( ),
, . ,
, ,
: . ,
, . , .
,
. :
- ;
- ( ) ,
, ;
.
-
( , )
/'= <5, >. 5
, 5=(, [/)> V , U . ^
, .
.
5 ,
:
5 = < , , F>.
, = {pj, i = 1, ;
, = {^^}, = t ^ ; U - = V, - = 0 ,
5; ,
S:
Ye(PT)[j(T'P).
5 ,
tj, j = \,, ^ G ,
: ( ) -^ {0,1, 2,...}
:( )-> {0,1,2,...},
[36] (
).
{Pi}ePy tj {(Pitj)i},
1 < \{(Pijtj)i : iyj = const}| < W, {^^} G ,
tj G _ {(tj,Pk)i}, 1 < \{(tj,Pk)i'-jyk = const}| < W.
W5; P , P
; (.,t^)^ v- , , -
256
8.
tp (tjyPf^X v- , tj ;^.
, S /^ :
S-<P,ZB,E>,
: P=^I\JO;ir\O^0.
/
:
I=
\Jl(tj);0=[jO(tj).
I(tj) = {, : B(p,aj) > 1, i = 1^}, j = un; 0(tj) = {p^ : E(tj,p,,) > 1,fe= }, j = t m ;
(Pi ,tj) w<W, , tp
i^jyPk) ~ w<W, tj ^,
/(^^) 0(tj) ^^
.
(
, ),
().
MQ ( ,
)
(),
, W = ||, - (1 < < )
m(Pi)y () {.
=((),(21"-.()^
=
(m(p,Xm(p^),...,m(pJ).
(.), (-) Z ;Z . (
)
,
. - = -_^ - I(t)
,
.
.
. , ,
, ,
. ,
, ,
, . tj ,
257
:
Vp,. : (,) = (,) -#(,, )) + #{Pv ))
, , tj
, ,
, ,
.
(
)
(), (. ). -
- (
- ),
, .
, ,
, , ,
.
,
(),
( > 0).
, tj ,
\ ,
, \ tj
. , ;
,
. ,
, , (
) (
).
.
, ,
( ).
, ,
. , ,
, .
258
8.
, , ,
.
. 8.5.
;5
'^Pia
. 8.5.
,
1 2
R (. 8.3).
, . 8.5, (1, , , , , 4, , , 1, , , , 0).
2 , 1 R.
, PQ (
R), 3, t^
1 . ^2
1 2; t^
. pj , 2
1. t^
, 1.
,
^3, tiy tQ, t-j ^8 , 1 SR
(. . 8.3), , . 8.6.
259
. 8.6. SR
,
1 2, Pi ~ S1 S2,
V. . 8.6
, ,
.
.
,
.
, ,
^
[21]. () ,
, ,
, .
( [54]).
, ,
, .
, , .
260
8.
( - ).
, ,
(,
).
, .
,
( !),
. ,
.
.
<, 7i>,
{ Sj, 83, S3,..., S^ };
{ ^, , ,..., }
Pj ,
. :
Pj! -> { }.
Pj S, Pj
Pi(S). Sk Pi(Se), , Pj S^
Sk , Sg -> Sj,.
, S^ -> S^ , Se = S^, Sg -> S^
i, Se -> Sk i Sk, Sk -> S^.
, >
> Sg S^.
, ,
, ,
, . .
Pj Sg,
Sk, Se -> Sk, Pi(Se) = 0.
, , Pj Sg,
Sg ,
( ) , Pj
. .
Pj Sg, Sj,,
Se -> Sk, Pj Sk . <, >:
= { Sj, S2, S3, S4};
= { PJ, 2};
Pj(S3) = {S,);
P^S,) = {S3};
P3(S3) = 0;
P3(S,) = 0.
261
:
S, ^ - ^ 8; S, - ^ - > S,; S, - ^ - ^ S,.
Si -> S4 , ,
: Si ^> S2; S2 -> S^ Si ^> S^; S3 -> S4.
, Sg,
S4; S2 -> S4 S2
> Si, Pi
S4, Sj.
. 8.7.
S , Pj,
S.
, , ,
,
.
.
Si , S^, Sj -> Sj,, Sj,
.
<, >.
. 8.8. S2 S3 ;
. Si S4
, S5. SQ Sy
.
, <, >
SR,
. 8.3. Pi 2,
Ri R2 (. 8.1).
Sy , Pj Sj,
2 Sj.
262
8.
. 8.9.
Pi,
. : S22, S23
52. , S33.
. 8 . 9 .
263
8 . 1 . ^ Ri
Pi
Rg,
R,,
Rg
Ri
Ri, Rg
Rg, Ri
Ri Rg
Ri Rg
Rg
Ri
Rg
Ri
, , ,
.
.
,
. , ,
, . ,
.
,
, , ,
.
.
, .
:
;
;
.
, ,
.
,
.
. , ,
, ,
, .
264
8.
.
,
.
, .
,
. , ;
.
. ,
,
.
,
.
.
,
- .
,
.
. . ,
,
. ,
.
, ,
. 1 2,
R1 R2, R2
. 1 R1,
2 R2,
R1, 1. ,
.
, ,
, .
.
, .
.
,
, . [54],
, ,
, , -
265
. , ,
. , ,
, . ,
, .
.
, R SR;
,
. . 8.2
R,
R.
8.2.
, )
, pecyffc
.
,
R, ^
,
. ,
^ .
,
R. ,
R, , .
(
), R, ,
,
. ,
R .
, , .
, ,
, .
, .
, , , ,
, -
. , >^
.
266
8.
, .
.
[53].
, .
(
) .
, ,
.
N ,
R (
Max(i)). ,
. , i-ro .
i-ro (1).
i-ro R (1). ,
, false (1).
, _
R, _. 8.4.
8.4.
Begin
_ := _:
For 1 := 1 to N do
Begin
_ := 6_ - oy(i);
OcTaTOK(i) := Max(i) - ):
aep(i) := false; { }
End;
flag ;= true;
{ }
while flag do
begin
flag := false;
for i := 1 to N do
begin
i f ( not ( ) )) and ( OcTaTOK(i) <= _ )
then begin
aep(i) ;= true;
_ ;= _ + oy(i);
Flag := true
End
End
End;
I f _ = _
then
,
else
.
end.
, -
, , , -
267
, .
, ,
. ,
, .
,
. . ,
; ,
, .
,
.
, .
[
,
. , ,
. ,
.
, ^
,
.
.
. .
,
. ,
.
,
. .
, , ,
.
, [ ,
,
.
, .
, , , , ,
.
,
, - ,
. ,
,
.
268
8.
, (
)
.
, , , ,
. ,
, -
. (
)
S ,
S. S .
Pj
()
(.
).
.
Pj, ,
, ,
, Pj Pj.
^ ,
, . Pj .
( ),
.
SR .: ,
, .
: SR
;
.
, . S,
S^
seqi
seq2 , Sj ;^ S2 ( Sj Sj
, ).
, ,
, Si = S2. , ,
seqi (Pj, 2, ...,
). seqi ,
seq2. Si = ,
, S,
seqi seq2 ( -
269
), .
, - (1=1,2,..., )
.
PI, S
Pi, , , Pi.
Pj, (i = 1, 2, ..., j). Pj,
(i = 1,2,..., j) Pj+i,
seq2
.
Pj. , Pj+i.
, ?t ^ 1 = 1,2,..., ,
, Si ^^ S2. , Si = %.
: S ,
S
.
, S ,
Pi S. Sj, S *> Sj
Pj Sj ( ).
,
Pj
. , .
, S .
Pj,
(. ).
, ,
, SR, -
, , Pj
, , .
: Pj ,
, Pj .
: S ( SR),
S.
.
; ,
, .
. ,
,
, .
. -
270
8.
(
, ).
. ,
.
D = ||dy||, djj Rj
, Pj, dy = |(Rj, Pi)|, (Rj, Pj)
Rj Pj, Rj Pj. N = |||,
eny = |(P,Rj)|.
. ,
Pj, Pi :
<
> (R,.dJ
>(Ry',d y^)
> ...
>(R, A).
Rj , , dj , dj = |(Rj, Pi)|.
, Pj, .
( - ):
R
> ( , )
> ( , )
> ...
> ( , ).
nj = |(Pj,Ri)|.
(fi, 2, ..., ), ^ (
) Rj, , = |Rj - Z|(Ri, )|
( ) , , ,
, .
,
^, 2,..., ,
, ^, P^.i,..., 2, Pi, ,
. :
n + ( n - l ) + ... + l = n ( n + l ) / 2 .
,
X ^, m .
. V,
Wi,
( ), -
. , ,
( ).
, , ,
X .
271
For all L do
Begin for all Rj |(Rj,P)| > 0 do
Begin r^ := r^ + |(Rj.P)|;
For all Pi 0 < |(Pi.Rj)| <= Pj do
Begin w^ := w, - 1:
If w, = 0 then L := L {Pi}
End
End
End
Deadlock := Not (L = {PI, P2 Pn});
L , Morjrr
. , L = {, | w, = 0}. L,
, fj Rj,
, w^ ^,
Rj, ^ L,
.
( )
. G = <, > I X ()
, ,
P(x) = { y | ( x , y ) I E } U { z | ( y , z ) I E & y I P ( x ) } .
, ,
(), , .
I X: I (), G
.
:
.
( ^)
:
, ,
i j , i j
.
: S S ^> Sj, S^
, ^, Pj
Pj ST ,
, . ,
,
, ,
.
[54].
272
8.
Pj
Pj. Pj ,
.
, , ,
, ,
.
, , G = <, >
ZI X, V I Z, () = Z, Z
Z.
, .
. 8.10.
. 8.10.
, ,
. , . 8.11 .
(), ,
. ,
.
, ,
,
. ,
, ,
(
).
, , ,
.
: ( ,
, ),
.
eZ = {Z1.Z2.Z.Z4}
273
274
8.
, Z.
, Z,
Z . ,
Z Z.
, Z . , Z
.
, (
), |Rj = 1, (i = 1, 2, ..., m).
.
:
, .
.
, ,
, . -
, ,
, ,
. ,
. ,
,
; .
,
.
,
. ,
, IBM
. ,
: ()
RATBL PWTBL (
).
, [22].
1. . J
I.
2. I PWTBL J.
3. I RATBL,
, .
4. PWTBL.
5. , -
. , 6, 7.
275
6. J .
7. RATBL, '
.
8. , ' = J. , 9,
.
9. , PWTBL . ,
6, 10.
10. := ' 4.
. .
12. .
.
1. 1 R1.
2. 2 R3.
3. R2.
4. 2 R4.
5. 1 R5.
(RATBL) ,
. 8.3.
8.3.
R1
R2
R3
R4
R5
6. 1 R3,
J = 1,1 = 3, = 2. ,
1 R3.
7. , 2 R2: J = 3,1 = 2, = 3.
=3 , 2
R2.
8. , R5: J = 3, I = 5,
= 1, = 3, ' = 2, ' J, = 2, = 2, ' = 3.
' = J, .
(PWTBL) , . 8.4.
J = ' ,
,
.
276
8.
8.4.
R3
R2
R5
,
. 8.12. ,
. ,
: (8, 5, 6, 2, 7, 3), .
. 8.12.
.
. :
,
, ;
, ;
,
,
;
, , ,
, ;
, .
277
, . ,
, ,
- , ,
.
1. ?
.
2. SR?
, .
3. .
?
4. - .
5. ?
?
6. .
7.
? ?
8. ? .
?
9. ?
.
10.
.
11.
.
9.
(. 1),
,
.
,
.
1 .
, , ,
,
.
, .
. ,
,
.
, , ,
.
,
. , ,
,
,
.
,
.
279
: , ,
() , ,
.
.
,
.
.
,
.
( ).
, ,
.
(. 1),
,
().
.
,
,
, .
, .
.
. ^,
,
. UNIX.
,
.
,
,
, , , .
280
9.
.
. , ,
, . , ,
,
, ,
, . 1
, ().
, .
.
.
. .
,
,
, .
.
-.
,
-,
. . -,
,
,
.
, .
, -
( ) ,
. -,
,
. , , ,
- .
- (. 5): -
. ,
, , : (
) .
, .
, -
281
,
.
(),
.
-,
( )
(
) .
.
,
,
.
,
().
^ .
,
, ,
.
(Application
Program Interface, API).
,
, .
.
, .
,
,
.
(
)
.
,
. ,
, ,
. .
, .
. , ,
,
, .
282
9.
,
,
, ,
.
,
.
.
, ,
,
,
. ,
.
()
.
.
(),
.
, ,
.
(),
,
, . ,
,
.
,
.
, .
. ,
, ,
, -
, .
,
,
. ,
, 1.
283
, .
VDM- (Virtual DOS Ma
chine) , MS DOS
DOS-p0e. ,
DOS-,
VDM-. VDM- Win
dows^ Microsoft, OS/2, Linux.
,
. ,
, ^
.
, , .
. , ,
, ,
. ,
( ),
- ,
.
.
UNIX.
.
, Windows , (
) . Windows NT/2000/XP
HAL (Hardware Abstraction Layer
) HEL (Hardware Emulation Layer
), (
) .
, ,
.
, .
,
. ,
.
Microsoft, Windows
, VDM-. , Windows ME.
284
9.
, ^
. ,
. . C++
, -
,
.
-.
. ,
.
,
-,
ia32. . ,
, ,
-, (
) .
C/C++
. ,
, ,
, ,
. , , ,
. ()
.
UNIX.
.
, POSIX
(Portable Operating System Interface for Computer Environments
).
, UNIX
, .
API POSIX. ,
, ,
- ,
.
,
.
,
, ,
. , IBM
OS/2, -
285
ia32, PowerPC.
,
, .
OS/2-Windows NT. , Windows
NT
ia32, MIPS, Alpha (DEC), PowerPC.
,
Windows NT (Windows 2000/)
ia32 MIPS, Alpha PowerPC.
,
, .
.
,
. :
,
, .
,
.
.
,
.
(, IBM
PC Apple),
, .
, PowerPC ,
i80x86. 80x86
, . PowerPC
, 80x86,
, , ,
, ,
PowerPC. PowerPC ,
- , 80x86,
.
,
PowerPC, ,
, 80x86.
, .
, , , -
286
9.
, ,
,
.
POSIX.
UNIX,
.
(
, )
,
.
()
.
,
.
.
-
,
.
.
.
.
.
Linux. UNIX-
-
, () ,
. Linux
,
, , ,
, .
,
,
,
.
, , ,
, . ,
-
287
. ,
, - ,
. ,
. , ,
Windows 98 Windows NT/2000/XP,
.
.
, , ,
() ,
, .
,
, .
(, )
, ,
. . , ,
, ,
.
-
.
.
,
.
.
UNIX- , , Linux.
.
,
( ).
.
.
, () (
. 1).
. , ,
288
9.
, (
)
.
, .
,
.
, .
,
, .
, 2 ,
. , 1983 .
(National Computer Security
Center), .
,
,
, , ,
, .
, ,
D, .
D ,
.
, ,
, ,
. () : 1
,
. 2 :
,
,
;
, ,
,
(
);
(auditing)
, ,
, ;
,
.
,
, .
289
, .
,
.
.
,
.
(, )
, ,
2. , ,
. ,
2 . ,
,
.
90 % , , ,
. ,
,
. ,
Solaris ( UNIX) ,
.
, .
,
, .
() ,
.
,
, ().
90- XX ,
.
, .
, ,
.
, ,
, . ,
,
;
, ,
290
9.
;
, ,
; (, UNIX)
.
, ,
,
.
. ,
, .
. ,
-.
.
,
.
, .
,
, .
, ( )
, -,
.
Mach.
,
.
, .
,
.
:
;
;
(Inter-Process Communication, IPC);
- ;
(host)^ .
. , IP-.
291
,
, ,
. .
,
; ,
:
. , ,
.
,
, ,
.
,
, .
, -
.
, , ,
, .
. ,
.
,
. ,
.
,
,
. ,
,
. ,
.
QNX. QNX
, ,
( QNX
. 10).
,
, Intel 486. ,
8 46 .
292
9.
QNX,
,
. / QNX
,
. ,
.
, ,
,
( ) .
, .
.
,
[29,30]. ,
,
.
.
, -.
, ,
, . ,
,
, , .
, .
, ,
.
. -
, .
,
, ,
, , , .
-.
,
,
. -,
, -, .
,
,
.
293
.
, -
, .
Windows NT, -,
.
, .
-
, -.
NT (New Technology)
,
- () . ,
QNX Windows NT/2000/
.
, ()
. .
.
.
.
.
,
. ,
, /
.
- ,
, ,
, ,
, , ,
, ,
.
,
.
,
, ,
.
. ,
294
9.
,
.
.
( ),
, ,
.
.
. ,
. , ,
Ethernet TCP/IP.
, Ethernet
, ,
, IBM Token Ring ARC Net,
.
, .
1.
{ multi-threaded),
. ,
. , , ,
. , , Windows 3.11
Pentium IV 3000
,
.
(). ;
, .
( )
.
2. ().
, , .
,
(DeadLine DrivenOS).
, ,
.
, , ,
.
: .
295
.
, .
; ,
,
. ,
, .
3. .
,
,
. ,
. , , UNIX .
UNIX , ( ),
(pipes) .
, .
.
, .
,
, ,
,
. ,
,
. ,
.
,
, ,
. ,
, (,
, ).
,
. .
, . ,
,
. ^ .
4. ,
. (
) ,
. -
296
9.
,
. ,
. ,
.
5.
.
.
:
,
:
(
);
(
);
.
,
.
(API),
.
,
:
, ;
;
( ,
, , , );
(Remote Procedure Call, RPC).
:
;
;
(,
);
( ).
297
-:
(,
-
,
);
( ,
, ).
,
.
,
,
(, )
.
. , ,
MS DOS C0MMAND.COM.
,
, , ,
, API. ,
(Graphical User In
terface, GUI),
(track-ball) ^
-
, , /
. . ,
.
, GUI
- ,
GUI
API.
, . ,
-,
,
.
API
, .
API
.
, (NoteBook)
, .
, (touchpad).
,
.
298
9.
, , MS DOS,
( 180x86
), .
API int 21h.
,
API. ,
. ^ API,
(Run Time Library, RTL)\
,
.
, , ,
.
, API (Application
Program Interface )
:
API , RTL;
API ,
;
API.
, ,
. API ,
.
, API ,
.
,
.
, ,
, .
API ,
,
. API
RTL ,
. ,
.
299
.
API.
API
,
.
.
API ,
, ,
.
API:
;
;
.
API
. API
.
API :
API
,
;
;
.
API,
,
( ).
API
,
.
API
API.
,
.
, .
API
API
API. , -
300
9.
,
( ),
, .
,
.
.
API API.
API
,
. ,
,
, .
,
API, ,
.
,
.
, API
.
.
()
API, .
API ,
Microsoft
Windows WinAPI (Windows API). ,
API ,
Windows. API
MS DOS,
.
API
API
.
(RTL).
301
, .
, API
,
. , API
RTL
.
RTL
.
,
.
.
.
.
. ^ RTL.
RTL . RTL
.
,
. malloc, realloc free ( new delete C++),
new dispose.
,
. ,
.
,
.
.
, (, malloc
new )
.
.
,
.
API. , -
302
9.
.
,
. , ,
,
, ,
. API.
, malloc, realloc free
. , -
, .
. ,
, ,
.
API
API
,
.
,
.
(
).
API
,
, RTL .
RTL.
,
, .
. ,
- ,
.
, , POSIX (.
), .
,
.
XLib,
-Window.
.
- , -
303
.
MFC (Microsoft Foundation Classes) Microsoft
VCL (Visual Controls Library) Borland,
Windows.
-
,
.
,
, CLX Borland
Linux Windows.
API
API, .
. API
.
.
,
, .
,
, API.
, ,
API. :
,
. , ,
Basic,
. API
,
. ,
API. ,
256 :
unsigned char * ptr = mall (256):
.
malloc, RTL .
, , malloc
API:
LPVOID 11(
HANDLE hHeap. // handle to the private heap block -
DWORD dwFlags. // heap allocation control flags -
304
9.
DWORD dwBytes // number of bytes to allocate -
):
, .
, , API
:
unsigned char * ptr = (LPVOID) HeapAllocC GetProcessHeapO. 0. 256):
,
, , , ,
. , API
.
API
. API,
.
, API .
API , ,
. ,
,
.
, ,
POSIX. ,
. , POSIX,
API, ,
,
.
API
Microsoft, WinAPI.
: Win 16, Win32s, Win32, WinCE. WinAPI
( , ,
) . ,
WinAPI .
,
POSIX.
POSIX
POSIX (Portable Operating System Interface for Computer Environments
)
IEEE (Institute of Electrical and Electronics Engineers
), ,
, pstat, kill, dir .
305
POSIX
, ,
. , POSIX,
, ,
, .
UNIX-, .
POSIX IEEE
UNIX-
. POSIX UNIX; ,
, IEEE Standard 1003.11990 (POSIX. 1). , QNX
,
, UNIX- ,
.
(Virtual Memory
System, VMS), (Multiprocess Executing, MPE)
(CTOS). , POSIX
POSIX.l-POSIX.12. . 9.1
, .
, POSIX. 1
API .
9 . 1 . POSIX
ISO
POSIX.0
.
,
POSIX. 1
API ( )
P0SIX.2
( IEEE)
P0SIX.3
P0SIX.4
P0SIX.5
ADA
POSIX. 1
P0SIX.6
P0SIX.7
P0SIX.8
, ,
,
, RPC,
,
P0SIX.9
Fortran,
POSIX. 1
POSIX. 10
POSIX. 11
AEP
POSIX. 12
(GUI)
306
9.
, , ,
POSIX- .
.
,
. POSIX, .
POSIX .
. 9.1
POSIX .
POSIX
>\
1 f
POSIX. 1
>1
(110 )
1 t
. 9 . 1 . , POSIX
,
POSIX. 1 RTL ,
110 ,
POSIX. 1.
,
,
, ,
POSIX.
POSIX .
UNIX-
IEEE Standard 1003.1-1990, WinAPI POSIX. Windows NT
API POSIX,
.
, WinAPI. ,
WinAPI, POSIX
- stdin
stdout [57].
API
307
API
API
,
,
. : Windows (
WinAPI) Linux (POSIX API).
,
(),
()
.
.
,
.
.
, API
.
( 9.1) (
9.2) , ,
, API,
. ,
GUI,
.
9.1. Windows (WinAPI)
#inclucle <w1ndows.h>
,#include <stcl1o.h>
#include <stdl1b.h>'
// : processFile
// :
// : IpFileName -
// :
DWORD processF1le(LPV0ID IpFileName ) {
HANDLE handle; //
DWORD numRead. total = 0;
char buf;
// ( )
handle = CreateF1le( (LPCTSTR)IpFileName, GENERIC_READ,
FILE_SHARE__READ. NULL. OPENJXISTING. FILE_AnRIBUTE_NORMAL. NULL);
//
do {
308
9.
9.1 ()
II
ReadFileC handle. (LPVOID) &buf. 1. &numRead. NULL):
i f (buf == 0x20) total++;
} while ( numRead > 0):
fprintfC stderr, "(ThreadID: ^Lu). File %%. spaces = ^d\n".
GetCurrentThreadldO. IpFileName. t o t a l ) ;
/ /
CloseHandle( handle):
return(O):
}
// : main
// :
// :
// :
int mainCint argc, char *argv[]) {
int i:
DWORD pid:
HANDLE hThrd[255]:
/ /
/ / ,
for ( i = 0: i< (argc-1): i++) {
/ / -
hThrd[i] = CreateThreadC NULL. 0x4000.
(LPTHREAD_START_ROUTINE) processFile.
(LPVOID) a r g v [ i + l ] . 0. &pid):
fprintfC stdout. "processFile started (HND=^d)\n". hThrd[i]):
/ /
WaitForMultipleObjectsC argc-1. hThrd. true. INFINITE);
return(O);
}
,
. , ,
.
9.2. Linux (POSIX API)
finclude
#include
#include
#include
#include
<sys/types.h>
<sys/stat.h>
<wait.h>
<fcntl .h>
<stdio.h>
/ / : processFile
/ / : , -
/ / : fileName -
/ / : -
i n t processFi1( char *fileName) {
i n t handle. numRead. total = 0:
API
309
char buf;
// ( )
handle = ( fileName, 0_RDONLY);
//
do {
//
numRead = read( handle. &buf. 1);
if (buf == 0x20) total++:
} while (numRead > 0):
//
close( handle):
return( total);
// : main
// :
// :
// :
1nt maindnt argc. char *argv[]) {
1nt 1. pid. status;
// ,
for (1 = 1; 1< argc; 1++) {
//
pid = forkO;
if (p1d == 0) {
//
//
pr1ntf( "(PID: %6). File ^s. spaces = ^d\n".
getpidO. argv[ 1]. processFile( argv[ 1]));
//
exitO;
}
//
else
printf( "processFile started (p1d=^d)\n". pid);
//
if (pid != 0) while (wait(&status)>0);
return;
}
9.2 , ,
. , UNIX
, ^
,
.
, API.
, ,
, ,
, , .
310
9.
, . , ,
API -
,
,
.
1. ?
2.
.
3.
?
? ?
4. .
? , ,
?
5. ? ,
.
?
6. ,
.
7. ,
.
8. (API)?
9. API?
?
10. (RTL)?
11. POSIX? ,
, POSIX?
10.
, ,
, ,
,
IBM PC.
, ,
Windows Microsoft.
Windows 95/98/, Windows NT/2000, Windows /
2003 (. 11).
,
Microsoft, UNIX- Linux FreeBSD,
QNX OS/2.
Linux FreeBSD,
,
UNIX,
UNIX-. QNX ,
. OS/2 .
3a6biTaS
,
.
,
, . -
,
.
312
10.
UNIX
UNIX
.
. UNIX
, , , ^
-
.
12
. UNIX
, ,
( ), UNIX, ,
, ().
, .
.
.
.
^:
, -
;
,
,
, ;
.
, ,
, .
,
, .
UNIX .
, MULTICS (MULTiplexed Information and
Computing System). UNIX UNICS (Uniplexed
Information and Computing System).
UNIX
313
.
,
.
UNIX ,
. ,
, , UNIX
.
, ,
. UNIX- 30 ,
.
, UNIX-,
, ,
, ,
C++, , PERL, FORTRAN , (
), ,
, ,
.
,
( , ). ,
. ,
, .
UNIX- (kernel).
.
:
, , -
.
,
.
(
) .
, .
.
, . ,
,
, .
,
, .
UNIX
.
314
10.
UNIX ,
; . ,
UNIX ( Linux).
, [39]
, [23,43]. ,
,
,
, ^
UNIX, Windows.
UNIX .
( ) ,
: (
, ,
, ),
, , . ,
, . ,
. :
;
;
;
;
.
.
UNIX , -
. ,
(swapping).
, , ,
, ,
. , Linux ,
^ (swap-file),
,
. , ,
.
:
(
);
082h.
UNIX
315
(
);
(
).
UNIX-
.
.
,
swapping.
, UNIX
. , UNIX
. ,
, ,
, (account name, login) (password). ,
, , ^ ,
.
.
, / .
.
UNIX
(User Identifier, UID), ,
. ,
,
(Group Identifier, GID). UID GID
, ,
.
, ,
, . .
UNIX
. UNIX
[39].
,
.
, (home)
.
, .
, ,
.
, ,
.
316
10.
, ,
, ,
, , .
UNIX
UID. UID (supeniser) root ().
. ,
.
.
^ . ^
, ,
, su. su
, , ,
. ,
, exit,
.
UNIX ,
.
, ,
,
. .
, .
UNIX
.
( ,
/etc/passwd).
,
.
UNIX (shell),
. Linux
bash. ,
.
, ,
.
,
,
.
UNIX
317
, UNIX, ,
, ,
.
(shell scripts),
.
.
, UNIX
X-Window. X-Window ,
. Windows Microsoft,
UNIX- , .
, ,
.
, Linux,
,
.
UNIX- -.
X-Window - -,
,
. ,
.
,
. ,
. , ,
, .
X-Window (
). ,
.
(GUI), X-Window .
Linux
KDE GNOME. X-Window UNIX
( Linux) startx.
, (shell) UNIX-
. ,
,
,
. , ,
,
, .
318
10.
(
), , .
.
, .
:
,
;
,
;
, .
,
( , vi, . .) ,
. ,
UNIX, ,
main ( main
, static).
,
, main.
main, , (
main),
, ,
.
main argc argv.
arge ,
, argv
, .
( arge
1). main
arge
.
,
, ,
:
#1nclucle <stdio.h>
main (argc, argv)
1nt argc:
char *argv[]:
{
i f (argc != 2)
{ printf("usage: ^s your-text\n". argv[0]):
exit:
}
pr1ntf("%s\n". argv[l]):
UNIX
319
UNIX ,
,
. , ,
.
, ,
,
main. , ,
( main) . .
API fork() (__).
fork() ,
(
).
.
, fork() (
) ;
,
fork(). , (
) , fork() :
.
(PID). ,
.
, ,
exec,
, , , ,
,
main . exec ,
, main.
,
, fork,
, . .
,
. , exec,
.
,
, Is ,
.
ma1n()
{1f(fork()==0) wait(O):
/* */
else execlC'ls", "Is", 0); /* */
320
10.
, UNIX ,
fork().
()
fork(). ,
. () ,
.
1
. 1,
init,
.
, ,
UNIX-.
,
.
.
.
,
.
. .
,
, .
. ,
,
.
.
UNIX- (time sharing),
.
,
.
.
. ,
, , ,
, , .
.
.
.
UNIX
321
-
- UNIX
: open, close, read, write seek.
:
f1le_descr1ptor - open (f1le_name. mode)
mode (, ); file^descriptor , ;
file_name .
:
after__reading_bytes - read (file_descr1ptor. buffer, bytes)
after^writlng'bytes - write (f1li_descr1ptor. buffer, bytes)
bytes , ;
after_read1ng_bytes after_writing_bytes
.
,
:
,
;
,
,
;
seek (. ),
, seek.
.
,
seek,
:
Seek (f11e^descri ptor,di splacement.di splacement_type)
displacement^type ( ) ,
,
512 .
, seek ,
, ,
UNIX-
.
, :
close (file^descriptor)
322
10.
,
.
, ,
. login.
- UNIX
, .
(stream)^ , (
).
.
, ,
.
.
,
.
seek.
, ,
.
-
-
, UNIX. ,
, . UNIX
, 60- 70- ,
-
.
,
.
UNIX. -, -
.
( ,
). -,
( ).
. 1 (stdin),
2 (stdout),
3 (stderr). -
, , ,
.
, (thread).
UNIX
323
,
.
(
),
^
.
exec ,
1, 2 3.
,
. , ,
-
,
stdin, stdout stderr. ,
- printf, scanf error
. printf
stdout, scanf stdin, error
stderr.
UNIX
. ,
, , ,
.
,
.
.
512 . ,
UNIX-, .
. , FFS
(Fast File System )
8192 .
(. 10.1):
;
, ,
;
-, , /-;
.
324
10.
1- 1
1-2
1-
>
i-
. 10.1. UNIX
f- :
;
;
;
, ;
;
;
(modification time) ;
UNIX
325
(change time) ;
-, ;
(, ).
f- ,
. , ,
.
, UNIX ,
, -,
, , , .
.
^
i- ( f-
-). ,
.
.
-, ,
.
.
.
,
. .
UNIX .
, , , ,
, .
, ,
.
,
(/) () .
,
. ,
. , ../ (
), ,
. stuff () stuff
. /work/alex/stuff work
, alex work , ,
stuff alex. (/) .
, work (
), alex , stuff
alex.
, , ,
, . . .
326
10.
, . UNIX-
. . ,
,
() . , ,
. 1, ,
.
.
. -
,
, .
/dev.
, .
,
, . mount (
. .) .
mount ,
: .
,
, ,
.
. umount
,
. ,
,
.
^
,
. , ,
. , Linux
EXT2FS,
EXT3FS. , .
,
, .
: (read), (write) (execute).
:
, , , .
,
, , ,
.
,
UNIX
327
(UID) (GID).
.
, .
, ,
( ),
.
(File System access User
ID, FSUID) (File System access Group ID, FSGID), a
(Effective User ID, EUID) (Ef
fective Group ID, EGID). ,
(capabilities), .
UID, FSUID
, , GID, FSGID
.
,
. : ,
.
(
) , ,
. . ,
.
(
). ,
, , ,
.
, . SUID SGID
: ,
(), () ,
. SUID (SGID),
FSUID EUID (FSGID EGID)
, , UID (GID) .
, .
, , SGID,
GID FSGID , GID
. : ^
,
. SVTX,
. , ,
, .
. (subdirectory).
328
10.
,
, .
:
- () ;
d ;
;
b ;
(named pipe);
a s (socket)^
I .
, ,
, .
, w, ,
- - ()
.
SUID (SGID) S
(), ,
S, .
,
, GUID
(4), SGID (2) SVTX (1), ,
. ,
4, 2, 1.
, /tmp
drwxrwxrwx, 041777 (; ,
; ^ SVTX). -r-S-xw-,
102412, , ,
, , (
) (
), ,
, .
, ,
.
(userfile-creationmask, umask),
. , u=rwx, g=rwx, o=r-x
: ,
. 002
( , ,
, TCP/IP,
UNIX. ,
.
UNIX
329
; 4, 2, 1).
chmod.
UNIX
-.
, . ,
, , . .
-.
, -, UNIX
:
;
;
;
;
;
.
, .
[43].
,
,
, :
;
;
( ).
UNIX ,
,
(). ,
, ,
, .
,
, .
.
- .
, UNIX-,
, -
330
10.
.
UNIX :
;
,
;
, ;
, .
:
semget ;
semop (
);
semctl
.
semget :
id = semget(key. count, flag);
key flag .
count ,
.
.
semget
, ^ ,
( -
semctl).
semop:
oldva! = semopdd. oplist, count):
id , oplist
, count .
, ,
. oplist :
;
;
.
oplist
,
.
oplist
, .
, ( , ,
, ( UNIX).
UNIX
331
, oplist.
, ,
, ,
{
UNIX).
,
. ,
() ,
.
, ,
, ()
.
,
, .
, semop, (
oplist),
, semop
- .
, - semop
IPC_NOWAIT, UNIX
,
1,
IPC_NOWAIT.
;
, .
semctl :
semctKid, number, cmd. arg);
id , number ,
cmd , arg ,
- . ,
semctl .
,
.
7.
, , , .
(pipes) UNIX
.
332
10.
,
FIFO (First In First Out ).
, , , ,
.
.
UNIX
(
, ).
UNIX
.
,
.
(
).
(
) open.
pipe
( ).
read, write close.
pipe :
plpe(fdptr):
fdptr ,
,
(
read) ( write).
,
. read
write
^ (,
- ).
(
) open.
,
,
, .
. .
(
, )
read write.
, ,
( ) .
UNIX
333
( ,
) close.
, :
msgget
;
msgsnd (,
);
msgrcv (, );
msgctl .
(),
.
msgget :
msgqid - msgget(key. flag):
key flag , semget
.
msgget UNIX-
,
,
, ,
.
msgsnd:
msgsndCmsgqid. msg, count, flag);
msg ,
( );
count ; flag ,
.
msgrcv:
count - msgrcv(id. msg. maxcount. type, flag);
msg
, ; maxcount
( ) msg; type ,
; flag , ,
,
. ,
.
, (,
) :
msgctl(id. cmd. mstatbuf):
334
10.
:
shmget
;
shmat
;
shmdt
;
shmctl ,
.
,
,
.
shmget :
shmid = shmgetCkey. size, flag):
size .
.
, ,
,
(
,
shmctl). ^ ,
,
, , .
.
. ,
.
shmat:
virtaddr = shmat(id. addr. flags);
id ^ ; addr
,
.
(
addr). addr ,
.
shmdt:
shmdt(addr);
UNIX
335
addr ,
shmat. (
),
.
shmctl:
shmctldd. cmd. shsstatbuf);
cmd ,
.
, .
, , , ,
.
,
shmget ,
, , -
.
.
. () ()
() ,
( -
). ,
.
(Remote Procedure Call, RPC). ,
, .
. UNIX
,
,
.
- , .
. RPC
,
.
(RPC) ,
, . ,
,
,
. , ^
.
336
10.
[39].
1. - ,
(stub). - ,
.
(marshalling).
2. ,
, (unmarshalling),
.
.
Linux
Linux UNIX-
, POSIX.
, Linux UNIX-,
(torvalds@kruuna.helsinki.fi) ().
,
, ,
, .
, ,
.
, Linux
UNIX-, .
,
. Linux
GNU Free Software Foundation (, ).
.
Linux UNIX-
IBM PC i80386. Linux
,
. Linux
, .
.
Linux UNIX, ,
.
.
Linux
( , UNIX). ,
,
.
(
UNIX
337
)),
. .
.
:
Mandrake Linux release 9.0 (dolphin) for i586
Kernel 2.4.16-16mdk on an i686 /ttyl
Vienna login:
BO ttyl ,
.
.
, Alt+F1, 1
. Linux ,
.
, -
Ctrl+Alt+F1.
.
Linux UNIX (
UNIX) ,
IEEE P0SIX.1, System V BSD.
.
UNIX Linux
^ , Linux, ,
, ,
. Linux
POSIX ( ,
csh bash), (pty),
.
Linux .
, EXT2FS,
Linux. , Minix-1
Xenix. , FAT,
,
. ISO 9660 CD-ROM
CD-ROM.
HPFS NTFS, , .
FAT32;
Linux VFAT.
, Linux
UNIX
Linux.
,
Linux .
338
10.
Linux, UNIX-,
TCP/IP . /
Ethernet, SLIP (Serial Line Internet Protocol), PLIP
(Parallel Line Internet Protocol), PPP (Point-to-Point Protocol), NFS (Network File
System) . TCP/IP,
FTP, telnet, NNTP SMTP.
Linux 32 80386 80486 Intel. , Linux
ia32.
Linux
^ Intel.
, ,
-.
.
,
. ,
,
.
, .
UNIX-, Linux ,
.
,
. ,
.
,
. ,
() ,
.
UNIX,
, Linux
.
Linux .
, ,
.
, ,
, . ,
, UNIX-, .
, Intel AMD
, ia32 32-
.
UNIX
339
,
. 64-
Intel AMD.
.
, , ,
, . ,
,
.
(Dynamic Link Library, DLL),
, .
, ,
.
,
,
. Linux
,
.
FreeBSD
Linux
UNIX FreeBSD.
,
Linux ,
. .
,
,
.
, ,
. ,
,
\ , ,
, , .
, (
, - ).
, , Linux
, ,
. ,
, .
Linux , ,
( . install ).
340
10.
,
, . . ,
, (
UNIX-) , ,
Linux FreeBSD
, .
,
, , .
BSD .
, FreeBSD -- UNIX-
. ,
, Linux, . ,
, Linux,
BSD .
, , ,
FreeBSD.
, FreeBSD Linux ,
FreeBSD ,
Linux .
QNX
,
().
. ,
( , )
Windows . Novell NetWare ,
.
( ,
), .
.
IBM PC
Intel 80386 ,
(32-)
.
,
, . ,
,
/ . -
QNX
341
,
( , )
. ,
cuoco6iiSi
,
. ,
.
QNX ,
ia32.
,
, . QNX
,
. ,
.
.
POSIX.
QNX
.
QNX, ^ ,
(). ,
.
UNIX,
POSIX. QNX UNIX, -
. QNX , ,
QNX Software Systems Limited 1989
, ,
UNIX.
QNX ,
.
( )
( ),
.
. ,
QNX [14].
. QNX ,
,
, (,
) . UNIX
,
. UNIX
(
Windows NT).
342
10.
QNX (embedded)
. ^ /dev ,
, UNIX-.
( ,
) , .
, ,
.
,
,
. ( )
, ,
. ,
. ,
.
FLEEP ,
,
.
Photon,
, ,
GUI ( Motif),
POSIX- 4
, i80386 .
QNX
, QNX
,
.
, ,
, ,
.
QNX , ,
.
QNX
( 10 , 32 ,
46 ),
. [26]:
IPC (Inter Process Commu
nication );
(redirector) ;
, .
QNX
343
( , );
( Net).
IPC
,
, , .
QNX
(0-65 535 ) .
, , .
.
, . ,
, .
, ,
,
. , , ,
,
, . ,
, .
, ,
, QNX,
, . QNX
(proxy)
(signal).
'1, ,
.
qnx_proxy_attach() . ,
. ,
, Trigger(),
. Trigger() ,
.
, 65 535 .
,
, UNIX. QNX
, POSIX, ,
UNIX (
, QNX
), , QNX.
, ,
( , ).
.
.
.
.
344
10.
, .
,
, .
. ,
,
. ,
,
.
, .
.
:
.
.
QNX
,
, ,
, i :.
:
- ;
, ;
- .
() 31 (
).
(
). QNX :
(First In First Out, FIFO)
;
(Round Robin, RR)
, ;
( ).
FIFO .
, ,
.
-
QNX
345
,
.
RR , , ,
, ,
.
, ,
:
,
,
1;
, 1;
, .
.
QNX. ,
,
. .
.
, . ,
( -
). -
-.
QNX
. , , ,
.
, ,
,
.
.
, ,
.
QNX,
,
.
. ,
, . , ,
,
, .
QNX ,
. , -
346
10.
,
Net. Net
. .
QNX
: Ethernet FastEthernet, Arcnet, IBM Token Ring . ,
.
QNX 4
-. , ,
, , ,
. , QNX
. (, , )
. QNX
Ethernet, Arcnet, Serial To
ken Ring, .
,
.
(on-line),
.
. QNX
( ) ;
. ,
, , ,
. ,
, .
FLEET.
QNX-. ,
,
.
.
, QNX
FLEET
FTL (FLEET Transport Layer).
IPX NetBios , .
FLEET,
:
Fault-Tolerant Networking QNX
,
;
Load-Balancing on the Fly
QNX
;
QNX
347
348
10.
.
QNX
, .
, ,
. QNX/Neutrino^
POSIX,
.
Neutrino;
. .
QNX .
, .
, - ,
.
, QNX
. .
, .
-. ,
, ( task)
.
, task , ,
.
,
.
.
,
.
,
, .
. , (
64 ), QNX .
, .
: , ,
.
,
.
()
, ^ ,
. ,
, .
, ^ Neutrino .
QNX
349
,
,
. ,
.
,
, ,
.
. , ,
.
, QNX
, .
, ,
.
, ,
1. ,
; ,
. (
) .
, .
. .
QNX
,
, .
, (
). ,
,
-, .
.
32 (
). 20 .
:
Q ,
G ,
Q .
.
,
, ,
.
, .,
. ,
.
.
350
10.
,
(, ).
.
, ^ - ; ,
.
, ,
. QNX ,
,
( ).
,
.
, () .
,
.
, ,
.
. , ,
. QNX 16
, ,
. 16
.
,
.
,
, .
(, ), .
.
.
, ,
.
QNX,
,
. . ,
,
. QNX
,
, , ,
-
. , ,
. .
.
, ,
351
.
. , ,
,
. ,
, .
-, ,
. , ,
, , ,
.
OS/2
Warp IBM
,
OS/2 , .
, ,
, . (
, ,
), . -,
IBM
, ,
. ( )
,
, IBM PC
. -, IBM
, .
OS/2
IBM .
,
, ,
. ,
, OS/2.
, ,
,
Windows NT/2000/XP,
. :
OS/2.
32- OS/2 IBM-
OS/2 v 2.0
352
10.
1992 . 16-
OS/2, i80286.
, ,
. 16-
.
,
, ( ,
).
16- OS/2 1.x 32-
, 32-
OS/2 .
IBM , 4.5.
IBM , , OS/2,
.
OS/2
Warp, . OS/2
Warp 4.0 OS/2 Warp 3.0 ( 1994 )
DOS-
- . :
(preemptive multitasking) DOS Windows- (Win32s^) ;
Q -
;
OpenDoc;
Q OpenGL;
Java- Java;
True (TTF);
( Voice );
/, Com
puServe^;
IBM LAN Server, Windows, Lantastic, Novell Netware 4.1
( TOM );
;
Mobile File System
;
(Plug-andPlay), , Windows;
^ Win32s Windows.
^ .
353
^ ( , ,
, , , ,, );
, ,
WarpGuide.
,
, .
OS/2 Warp
(API), ,
. OS/2 LAN
Server, OS/2 Warp OS/2 Warp Server 4.5,
, ,
.
, IBM
(FixPak). ,
.
, , ,
( Microsoft).
, , ~ Win
dows NT 4.0 Microsoft 6 (ServicePak), OS/2 Warp 3.0,
1994 , IBM
FixPak. OS/2 Warp 4.0 15
.
,
. ,
,
, ,
,
, .
,
,
, .
,
,
. ,
10 .
, ( BonusPak)
Microsoft Office, , ,
, ,
Microsoft Office.
354
10.
,
.
. ,
(, , ,
).
, ,
,
REXX, .
, , ,
(batch) DOS,
.
. , OS/2
. REXX
Visual REXX. -
REXX .
OS/2
- ,
VDM-
DOS-.
OS/2
.
,
: OS/2 ,
2.0, 1992 .
, OS/2
.
.
() 1995
OS/2 Warp Advanced Server.
Windows NT 4.0
( Pentium 90 Pentium 300),
, OS/2.
OS/2 Warp Server
Windows NT.
355
OS/2
, 180x86. ,
1 ,
. .
, -,
,
. .
(
) .
OS/2
. 32- 16- OS/2
DDE OS/2.
DOS Winl6
. DDE
OLE 2.0 , DDE 32- OS/2.
, Win 16
Win 16,
, Windows 3.x. , ,
, API Win32, 90-
XX .
API OS/2, SOM (System Object
Model ),
DLL,
. OS/2
API,
, , .
DOS- (Virtual DOS Machine, VDM), VDM-,
DOS 8086, VDM.
.
.
OS/2
,
.
,
.
.
, .
,
, ,
.
,
. -
356
10.
,
, IPC
, .
,
.
, , .
,
() . (^)
, .
,
. ,
IPC .
.
,
. .
IPC ,
, ,
. .
, , .
.
- ,
.
. IPC
.
. ,
,
. ,
, ,
, , .
,
IPC- , .
-
OS/2 -,
, -
(Direct Memory Access, DMA), a 1
, .
:
, ,
, .
( ,
.
357
,
), , ,
.
,
, .
.
,
OS/2, ,
,
, , ,
. ,
, ,
. - ,
-, - ,
, , ,
,
. - ,
, .
-
UNIX.
,
, ,
, .
(
), - .
,
,
, .
OS/2 Warp
Workplace Shell (WPS),
, Windows-. Workplace Shell
(SOM) IBM ,
,
. Workplace Shell SOM,
,
, REXX.
GUI Windows, (shortcuts)
, WPS , (shadow^
Shadow (- ) OS/2, ,
.
358
10.
WPS),
.
.
. GUI, WPS
, ,
GUI ,
.
SOM ,
- ,
.
. OS/2
, SOM
. , , OS/2
90- ,
Windows Whistler.
- ()
,
, ,
.
, - .
SOM
. SOM
CORBA (Common Object Request Broker Architecture
),
.
OS/2 .
,
OS/2, FileBar,
,
4 , Object Desktop,
OS/2 .
, 1 OS/2,
, . ,
Xfree86 for OS/2 -Window,
UNIX-,
, UNIX OS/2. ,
, UNIX-
, , ,
Xfree86/OS2.
359
360
10.
.
JFS
.
1.
UNIX. UNIX
Windows.
2. , UNIX-.
3. forkO?
UNIX ?
4. , UNIX.
5. NTFS, Windows NT/2000/XP,
, UNIX-.
6. UNIX.
?
7. (RFC)?
8. GNU
. .
.
9. Linux. , ,
Linux? Linux
FreeBSD.
10. -Window? ?
Linux ?
. QNX?
.
12. QNX , ?
FLEET?
13. QNX?
14. Windows NT 4.0,
, QNX?
15.
QNX.
16. OS/2.
?
17. OS/2,
?
1 1 .
Windows
, Microsoft
.
.
,
Windows 2003,
.71. (
) Microsoft
Windows .
Pocket PC
Microsoft Windows Mobile 2003 for Pocket PC. (
Windows Win32 API,
.)
Windows, , ,
, Microsoft
,
. Windows ,
MS DOS,
(. 4)
.
. ,
Apple.
, , , ,
.
(Graphical User Interface, GUI)
Microsoft ,
. -
362
11. Windows
Microsoft
,
, ,
.
, Windows,
.
. , Windows,
Windows 95, Windows . ,
,
. .
Windows ,
^
, .
, Linux, QNX OS/2,
, Windows
^ .
,
.
. ,
, .
, ,
^ , (batch)
Microsoft, bat,
C0MMAND.COM, DOS,
CMD.EXE, Windows NT/
2000/ .
CMD.EXE 32- .
,
. , ,
, ,
, -
.
, .
^ ,
,
.
,
,
UNIX (Linux, FreeBSD
. .), QNX, OS/2.
,
, , .
Windows 9
363
Windows 9
, Windows,
1985 ,
i80286.
( Intel
, ,
),
.
32- (i80386 )
Windows 16-
32- . , i80386
1985 . ,
,
4.
16- i8086
i80286 ( ),
32- .
Windows, , Mi
crosoft
OS/2. , Windows NT
OS/2, 3.0.
, ,
, Microsoft Windows
,
IBM. Windows, 1990
Windows 3.0.
, i80386,
, ,
Winl6 API. ,
DOS-, .
MS DOS.
WIN.COM
Windows. ,
MS DOS. Windows 3.0
.
Windows 3.0 Windows 3.1 , ,
Windows 3.11 for Workgroups.
, , , ,
16 ,
, 32--
364
11. Windows
; ,
.
Microsoft,
, Chicago.
1995 Windows 95.
Windows 95, ,
: 1992 . 32-
OS/2 2.0, 1995
2.2
. , .
, ,
IBM . ()
OS/2 .
, IBM, Microsoft
Windows 95
. 16-
Windows 3.x, .
, 32-
.
Windows 95
,
, ,
.
, ,
Windows 95 ,
, .
,
Window^s 95,
OS/2.
Linux .
1996 Windows 95 (
Nashville), Windows 95 OSR 2 (OEM Service
Release 2). ^
( FAT32),
.
1998 Microsoft ,
Windows 98. 32-
,
, 16- ,
. ,
32- WDM (Windows Driver Model)^
Windows,
.
Windows 9
365
,
Windows NT.
USB (Universal Serial Bus
).
.
Windows 98 SE^ .
, ^ Microsoft
,
Windows 95. Windows Millennium Edition^ (ME).
Windows ME, Microsoft :
( ) ;
; ;
. ,
( , )
DOS,
. Windows ME
, ,
,
DOS, .
Microsoft
Windows Edition, Windows NT.
Windows 9 IBM-
.
( , ia32)
. Microsoft,
,
; ,
.
Windows 9 , ,
, .
.
(, ,
),
, 32- .
,
(desktop), (taskbar) (Start),
. ^ SE Second Edition .
^ 2000 .
^ millennium .
366
11. Windows
(profile),
^ Profiles,
. ,
, ,
.
pwl, ,
, ,
.
(
Plug and Play ).
(Configuration Manager). ,
, ,
IRQ (Interrupt Request ),
-,
. ,
.
Windows 9 ,
,
.
.
-
,
.
Windows 9
32- ()
.
. :
Kernel, User GDI. Kernel
, : ;
; ; ,
; ; -; ;
; 32- 16-
16- 32- ( )
; . User
( )
.
, , ,
,
. , ,
GDI (Graphical Device Interface (directory)
(folder).
Windows 9
367
), ,
,
- . GDI
, .
Windows 9
,
,
.
(registry).
INI-, Windows 3.x.
system.dat user.dat,
. ,
, ,
user.dat ,
. user.dat
.
Windows 9
-.
.
Windows 9
. ,
,
.
, - ,
.
, -
, .
,
, Windows 9
.
, .
VxD (Virtual Device ),
,
, .
X , ,
, , .
VDD, .
VxD
, , ,
, , (
), , . -
368
11. Windows
,
, . Windows 9
,
.
.
,
/ . , , ,
,
- .
; ,
,
. Windows 9
, .
.
,
. - (Input/Output Supervisor, lOS).
,
.
. :
VFAT (Virtual FAT)
-;
CDFS -;
UDF (Universal Disk Format) ,
Optical Storage Technology Association,
DVD-ROM CD-ROM (
Windows 95);
Microsoft
Novell (Netware).
(IFS).
. , Windows 98
NTFS. ,
, .
NTFS ,
.
Windows 98 Windows ME
FAT12 ( ), FAT16 FAT32.
.
Windows 9
369
Windows .
,
.
NetBIOS SMB (Server Message Blocks).
,
, Windows 95 Win
dows 98 -.
.
,
,
.
,
, Windows 9,
,
.
, .
, , ,
.
,
, - . ,
Windows NT, UNIX,
. Windows 3.x
, . ,
Windows 9
, Win
dows. ,
Microsoft
Windows 9 ,
, , Windows NT. Windows 3.1
.
. ,
.
,
,
, (thread).
,
. ,
, .
Windows 9 32-
.
370
11. Windows
( ).
-. Windows 95/98
,
.
-. ,
.
.
, (
)
,
,
,
.
,
^ :
, .
Windows 95/98 32-
. MS DOS
16- Windows API,
. MS DOS
. , 16- Windows
, ,
Windows
. 32-
, Windows 95/98
, Windows.
, .
32- ,
, ,
16-
32-.
,
Windows 3.x , ,
(cooperative multitasking). Windows 95/98
16-
, Win32
. 32-
(preemptive multitasking).
(scheduler).
. Windows 95/98
, ,
. ,
Windows 9
371
. Windows
NT, Windows 95/98 ,
.
, , . ,
.
, ,
. , ,
, ,
, ,
.
, ,
, ( )
.
.
, .
(priority).
,
. , ,
, ()
, .
, .
, ,
, , ,
, ,
.
.
( ) ,
.
.
. , ,
, ,
, .
.
.
. .
,
,
. Windows 95/98
.
372
11. Windows
Windows 9
: (primary scheduler)
; (timeslice
scheduler) , .
, ,
.
, , (suspended)
, .
(execution priority),
, 31.
,
, .
,
.
20 .
,
.
.
, .
, ,
, ,
.
,
.
32- ,
.
, ,
. .
() Windows 9
- ,
, , , ,
. . Windows 3.x
,
,
. Windows 95/98 ,
Win32, ,
^,
.
Windows 9
373
Windows 95/98
MS DOS 7.0 (MS DOS 98), [Options] MSDOS.SYS
BootGUI = , (.
4). MS DOS 7.0 ,
DOS. GUI Windows 95/98
.
Windows 9 ( )
.
. Win
dows 9
.
, .
,
Windows 9,
() , .
, .
, ,
,
. ,
. Windows 9
LRU (Least Recently Used
), , ,
, .
,
. , , .
.
:
,
, ,
, ,
(DMA).
,
',
Windows 9 .
, ,
.
. ,
, ,
. -
374
11. Windows
, ,
, .
,
.
,
, . API GlobalMemorySatus()
,
,
.
-:
(
),
- .
. ,
32-
(DLL), .
,
, ,
,
(Page Descriptor, PD).
,
. ,
, ,
, ,
. ,
, (virgin").
, , ,
Win32.
, (tainted)
(dirty), (clean), ,
.
,
, .
, , SYSMON.EXE (
). Windows
9,
.
.
,
,
,
, ,
.
Windows 9
375
376
11. Windows
,
, Windows 3.x.
4
.
, .
.
( 64 ) 32-
,
, 16- , , , ,
.
. 11.1.
4
,
2 4
32-
3
- DLL
- Win 16
-
DLL
2
32-
.
, , ,
64
. 1 1 . 1 . Windows 95/98
Windows 9
377
Windows (module)
, (
, ).
DLL. Windows
(module
database), ^ .
, .
,
Windows 9 . , ,
Word Internet Explorer,
Windows ,
,
, ,
.
Windows 9
.
, Windows 9
, .
, , , ,
, ,
.
,
, 4 Windows 95
8 Windows 98.
,
, .
,
, Windows
. ,
.
, ,
( ).
(
), [386Enh]
SYSTEM.INI , :
Pag1ngDrive=C:
Pag1ngPi1=:\PageFi 1 . sys
1nPagi ngF11eS1ze=65536
MaxPagi ngFi1eS1ze=262144
,
( ).
378
11. Windows
SYSMON.EXE^ ( ) ,
,
, , .
VCache,
. ,
,
. ,
.
, ,
, ,
,
.
VCache.
SYSTEM .INI.
[VCache].
,
.
, , :
MinFileCache=16384
MaxF1leCache=65536
ChunkSize=2048
NameCache=4096
D1rectoryCache=128
.
,
, .
, , ,
. 512 .
, 256 ,
[VCache] SYSTEM .INI .
- VCache
256 ,
.
.
Windows NT/2000/XP
Microsoft 1990
IBM PC- SYSMON.EXE Windows 9,
.
Windows NT/2000/XP
379
, , ,
, :
Mach 3,
(Carnegie Mellone University),
;
(platform independent),
;
(
UNIX
);
,
, UNIX 16- OS/2;
;
;
.
OS/2 version 3.0,
Microsoft Windows NT. NT New Technology,
.
1993 . Windows NT
3.1 Windows NT Advanced Server 3.1.
. Windows NT 3.1
OS/2,
. , ,
FAT, .
Novell Netware 3.x.
Windows NT Microsoft Windows NT 3.5
.
Novell,
FAT,
.
Netware 3.x
Novell.
Netware 4.x,
,
.
.
Windows NT 3.x 3.5.1.
Windows NT 3.x
, ,
( ) .
380
11. Windows
, Windows NT
.
-, Windows NT 3.x,
.
, GDI, (Window Manager)
,
.
, ,
. ,
.
NT 16- Windows 3.x,
, Windows 95.
, Microsoft Cairo 1996 .
Windows NT 4.0 Sever Windows NT 4.0 Workstation.
Windows NT 4.0 .
.
.
16 , 12 ,
.
,
. ,
,
; NT.
, Microsoft
HPFS,
OS/2,
; ; Windows NT 3.x.
,
Microsoft OS/2.
Novell Netware 4.x Net
ware 5.x, Microsoft
NT, Windows NT 5.0,
Windows 2000.
.
Windows 2000 Professional
Windows NT.40 Workstation Windows 98.
2- .
Windows 2000 Server /
(, , , web / FTP, . .) -
Windows NT/2000/XP
381
,
. 4- .
Windows 2000 Advanced Server , Windows 2000 Server,
.
, , .
Windows 2000 Datacenter Server
,
. , 4- ,
16 ^
, (
Windows NT 4.0) Plug
and Play ( Windows 9)
-. Microsoft
Active Directory.
TCP/IP. , ,
, NTFS5^. ,
, HPFS.
Microsoft
Alpha (DEC), PowerPC, MIPS.
2001 Microsoft Windows 2000 Pro
fessional Windows (experience). .
. Windows Edition.
Microsoft
.
, , ,
. , ,
,
Win32 API: Windows 9, NT. Windows
. Windows
:
(), . ,
. , UNIX
, . Windows .
, 2003 Windows 2000
, 2003. ' , ,
, 32 .
^ . 6.
382
11. Windows
32-
1-32.
Windows Small Business Server 2003
.
Windows Server 2003 Web Edition ,
.
Windows Server 2003 Standard Edition
, Windows 2000 Server.
Windows Server 2003 Enterprise Edition Windows 2000 Advanced Server.
a Windows Server 2003 Datacenter Edition.
64-
Itanium 2 Intel.
,
.
Microsoft ,
,
. ( ).
Windows 9 Win
dows NT , .
, :
( , ) (
). Windows NT Microsoft
kernel mode user mode .
,
, ,
. ,
,
, , () ,
.
.
Windows NT
, ,
,
Intel 180x86. ,
132
.
, (. 4),
. , .
383
Windows NT/200d/XP
,
, . ,
, ,
.
Windows NT . ,
,
QNX. Windows NT
,
-. ,
,
. ' ,
, (. 11.2).
,
, , .
Windows NT
. 11.2. Windows NT
384
11. Windows
() Windows NT (
, ), ,
,
, .
( Win
dows NT ^),
, .
,
HAL (Hardware Abstraction Layer
), Win
dows NT, Win32 Executive. Windows NT 4.0
(Window Manager), User,
(GDI).
,
,
.
HAL.DLL.
Windows NT/2000/XP,
, (Win32 Executive).
, ,
, , ,
- ( , ,
). .
(Process Manager) ,
. ,
,
.
(Virtual Memory Manager)
.
,
,
, .
(Object Manager) .
, .
, , ,
.
(Security Reference Monitor)
, .
(logon)
Windows NT.
, <