Title: 1' tet pst Sstt
11. ????te?t????? ?p?????st???? S?st?µ?t??
2Alan M.Turing, 1950
- I believe that in about fifty years' time it
will be possible, to programme computers, with a
storage capacity of about 109, to make them play
the imitation game so well that an average
interrogator will not have more than 70 per cent
chance of making the right identification after
five minutes of questioning. The original
question, "Can machines think?" I believe to be
too meaningless to deserve discussion.
Nevertheless I believe that at the end of the
century the use of words and general educated
opinion will have altered so much that one will
be able to speak of machines thinking without
expecting to be contradicted.
3?p?????st??? S?st?µa (Computer System)
CPU
4?p?????st??? S?st?µa
???µ?
CPU
5?p?????st??? S?st?µa
??as??des?
???µ?
CPU
6?p?????st??? S?st?µa
??as??des?
???µ?
CPU
Input/Output
7?p?????st??? S?st?µa
??as??des?
???µ?
CPU
8?p?????st??? S?st?µa
??as??des?
???µ?
CPU
???s??µ?s? (fetch)
9?p?????st??? S?st?µa
??as??des?
???µ?
CPU
??t??es? (execute)
10?p?????st??? S?st?µa
??as??des?
???µ?
CPU
???s??µ?s? (fetch)
11?p?????st??? S?st?µa
??as??des?
???µ?
CPU
??t??es? (execute)
12?e?t???? ?p?????st??? ????da (CPU)
??as??des?
???µ?
13?e?t???? ?p?????st??? ????da (CPU)
Arithmetic Logic Unit
Control Unit
Program Counter
Registers
14??a???? (Buses)
??as??des?
15??a???? (Buses)
Address
CPU
Data
Control
16????a ???µ? (Main Memory)
??as??des?
17????a ???µ?
DRAM Chip 0
DRAM Chip 1
Main Memory
Cache
Secondary Memory
18????a ???µ?
DRAM Chip 0
DRAM Chip 1
Main Memory
19??a??p?? (Interrupts)
??as??des?
- ??? ??a p????aµµa e?te?e?ta?, ??a ???? ???e? ?a
e?te?este? (???e? ?a d?a???e? t? p??t?
p????aµµa). - ???s??t??µe ??a ??e??? d?a??p?? st?? ?????
fetch-execute.
20?p?????st??? S?st?µa
??as??des?
???µ?
CPU
Fetch
21?p?????st??? S?st?µa
??as??des?
???µ?
CPU
Execute
22?p?????st??? S?st?µa
??as??des?
???µ?
CPU
??e??e ??a ??a??p??
23?p?????st??? S?st?µa
??as??des?
???µ?
CPU
??e???? d?a??p??
24?p?????st??? S?st?µa
??as??des?
???µ?
CPU
Processor Context
- ?? e???eµe? µ?a d?a??p?
- S?se t? processor context (program counter
registers) st? µ??µ?
25?p?????st??? S?st?µa
??as??des?
???µ?
CPU
PC
??e????s? t?? ISR
- ?? e???eµe? µ?a d?a??p?
- S?se t? processor context (program counter
registers) st? µ??µ? - F??t?se t?? program counter µe t? d?e????s? t??
Interrupt Service routine (ISR).
26?p?????st??? S?st?µa
??as??des?
???µ?
CPU
- ?? ISR t???e? ?p?? ??a ?a?????? p????aµµa
- Fetch
- Execute
- ??e???? d?a??p??
27?p?????st??? S?st?µa
??as??des?
???µ?
CPU
- ????? t? ISR te?e??se? t?? e?t??es?
28?p?????st??? S?st?µa
??as??des?
???µ?
CPU
Processor Context
- ????? t? ISR te?e??se? t?? e?t??es?
- ?p??at?st?se t? pa??? processor context.
- S?????se ?a e?te?e?? t? a????? p????aµµa.
29??t??es? e?t????
?as???? ?????? e?t????
30?a?a?aß? ?a? e?t??es? e?t????
- ?at? t?? e?????s? ???e ?????? e?t???? ?
epe?e??ast?? pa?a?aµß??e? µ?a e?t??? ap? t??
µ??µ?. ? PC ??at? t? d?e????s? t?? e?t????, ?ste
a?t? ?a µp???se? ?a pa?a??f?e?. ? epe?e??ast??
a????e? p??t?te ?at? 1 t?? PC (Program Counter)
??a ?a pa?a??ße? t?? aµ?s?? ep?µe?? e?t???, e?t??
a? p?????e? d?af??et??? ?d???a. - ? e?t??? p?? pa?a??f???e ap? t? µ??µ? f??t??eta?
st?? ?ata????t? e?t???? (IR- Instruction
Register). ? f?s? t?? e?t???? ?a?????e? t??
e????e?a p?? p??pe? ?a ???e? ? epe?e??ast??.
31?????? e?t???? µe d?a??p??
32?as???? ?e?t?????e? t?? d?a??p??
- ?? d?a??p?? µetaf????? t?? ??e??? st? ???t??a
e??p???t?s?? d?a??p?? (Interrupt Service Routine)
µ?s? t?? d?a??sµat?? d?a??p?? (interrupt vector),
p?? pe????e? t?? d?e????se?? ???? t?? ???t????
e??p???t?s?? d?a??p??. - ? a???te?t????? d?a??p?? p??pe? ?a ap????e?se? t?
d?e????s? t?? d?a??pt?µe??? e?t????. - ?? e?se???µe?e? d?a??p?? ape?e???p?????ta?
(disabled), ?a??? µ?a ???? d?a??p? e??p??ete?ta?,
??a ?a ap?fe???e? µ?a ap??e?a d?a??p?? (lost
interrupt). - ??a ???????G??? S?S???? ?a??d??e?ta? ap? d?a??p??
(interrupt driven).
33????te?t????? ?p?????st???? s?st?µat??
34S??????? I/O
- ?at? t? d????e?a e?t??es??, ???e p????aµµa
??e???eta? ?e?t?????e? I/O ??a ?a d??eta?
ded?µ??a ap? t? p???t???????, ?a a????e? a??e?a
?a? ?a e?t?p??e? ap?te??sµata. - Sta p??ta ?p?????st??? s?st?µata ??a p????aµµa
?p?epe ?a pe??µ??e? t?? ????????s? t??
?e?t??????? I/O. (S??????? I/O) - ?ts? s???? ? CPU pa??µe?e a?e?e???.
35?s??????? I/O ?a? d?a??p??
- ? as??????? I/O ep?st??fe? t?? ??e??? st?
p????aµµa t?? ???st? ????? ?a a?aµ??e?t??
????????s? t?? I/O. - ?ta? ?????????e? ? ?e?t?????a I/O,p???a?e?ta? µ?a
d?a??p? st?? CPU p?? a?ast???e? p??s????? t?
p????aµµa ???st? ?a? d?a?e????eta? t? s?s?e?? I/O.
user
kernel
time
36?e?t?????a e??? ?p?????st???? s?st?µat??
- ?? ?e?t?????e? I/O ?a? ?? ?e?t?????e? t?? CPU
µp????? ?a e?te????ta? ta?t?????a (s???????
a???te?t?????). - ???e e?e??t?? s?s?e??? (device controller)
ep?f??t??eta? µe t?? ??e??? e??? t?p?? s?s?e???. - ???e e?e??t?? s?s?e??? d?a??te? ??a t?p??? buffer
(e?taµ?e?t?? µ??µ??). - ? CPU µeta???e? ded?µ??a ap? / p??? t?? ????a
µ??µ? p??? /ap? ta t?p??? buffers. - ?? ?e?t?????e? I/O ?????ta? ap? t? s?s?e?? p???
t? t?p??? buffer t?? e?e??t?. - ? e?e??t?? s?s?e??? p????f??e? t?? CPU ?t? ??e?
????????se? t? ?e?t?????a t?? p???a???ta? µ?a
d?a??p? (interrupt).
37?p?s?st?µa I/O t?? ?????a (Kernel) t??
?e?t???????? S?st?µat??
38?e?t?????a t?? epe?e??ast? se pe??pt?s? d?a??p??
- ?p????e?e? ??p??? pe??e??µe?? p?? s?et??eta? µe
t? d?e??as?a p?? d?a??pteta?, d??ad? - ??? de??t? e?t???? p?????µµat??
- ??? de??t? st??ßa?
- ?? pe??e??µe?? t?? ?ata????t??
- G??eta? d?a???d?s? se µ?a ???t??a d?a?e???s??
d?a??p?? p?? ?a?????e? t? f?s? t?? d?a??p?? ?a?
t?? epe?e????eta? - ?ta? ?????????e? ? e?t??es? t?? d?a??p?? ?
??e???? ep?st??fe? st? d?e??as?a p?? d?a??p??e ?
se ??p??a ???? d?e??as?a
39???a??sµ?? e??p???t?s?? d?a??p??
- Se ???e µ?a ?µ?da s?s?e??? t?? ?d??? t?p??
(d?s??ta, s?????? d?s???, te?µat??? ??p)
a?t?st???e? µ?a ??s? µ??µ?? p?? ?a?e?ta? d????sµa
d?a??p?? (interrupt vector). ? ??s? a?t?
pe???aµß??e? t? d?e????s? t?? d?ad??as?a?
e??p???t?s?? t?? d?a??p?? (interrupt service
procedure). - ?ta? f??se? ??a s?µa d?a??p?? (p.?. ap? t??
d?s??) ? de??t?? e?t???? p?????µµat?? ?a? p??a???
?? t?µ?? ????? ?ata????t?? t?p??et???ta? st?
st??ßa ap? t? ????? d?a??p??. - St? s????e?a ? ??e???? µetaf??eta? st? d?e????s?
p?? ????eta? ap? t? d????sµa d?a??p?? (p.?. t??
d?s???). - ??t? e??a? ??? ? e??as?a p?? ep?te?e? t? ?????.
????????? a?a?aµß??e? d??s? t? ????sµ???.
40???????S
- ??????? ? a?ast??? t?? d?ast????t?ta? ???e
e??as?a? ???? t?? eµf???s?? e??? s???e???µ????
?e????t?? - ? d?a??p? e??? p?????µµat?? a?af??eta? st?
µetaf??? ? st?? ??e??? t?? p?????µµat?? ap? t?
t????? e?te???µe?? p????aµµa se ??a ????
p????aµµa e??p???t?s??, ?? ap?t??esµa µ?a?
es?te????? ? e??te????? apa?t?s?? t?? s?st?µat??.
? ??e???? ep?st??fe? st? a????? p????aµµa µet?
ap? t?? e?t??es? t?? p?????µµat?? e??p???t?s??. - ?? d?a??p?? e??a? ??a? t??p?? ??a ?a ße?t???e? ?
ap?te?esµat???t?ta t?? epe?e??as?a?. - ???? ?? ?p?????st?? pa?????? ??a µ??a??sµ?
s?µf??a µe t?? ?p??? ???a µ??? (µ??µ?, ?/?)
µp????? ?a d?a?????? t?? ?a?????? ?e?t?????a t??
epe?e??ast?.
41???????S (s??.)
- ? epe?e??ast?? µp??e? ?a apas?????e? µe t??
e?t??es? ????? e?t???? ?at? t? d????e?a µ?a?
?e?t?????a? ?/?. - ? s?s?e?? p?? apa?te? e??p???t?s? ap?st???e? µ?a
a?t?s? d?a??p?? p??? t?? epe?e??ast?. - ? epe?e??ast?? apa?t? µe p??s????? pa?s?
e?t??es?? t?? t?????t?? p?????µµat??, e?e???p??e?
t?? d?a?e???st? d?a??p?? t?? s?s?e??? ?a?
epa?af??e? t?? ?a?????? e?t??es? t?? p?????µµat??
µet? t?? ????????s? t?? e??p???t?s?? t??
d?a??p??. - ? epe?e??ast?? ?a? t? ?.S. e??a? ?pe????a ??a t??
p??s????? pa?s? t?? p?????µµat?? ?a? t??
epa?af??? t?? st? ?d?? s?µe??.
42?at?????e? d?a??p?? (1)
- ?p?????? t?e?? ????e? ?at?????e? d?a??p?? p??
p???e???? t? d?a??p? t?? ?a??????? e?t??es?? t??
p?????µµat??. - External interrupts (e??te?????)
- Internal interrupts (es?te?????)
- Software interrupts (????sµ????)
43External interrupts
- ????????ta? ap? s?s?e??? ?/?, s?s?e??? ?????sµ??,
ap? ?????µata p?? pa?a????????? t?? t??f?d?s?a
t?? ??. ?e?µat?? ?a? ?e???? ap? ?p??ad?p?te
e??te???? p???. - ?a?ade??µata d?µ??????a? e??te????? d?a??p??
- s?s?e??? ?/? p?? apa?t??? µetaß?ßas? ded?µ????,
- s?s?e??? ?/? p?? ???????????? t? µetaf???
ded?µ????, sf??µa t??f?d?s?a?, - d?a??p?? ?p??ßas?? ???????? ????? p????aµµ?t??
p?? ß??s???ta? se ß????? a?aµ???? ?a? ?epe?????
??a ??????? ????.
44Internal interrupts
- ????????ta? ap? esfa?µ??? ? µ? s?st? ???s?
e?t???? ?a? ded?µ????. ???µ????ta? ep?s??
pa??de?se?? (traps). - ?a?ade??µata es?te????? d?a??p??
- ?pe??e???s? ?ata????t??,
- ?pe??e???s? st??ßa?,
- p??sp??e?a d?a??es?? µe t? µ?d??,
- sf??µa p??stas?a?,
- ?a??asµ???? ??d???? e?t????.
- ??t?? ?? esfa?µ??e? s?????e? p????pt??? s??????
?? ap?t??esµa p?????? te?µat?sµ?? t?? e?t??es??
µ?a? e?t????. ?? p????aµµa e??p???t?s?? p??
epe?e????eta? t?? es?te????? d?a??p?? ?a?????e?
t? d?????t??? e????e?a p?? p??pe? ?a ???e?.
45?a??de?s? (trap)
- ??a pa??de?s? (trap) e??a? µ?a d?a??p? ????sµ????
(software-generated interrupt) p?? p???a?e?ta?
e?te ap? ??a ????? e?te ap? µ?a apa?t?s? ???st?. - ???a? s??????? µe t? d?ad??as?a ? ?p??a t??
p???a?e?. - ?.?. s??????e? d?a??p?? s?µßa????? ?ta? µ?a
d?ad??as?a p??spa?e? ?a e?te??se? µ?a µ?
ep?t?ept? e????e?a, ?p?? p.?. ? d?a??es? µe t?
µ?d?? ? ? a?af??? se µ?a p??state?µ??? d?e????s?
µ??µ??.
46??af???? es?te????? ?a? e??te????? d?a??p??
- ?? es?te????? d?a??p?? ?e?????? ap? ??p??a
as?????st? ?at?stas? p?? p???a?e?ta? ap? ??a
p????aµµa pa?? ap? ??p??? e??te???? ?e?????. - ?? es?te????? d?a??p?? e??a? s??????e? µe t?
p????aµµa e?? ?? e??te????? e??a? as??????e?. ??
t? p????aµµa e?te?este? ?a??, ?? es?te?????
d?a??p?? ?a s?µß??? st? ?d?? s?µe?? ???e f???. - ?? e??te????? d?a??p?? e?a?t??ta? ap? e??te?????
s?????e? p?? e??a? a?e???t?te? ap? t? p????aµµa
p?? e?te?e?ta? ???e f???. - ?? es?te????? d?a??p?? ?a? ?? e??te????? d?a??p??
?e?????? ap? s?µata p?? p???????ta? ap? t? ?????
? t?? CPU.
47Software interrupts
- ??a d?a??p? ????sµ???? ?e???? ap? t?? e?t??es?
µ?a? e?t???? ?a? e??a? µ?a e?d??? ???s? e?t????
p?? s?µpe??f??eta? pe??ss?te?? ?? d?a??p? pa??
sa? µ?a ???s? d?ad??as?a?. ?p??e? ?a
???s?µ?p????e? ap? ??a? p????aµµat?st? ??a ?a
?e????se? µ?a d?ad??as?a d?a??p?? se ?p???d?p?te
s?µe?? t?? p?????µµat??. - ? p?? s?????? ???s? t?? d?a??p?? ????sµ????
s?et??eta? µe t?? ???s? µ?a? e?t???? ep?pt?
(supervisor call instruction). ??t? ? e?t???
pa???e? t?? t??p? ??a t? µet?ßas? t?? CPU ap? t?
?at?stas? ???st? (user mode) se ?at?stas? ep?pt?
(supervisor mode). - ???sµ??e? ?e?t?????e? st?? ?p?????st? µp????? ?a
e?te????ta? µ???? se supervisor mode, p.?. µ?a
p???p???? d?ad??as?a ?/?. - ??a p????aµµa ???st? p??pe? ?a e?te?e?ta? se user
mode. - ????? apa?t??e? µ?a µetaf??? ?/? apa?te?ta? t?
s?st?µa ?a pe?????e? se supervisor mode ?a? a?t?
ep?t?????eta? µ?s? µ?a? supervisor call
instruction. - ? e?t??? p???a?e? µ?a d?a??p? ????sµ???? p??
ap????e?e? t?? t?????sa ?at?stas? t?? CPU ?a?
e?s??e? se µ?a ??a ?at?stas? t?? CPU p?? a???e?
st?? ?at?stas? ep?pt? (supervisor mode).
48?at?????e? d?a??p?? (2)
- ??????µµat?? pa?????ta? ap? ??p??a s?????? ?
?p??a p????pte? ?? ap?t??esµa t?? e?t??es?? µ?a?
e?t????, ?p?? ? a???µ?t??? ?pe??e???s?, ?
d?a??es? µe t? µ?d??, ? ap?pe??a e?t??es??
esfa?µ???? e?t???? ? ? a?af??? se tµ?µa t??
µ??µ?? p?? ß??s?eta? e?t?? t?? ????? t?? ???st?. - ?????sµ?? pa?????ta? ap? ??a ?????st? es?te????
st?? epe?e??ast?. ??t? ep?t??pe? st? ?.S. ?a
e?te?e? s???e???µ??e? ?e?t?????e? se ta?t???
ß?s?. - ?/? pa?????ta? ap? ??a? e?e??t? ?/?, ??a ?a
s?µat?d?t?s??? t?? ?a?????? ????????s? µ?a?
p????? ? µ?a p??????a ?atast?se?? sf??µat?? - ???ß?? ?????? pa?????ta? ap? ß??ß?, ?p?? ?
d?a??p? t??f?d?s?a? ? t? sf??µa ?s?t?µ?a?
(parity) t?? µ??µ??.
49Intel Pentium Processor Event-Vector Table
50?s??s? - 1
- ???e? ?? d?af???? a??µesa se µ?a d?ad??as?a
d?a??p?? (interrupt procedure) ?a? µ?a ???s?
d?ad??as?a? (subroutine call) - ? d?a??p? s?????? ?fe??eta? se ??a e??te???? ?
es?te???? s?µa pa?? st?? e?t??es? µ?a? e?t????
(µe e?a??es? t?? d?a??p?? ????sµ????) - ? d?e????s? t?? p?????µµat?? e??p???t?s?? t??
d?a??p?? ?a?????eta? ap? t? hardware ?a? ??? ap?
t? ped?? d?e????s?? µ?a? e?t???? - ??a d?ad??as?a d?a??p?? s?????? ap????e?e? ???
t?? p????f???a p?? e??a? a?a??a?a ??a t??
?a????sµ? t?? ?at?stas?? t?? CPU ?a? ??? µ????
t?? µet??t? p?????µµat?? (PC)
51?s??s? - 2
- ???e? e??a? ?? d?af???? µeta?? µ?a? pa??de?s??
(trap) ?a? µ?a? e??te????? d?a??p?? (external
interrupt) ???a e??a? ? ???s? ???e µ?a? - ??a d?a??p? e??a? µ?a? a??a?? t?? ???? e?t??es??
st? s?st?µa p?? d?µ?????e?ta? ap? t? ?????. ?
?e???st?? d?a??p?? (Interrupt handler) ?a?e?ta?
?a d?e?e???se? t?? a?t?a t?? d?a??p??. St?
s????e?a ? ??e???? ep?st??fe? st? p?a?s?? ?a?
st?? e?t??? p?? e??e d?a??pe?. ??a d?a??p? µp??e?
?a ???s?µ?p????e? ??a ?a s?µat?d?t?se? t??
????????s? µ?a? ?e?t?????a? ?/? ?ts? ?ste ?a
ap?fe???e? ? a????? ??a pe???de?s? (polling) t??
s?s?e???. - ??a pa??de?s? e??a? µ?a d?a??p? p?? p???a?e?ta?
ap? t? ????sµ??? ?a? µp??e? ?a ???s?µ?p????e? ??a
t?? ???s? d?ad??as??? t?? ?.S. ? ??a t?? e??es?
a???µ?t???? ?a???.
52?s??s? 3 (?S?? 2005)
- ?? ???sµa d?a??p?? (interrupt vector) ?p?d????e?
- a) ??a ded?µ???.
- ß) µ?a d?e????s?.
- ?) µ??e??? µ??µ??.
- d) t?p?ta ap? ta pa?ap???.
- ?a s?µata d?a??p?? ap? µ?a pe??fe?e?a?? µ???da
d?a??pt??? t?? e?t??es? µ?a? e?t???? se ???ssa
µ??a??? - a) st? t???? t?? ?????? a?????s?? (fetch cycle)
t?? e?t????. - ß) st? t???? t?? ?????? e?t??es?? (execution
cycle) t?? e?t????. - ?) ?µesa, d?a??pt??ta? t?? ????? µ??a??? ? ?p????
e?te?e?ta?. - d) se ?aµ?a ap? t?? pa?ap??? pe??pt?se??.
53?e???sµ?? d?a??p??
- ? µetaf??? ded?µ???? µeta?? t?? CPU ?a? t??
s?s?e??? I/O ?e???? ap? t?? CPU, µ???? ?ta? ?
s?s?e?? e??a? ?t??µ? ?a ep????????se? µe t?? CPU. - ? et??µ?t?ta t?? s?s?e??? ?a?????eta? ap? ??a
s?µa d?a??p??. - ? CPU apa?t? st?? apa?t?s? ??a d?a??p?
ap????e???ta? t?? ?at?stas? t?? (PC ??p) se µ?a
st??ßa ?a? st? s????e?a t? p????aµµa
d?a??ad??eta? st? ???t??a e??p???t?s?? p??
d?a?e????eta? t?? apa?t??µe?? µetaf???. - Se µ?a t?p??? efa?µ??? ??a p????? s?s?e??? I/O
e??a? s??dedeµ??e? st?? ?p?????st?, ?a? ???e
s?s?e?? e??a? ??a?? ?a p???a??se? µ?a apa?t?s?
d?a??p??. - ? p??t? d?e??as?a e? µ????? t?? s?st?µat?? e??a?
? e?a???ß?s? t?? p????e?s?? t?? d?a??p??. - ?p???e? p??fa??? ? p??a??t?ta p????? d?a??p?? ?a
apa?t?s??? ta?t?????? e??p???t?s?. - St?? pe??pt?s? a?t? t? s?st?µa p??pe? ep?s?? ?a
ap?fas?se? p??a s?s?e?? ?a e??p??et?se? ?at?
p??te?a??t?ta.
54???te?a??t?ta d?a??p??
- ??a s?st?µa µe p??te?a??t?ta d?a??p?? e??a??st?
p??te?a??t?te? µeta?? t?? d?af???? p???? d?a??p??
??a ?a ap?fas??e? p??a ?a e??p??ete? p??t? ?ta?
d?? ? pe??ss?te?e? apa?t?se?? f??s??? ta?t?????a.
- ?? s?st?µa p??pe? ep?s?? ?a ap?fas?se? p??e?
?atast?se?? ?a µp????? ?a d?a??pt??? t??
?p?????st? ?a??? a?t?? ?a e??p??ete? µ?a ????
d?a??p?. - St? ?????te?? ep?ped? p??te?a??t?t?? ß??s???ta?
e?e??e? ?? apa?t?se?? ??a t?? ?p??e? ?p??ad?p?te
?a??st???s? ? d?a??p? µp??e? ?a ep?f??e?
s?µa?t???? s???pe?e?. - ?? s?s?e??? µe ?????? ta??t?te? µetaf????, ?p??
?? d?s??? ????? ????? p??te?a??t?ta, e?? a????
s?s?e???, ?p?? t? p???t??????? ?aµß????? ?aµ???
p??te?a??t?ta.
55?e???de?s? (Polling)
- ? ep?ß??? p??te?a??t?t?? ??a t?? ta?t?????e?
d?a??p?? µp??e? ?a ???e? µ?s? ????sµ???? ?
??????. - ? d?ad??as?a t?? pe???de?s?? e??a? µ?a te?????
p?? d?ap?st??e? t?? ?at?stas? t?? ?????? µ?s?
epa?a?aµßa??µe???, ?at? ta?t? ??????? d?ast?µata,
e?????? ???e s?s?e???. - ???s?µ?p??e?ta? ??a ?a p??sd????se? t?? p??? t??
d?a??p?? µe t?? ?????te?? p??te?a??t?ta µe
µe??d??? ????sµ????. - ? pe???de?s? ???s?µ?p??e? µ?a ????? d?e????s?
e?????s?? ??a ??e? t?? d?a??p??. ?? p????aµµa p??
d?a?e????eta? t?? d?a??p?? pe???de?e? µe t? se???
???e p????e?s? d?a??p??. ? se??? µe t?? ?p??a
a?t?? e??????ta? ?a?????e? t?? p??te?a??t?ta ???e
d?a??p??. - ? p????e?s? t?? d?a??p?? µe t?? ?????te??
p??te?a??t?ta e????eta? p??t? ?a? a? ?p???e? s?µa
d?a??p?? ? ??e???? d?a??ad??eta? st?? a?t?st????
???t??a e??p???t?s??. ??af??et??? e????eta? ?
ep?µe?? ?.?.?.
56- ?ts? ? a????? ???t??a e??p???t?s?? ??a ??e? t??
d?a??p?? ap?te?e?ta? ap? ??a p????aµµa p??
e????e? t?? p??e?e?se?? t?? d?a??p?? ?a? st?
s????e?a d?a??ad??eta? se µ?a ? pe??ss?te?e?
???t??e? e??p???t?s??. - ?eta?? ???? t?? s?s?e??? p?? ep???µ??? ?a
d?a?????? t?? ?p?????st? ep????eta? e?e??? p??
a???e? st? s?s?e?? µe t? µe?a??te??
p??te?a??t?ta. - ?? µe?????t?µa a?t?? t?? µe??d?? ????sµ???? e??a?
?t? st?? pe??pt?s? p?? ?p?????? p????? d?a??p?? ?
p????? s?s?e??? t?? ?p???? ? ?at?stas? de?
a????e?, ? ?????? p?? apa?te?ta? ??a t??
pe???de?s? ?pe?ßa??e? t?? ????? p?? e??a?
d?a??s?µ?? ??a t?? e??p???t?s? t?? s?s?e??? ?/? ?
p???a?e?ta? s?µa?t??? ep?ß????s? (overhead) ?at?
t?? e?t??es?. - St?? pe??pt?s? a?t? ???s?µ?p??e?ta? µ?a hardware
priority interrupt unit ??a ?a ep?ta???e? t?
d?ad??as?a. - ? µ???da a?t? ?e?t????e? ?? ??a? ?e?????
d?a?e???st??.
57Hardware priority interrupt unit
- ???eta? a?t?se?? d?a??p?? ap? d??f??e? p????,
ap?fas??e? p??a ??e? t? µe?a??te?? p??te?a??t?ta
?a? te???? pa???e? µ?a apa?t?s? d?a??p?? st?
s?st?µa. - G?a t?? ep?t????s? t?? d?ad??as?a?, ???e p???
d?a??p?? d?a??te? t? d??? t?? d????sµa d?a??p??
??a t?? ape??e?a? p??sßas? st? d??? t?? ???t??a
e??p???t?s??. - ?ts? de? apa?te?ta? pe???de?s? µ?a ?a? ??e? ??
ap?f?se?? ?aµß????ta? ap? t? µ???da.
58?pe?e??as?a d?a??p?? ??????
- ? ??aµµ? d?a??p??, µ?a ??e?t???? s??des? µeta??
t?? board ?a? t?? epe?e??ast?, ?a??stata? e?e???
d??ad? s?s?e??? ?p?? ?????st??, pe??fe?e?a?? ?a?
e?e??t?? e?e???p????? µ?s? s?µ?t?? t? ??aµµ?
d?a??p?? ??a ?a p????f???s??? t?? epe?e??ast? ??a
t?? ?pa??? ??p???? ?e????t??. ?? pe??ss?te???
epe?e??ast?? pe??????? ??a? e?e??t? d?a??p?? p??
ta????µe? t?? d?a??p?? a?????a µe t??
p??te?a??t?t? t??? ?ts? ?ste ?? s?µa?t???? ?a
e??p??et???ta? p??te?. ?? ?p????pe? t??e?ta? se
???? a?aµ????. - ?f?? ? ??aµµ? d?a??p?? ???e? e?e???, ?
epe?e??ast?? ?????????e? t?? e?t??es? t??
t?????sa? e?t???? ?a? µet? pa?e? p??s????? t??
e?t??es? t?? t?????sa? d?e??as?a?, ap????e???ta?
a??et?? p????f???e? ?ts? ?ste ?a µp???se? st?
s????e?a ?a epa?af??e? t? d?e??as?a µe t?? s?st??
p????f???e? st??? ?ata????t??. ?????? ta ded?µ??a
a?t? ap????e??ta? se µ?a d?µ? ded?µ???? µe ???µa
PSW (Program Status Word). St?? a???te?t?????
Intel IA-32 a?t? ? ?at?stas? t?? d?e??as?a?
a?af??eta? ?? TSS (Task State Segment) ?a?
ap????e?eta? st? PCB (Process Control Block) t??
d?e??as?a?.
59- ? epe?e??ast?? µetaß?ß??e? t?? ??e??? st??
?at?????? d?a?e???st? d?a??p??. ???e t?p??
d?a??p?? s?s?et??eta? µe µ?a µ??ad??? t?µ? p??
???s?µ?p??e?ta? ap? t?? epe?e??ast? ?? de??t??
(index) st? d????sµa d?a??p?? (interrupt vector),
p?? e??a? ??a? p??a?a? de??t?? (array of
pointers) st??? d?a?e???st?? d?a??p??. ??
d????sµa d?a??p?? ß??s?eta? se pe????? t?? µ??µ??
p?? ?? d?e??as?e? de? ????? p??sßas?, ?ste ?a µ??
µp????? ?a t??p?p???s??? ta pe??e??µe?a. - ? ?e???st?? d?a??p?? e?te?e? t?? ?at?????e?
e?t???? p?? e?a?t??ta? ap? t?? t?p? t?? d?a??p??. - ?et? ap? t?? ????????s? t?? ?e???st? d?a??p??
epa?af??eta? ? d?e??as?a p?? e??e d?a??pe? (?
??p??a ep?µe?? d?e??as?a, a? ? p????a? ??e? ?d?
???e? µ?a e?a??a?? p?a?s??? (context swith)). - H d?e??as?a p?? e??e d?a??pe? (? ??p??a ep?µe??
d?e??as?a) e?te?e?ta?. ?? ?.S. e??a? ?pe????? ??a
t? p??a d?e??as?a ?a e?te?este? st? s????e?a. ?
s?µa?t??? a?t? ap?fas?, p?? ep??e??e? t? ep?ped?
e??p???t?s?? ???e efa?µ???? af??? t? d??µ?????s?
t?? epe?e??ast? (processor scheduling).
60?????ep?d?as? ?????? ?a? ?.S. ??a clock interrupts
61?etaf??? e?????? µ?s? d?a??p??
62?p??? t?? s?stat???? s?st?µat??
63???se?? s?st?µat?? (system calls)
- ? d?epaf? µeta?? t?? ?.S. ?a? t?? p????aµµ?t??
t?? ???st?? ????eta? µ?s? e??? s??????
e?tetaµ???? e?t???? extended instructions p??
pa???e? t? ?.S. - ??t?? ?? e?tetaµ??e? e?t???? e??a? pe??ss?te??
???st?? ?? ???se?? s?st?µat??, ?st?s? µp????? ?a
???p??????? ?a? µe ?????? t??p???. - G??f??ta? ?e???? se ???ssa assembly
- ?e???aµß????? ß?ß??????e? p?? pa?????? d?epaf?
?????? ep?p?d?? - ?p?????? t?e?? ?e????? µ???d?? p??
???s?µ?p?????ta? ??a t? µetaß?ßas? pa?aµ?t??? - ?etaß?ßas? pa?aµ?t??? se ?ata????t??.
- ?p????e?s? t?? pa?aµ?t??? se p??a?a st? µ??µ?.
- ?p????e?s? (push) t?? pa?aµ?t??? st? st??ßa
(stack).
64???se?? s?st?µat?? (2)
- ?a p?????µµata t?? ???st? ep?????????? µe t? ?.S.
?a? apa?t??? e??p???t?s? e?te???ta? ???se??
s?st?µat??. - Se ???e ???s? s?st?µat?? a?t?st???e? µ?a
?a????sµ??? ???st? d?ad??as?a t?? ?p??a µp?????
?a ?a??s??? ta p?????µµata t?? ???st?. - ? d?ad??as?a a?t? t?p??ete? t?? pa?aµ?t????
???s?? s?st?µat?? se µ?a ep??e?µ??? pe????? ?a?
st? s????e?a e?p?µpe? µ?a e?t??? trap (??a e?d??
???s?? p??state?µ???? d?ad??as?a?) ??a ?a
?e????se? t? ?.S. - ????? t? ?.S. a?a?t?se? t?? ??e??? µet? ap? t??
e?t??? trap, e?et??e? a? ?? pa??µet??? e??a?
ap?de?t??, ?a? a? e??a? e?te?e? t?? e??as?a.
65- ?ta? ? e??as?a te?e??se? t? ?.S. t?p??ete? ??a?
??d??? ?at?stas?? se ??a? ?ata????t?,
e?d?p????ta? ??a t?? ep?t??? e?t??es? ? ap?t???a
?a? e?te?e? µ?a e?t??? RETURN FROM TRAP , ??a ?a
ep?st???e? t?? ??e??? st? d?ad??as?a ß?ß????????. - St? s????e?a ? d?ad??as?a ß?ß???????? ep?st??fe?
s a?t?? p?? t?? ???ese, ep?st??f??ta? t?? ??d???
?at?stas?? sa? t?µ? µ?a? s????t?s??. - ? a???µ?? ?a? ? t?p?? t?? ???se?? s?st?µat??
d?af??e? sta ?.S.
66S????e?? ???se?? s?st?µat??
- ??µ??????a d?e??as???
- ??a?e???s? µ??µ??
- ??????s? ?a? e???af? a??e???
- ??s?d?? / ???d??
67Win32 API calls
68?s??s? - 4
- ?a pe??????ete t?? d?af???? µeta?? µ?a? ???s??
s?st?µat?? (system call) ?a? µ?a? ???s??
s????t?s?? ep?p?d?? ???st? (user level function
call). - ?a pe??????ete ta ß?µata ???e µ?a? ?a??? ?a? t??
t??p? p?? ???p?????ta?.
69??s?
- ??a s????t?s? ep?p?d?? ???st? e?te?e?ta? ap? µ?a
d?e??as?a ???st? st? d??? t?? ???? d?e????se??. - ? d?e??as?a ???st? ap????e?e? t? d??? t?? PC
- ???et??µ??e? ???? st? d??? t?? stack ??a t??
t?p???? µetaß??t?? p?? eµp?????ta? - ??te?e? t? s????t?s?
- ?et? t?? ep?st??f? ap? t? s????t?s?, t?? afa??e?
ap? t? stack ?a? s??e???e? µe t? s????t?s? ???s??
t??.
70- ??a ???s? s?st?µat?? e??a? µ?a d?ad??as?a p??
e?te?e? t? ?.S. ?ta? t??eta? se ?e?t?????a ap?
µ?a d?e??as?a ???st? µ?s? µ?a? d?a??p??. - ? d?e??as?a ???st? t?p??ete? t?? µetaß??t?? t??
???s?? s?st?µat?? st? stack - ? d?e??as?a ???st? e?p?µpe? µ?a d?a??p? ?a?
t??eta? se ?at?stas? a?aµ????. - ?a?e?ta? ? ???t??a e??p???t?s?? t?? d?a??p?? t??
?.S. ?a? ? ???s? s?st?µat?? e??p??ete?ta? ap? t?
?S - ?et? t?? ????????s?, t? ?S a????e? t?? ?at?stas?
t?? d?e??as?a? se ?t??µ? (ready) ?a? st? s????e?a
e?te?e?ta? ? d?e??as?a t?? d??µ?????t?.
71???se?? d?a??p?? se epe?e??ast?? Intel Pentium
- ? epe?e??ast?? µp??e? ?a ??ße? d?? e?d? s?µ?t??
d?a??p?? (interrupts) ?a? e?a???se??
(exceptions). - ?? d?a??p?? e??µe?????? t?? epe?e??ast? ?t?
s???ß? ??a ?e????? ? ?t? ??e? a????e? ? ?at?stas?
µ?a? e??te????? s?s?e???. ? a???te?t????? a?t?
e??a? ep?s?? ef?d?asµ??? µe software generated
interrupts ?a? ?? d?e??as?e? µp????? ?a t??
???s?µ?p???s??? ??a ?a e?te??s??? ???se??
s?st?µat??. - ?? e?a???se?? de?????? ?t? ??e? s?µße? ??p???
sf??µa, e?te st? ????? e?te ?? ap?t??esµa µ?a?
e?t???? ????sµ????. ? a???te?t????? a?t?
???s?µ?p??e? ep?s?? e?a???se?? ??a t?? p??s?????
d?a??p? µ?a? d?e??as?a?.
72??a??p??
73??a???se??
74?a?a?t???st??? t?? ?p?????st???? s?st?µ?t??
- ?? ?????p?? t?? ?.S. e?d?af????ta? ??a t??
ap?te?esµat??? e?????s? ?a? t?? s??t???sµ? t??
p???? se ??a ap?? ??. - ?? ?????p?? t?? d??t??? e?d?af????ta? ??a t??
ap?te?esµat??? ep????????a bµeta?? t??
?p?????st?? t?? d??t???. - ?? ?????p?? t?? ß?se?? ded?µ???? e?d?af????ta?
??a t?? pa???? ta?e?a? p??sßas?? se ???sµ??a
ded?µ??a (p?? ß??s???ta? a??µesa se te??st?a p?s?
ded?µ????) ?a? s???????? ??a t?? p??stas?a t??
a?e?a??t?ta? t?? ded?µ???? p?? µp??e? ?a
pa?ap????e? ap? t? p???ap?? ta?t?????? ???s?. - ?? ?????p?? t?? a???te?t?????? t?? ?p?????st??
e?d?af????ta? ??a t? s?ed?asµ? t?? epe?e??ast??
?ts? ?ste ?a ?e?t??????? ap?te?esµat??? µe t???
a??????µ???, t??? µeta???tt?st?? ?a? t?? d?µ??
ded?µ????.