Download as pdf or txt
Download as pdf or txt
You are on page 1of 10

•• • •

• •
•• ••
• •
Wh at is a Linux Device 0 riv er ?
1

. I

• Linux Device drivers are distinct ''bla ck boxe s'' that mak e a
., ·:. · particular piece of bard ware respond to a well-def ined inte rnal
\

programming interface.They completely hide the deta ils of ho\Y


the device \Yorks. ',.•· ~.'_,;'.;"'~</ ~1111!!1111 1'11,,.,,,..,-, ;:,cf"'"7""'~ ~ i', 1'1;' ..•-

\: {.Jser (App licati ons} ':

Devic e Driver-1 Devic e Drive r-2 Devi ce Driv er-3


L_ Linu x
Kern el

Hardw are-1 H.a rdwa. re-2 Hard ware -3


~i"c\ll:,:,":, ... ,
•• • •
• •
• •
•• ••
\
·,

• · - -_ l e'•;-
'

.·e •ier, U ~t~ a_~ ·vities~ e performed 6yme ~_-


~f ·sJa11darOiz~d caI1~~t11at_are indepe11dent of-:the=-~
! _1: ;I ·I ,. .-:?.,.. ----=- . = ~ ~ _ = _ -= _ _ ,9

. lC ~cbii,rcfr; 1napping~1hose ~alls to de,-~ice~spj!cific -~-~-~ --~~~-


·to•plii"tlmt act on real hardware is tl:1.en-ffie rOle of the_--"~
i18f,7
1ce·•d1ri1l1er
~- -= .""/ .,·1-q /:,11 rl",: f,'
j

,'

j fi 1 l I

corn ;::iu t er. Do you


·Keep Discard
j, I
- ' =' -;

~ -= ;--::_~-

,, ' I

l1 I
I.
I '
ii ;>~¥"-e1','1," -T-"" :, .
,1,

I I II -~ ., -
, I -;"¼•·=,e"c- - · - -
....::ce-c:i a;:c--

,_ _ - - -=---
",,.-.- --~.,__

::,Jter Do /GJ
Keep Discard
- ' ' ' I I" T9'1 lmi·~· ~i : '-~r"'' I I" ,

11l11/1 I 11 111111 11,11/111111lil111i'1· I1, I


•• • •
II " ',i I
• •
• •
System I

I
11

I
I
l'Vl :e n 11111, ,1,1. ,11 t~~ 1111, ·1,
l11 I I 11
,I
I

l1l!i "l r1 1 11, I, II"


•• ••
I• II I I I II " I 1, , 1

i:I~II
I I ·I I ' ' I, .

,.
, • Memory eons1Sts ,~f RuXM ~_Ra11cdomAccess Memory) cells, 1 1' '

. • . vvhose content~ 1Ca~m.'lr>e'al~oessed (i~e~ ,. fead and written to) at 1

1 {
r 'IL.d L . ,
r e, 1
reta. 11ed onl
· y tempo rar1·1y (.1.e. ,
extrem 1
e y 11g~1
1

,spee /

S,1,
ut1t a. i i1 1
11 *

·1 . ' I I I j-; 1 tl
supp Iy re1nam. s Oil )'.
Wl11 'e ID uSr Of~ '~f fUOSt W u1e 1e powe
I /,
r
I

• Its purpo se iS' tb~o!d p~ograms and data that are curren tly in
use and thtjrJh1 s~tve as a high speed interm ediary betwe en the
1
''

CPU (ce11t1ral J~t<J1c~ssi11,g tutit) anti ·th:~ 11rit1cl1 s1<.)\.\ler storag e,~
1
1111

which most ~di~u~1,~11ily consists of.pne,,,oc inore haid disk d!riYes 1

(HDJ ) s). ' J 1


,
11
1 .L,,l'•,I
; I
• 1,
t ji I h !

• Syste111 1ne111ory jflii,LUJ¼ult1cain·t~r~h1d~ ,intO t.''ll~ll distinct 1

regi<)11s: I(er11eJ s11a~e1,tl11!~I i l.l$:,eii~ j1


$J , ~
,.e, ~·, , 1

"fl i
I
I
I I 1/111
1
I
I
1
' 1/
'I': 11, ,I I I I
I1,1 11~
'I

I I

I /
I
I I I •',1/
'1 l
/, II II I

' I I
I
••
/ 1/ ./


' 1
,/
•·•
'ser Space
'

.
a ." .
~
Kernel Sp e d111' 1
11
,
I

I
1
1
11
11111I
ii
1/1/ll a·
I

II
1, , ,
1 1i/l
I II I

lr l i 111, u., / , ,,
, , ,1,
I Ii
I 1/


- -
- - - - - - - - ~-
• -
- -

- .
-- - •

111I I I/! I ii
p•r ov id es I
1
I ,I I, I 1/

d ii 1/
II
d~n&,,~ft11~11'~1
p er at in e. sv s,tem n1ns an
I ,I 1
11
I

,.eme·l space is wl1e1~e tl_1. e '-_ 111

• K,
~ - • -- -
•,
1 . I
J'
- 11 · ,, J /, •/11 ~~ 1'~ , 1: ,t"'I"" I I _,

its services.
11 1
11 111, , ' , ,, I 11
1 I I

,,,ru c
. h (i. e. ,
I

oc e
, ss es
'

pr
_;.

13 r lo 9,t io 11 S in 11 ser
• User space is tl1a.t se t of 1n~irno
11 1e l) A p1 1io ces s is a11 execut.it1g. iti st an ce o
evef)lthin_g ot11er tl1at1 t11e ke 111.'.fl.
1

s of tl1 e k en .1e l is ,to 11.1an a


. ge it1di vi dt1 aJ us er ,,

progrrun._One of tl1e role


1
1

tl1 e1 n ot11 m te rf er in g ,v ith eacJ1


processes withi11 tJhis s11ace ,a 11Cil. to 11 re, e11t fi" 1

od1er~ I
IUI ,I
se.r S'p ac e
II

J(e rn I
e_ ·
Sp ac e I· ,1
I ' 1
/

II I IIIi 11 I I I

1
1
, ~11~~11'" J11roc:,~1sses
Co re Kerne) Ru ns I I IJJ 1S
1'/ ,1 ,, I ~li0
I 1
' I
~~~~~~~~~
I!
I I
I I / I

I I '
II

I I' I

l'l11\ M
1

1
~:1, ,\ J.k,1111I" ,,,rt,v
~~/t1,eir1w
S1 , ., 1 / I 1/
1' /
I (
I 1
,)
1I
, i1

, I I
•• • •
• •
•• ••
Kernel S ••
-

I I I I I II II Ii IIi,'il ,I,, / I',l'.i' i'i I ,1 1,/' i N 11 'i' I II I

,,,,1, 1,1 i'11i'1' I 1'11II I 11I Ii' I11,1I l'i' ·i'1I I ,1 I II I


I I I 1' I1 ' 11 '1' 11
I I/ 1 1, 1' ' 11 I I I

1 1
ii, , !i' I ,1 i'r' 1''" I ii I i'1l,1" 11,I I I I'
Ij ,1'i' ,,,, ,I I/' "'' I

' I

~t~s,¢~i',i1t, ,, i1,s,e.r processes on1y th ro ug h


~I, I i' I I I 'I i' I I I I

·• K e1 ne l sp ac e oa p l i~'/1l1 I I/ I / it~~ r~'~


1

-
·

~a l sl
/'

rS ,rS
I
1
,t /eii
1111/

D/ ca ll$ ar e
11
re qu es ts in a U ni x- like
11

th e us e of sysi~w 11' " i ' '"' i'·'


'r l~, 1 q~ ),a 0t iy e pF oc es s fo r a se rv ic e pe rf or m ed I I'

op er,a tin g syste1n


1

I
ch
I I

ib pU tlo ut J) ut (Y O ) or pr oc es s cr ea tio n.
by th e ke rn el . su I I' I '8 8 1

,I I I
I
~ tli ~t
I

i/:~ ' cu rr en tly pr og re ss in g in


• A n ac tiv e pr oc,es's I lI 1 I Il ' )' pl ·q, f~ ~s 1
~
.
f..or its
1s ,va1tm2
I '' ;1
at·
• -

tJ1

1 ii ~11 m~,1~(~S '1t S


4
I I I
,s
I "

th e C PU " as '

cc.1.1 i
it11 ,~.1
I'! :~, ~ Ci \,
1 \ t 1 l I~

r ".n ,~ r 1 , , r 111
de- .
1

,..1
1

1,,1 · , , '4,,..- ·

·
. - lr , I~~ I' rli t '
1 ..
,, ' 1 I,

at
1

io
1

n or · n
· ee
1
,! I i, ' ., . •

th e ·CPt J '. .~ C .r ,1 ~S ~i ll~ -,. pt 1@ gt~ ~p ~ op er


ne xt tu m in ~. ·1
1 111

I ', ' ~ ,v~ ':j ' . . . ... ·~ . . .


, I' '
i d,t
,
(?~ 1:
I/'
i i1 ,:1t t '~l ~ ,,J '~1 f
,rl~[ t0 or fi0 11 1 a pe np
r,, '
1e rn1 , ,1, ' ~-.. - , ,~
1
,,,
1
that tr an st er s da ta ,to ~
1

Ii'i' I :i i' I - . . .. • " -


I I! .I I I I

1
I I

~
I;

r; f
I ./ I I

,: t t1 te rs).
I

J,
I
I i1 1'

~l~
I

;t1 1
!~

~ : u in
Ii1

nd pr
I

ch as dr $ R
•I '

t1( ~1 S f' ij1 1~ e 'a


deYi ce l su I I I I ,,, i'il ~ I I II
1
I I l1 I I , , I I I I" I 'I I ' I

i' I I I 11 ,, , , " II I 1' 1' I I

I '1' 11 II I I,,,'1 11
J' I I
I ,I
I II ' 11 1 1
'1' ' ' '
1 I,I i1I
1
' I I 11 ,11,I
_ _ _,,,,. I " I
r I "i~

vers Part 2: Sy sten1 Men1ory, Stat ic rv1od ules and Dynar,1i c r··./lodu lf:<:;

••

• •
User Space and.Kernel Space •• ••

User Space
System c ,
11n.:1:!J::r '·;r,·::··'•
1

'\!: :.: ,'


1 '

' '

Device- 1 Device-2 Device-3

rnp~ter Do yGu
•• • •
• •
•• ••
Ke rnel Space ••
User Space and
i\ p p li ca ti o n Our Program
User- Space, Su p p o rt in g

! ! ! ! ! ! ! ! '! ! ! ! ! ! ! ! !-!. !-~-- ==~ L ib ra ry


!!!!!.!!!~~
!&§ b££

Linux:Kernel
- K e rne r Space
D ev ic e D ri v e rs J
H a rd \v a re

np urer Do ~'Ou
Keep Disca rd
' I I' \
I I
I

S ta ti c l\!lodules: T h e
s e are co1npiled as a p
a t a n y ti m e . T h e s e ro a rt o f the ken1el a11d
8.ke th e kernel la rg e r a n d h are av ailable
u s to re b u il d a n d re a s th e d is a d v a n ta g e o f
boot. th e k e rn e l every requiring
ti m e w e w a n t n e w :f unctionality.

·,~•,:r ·"' :r
'i;; · C o re K e rn e l fe a tu re s s ·M1
'
,, 1:
SM2
Ill U
I\,l,,, , ,,,,

S ta ti c Mo d u les

Keep Di sc a rd
•• ••
• •
I'
• •
Dynamic 11/1 ~,i j tl h!s 1
111
1 •• ••
Dyruuni~ Modules~l;i'.Jb~~ei~dules are pieces of code that can be loaded and
., '.. unloaded into the 'kem~l t1p,on de111and. They extend the functionality of the
1

· kernel without the 11eed tp reboot the system.


Dynamic Modules ,qave the advantage that it uses the Memory more
efficiently tha11 t1h e St atically linked drivers.
1

I 1I

I ,1 1 11111 11 '1 :'" ,•'•'" • - - - - -

111 Kernel Image

Core Kernel features

l
St<ltic Modules Dynan1i c
Modules
Keep Discard

You might also like