8/12/2019 Linux Systm Architcture
1/39
1
Tehran
Polytechnic
University
Linux System Architecture
By : Amir Hossein [email protected]
8/12/2019 Linux Systm Architcture
2/39
Tehran
Polytechnic
University
Contents !hat is "ernel# "ernel Architecture $vervie%
User Space "ernel Space
"ernel &unctional $vervie% &ile System Process 'ana(ement )evice )river 'emory 'ana(ement *et%or+in(
8/12/2019 Linux Systm Architcture
3/39
,
Tehran
Polytechnic
University
What is Kernel ?
'o-ules or subsystems that provi-ethe operatin( system /unctions.
The 0ore o/ $S t is %ritten in 0
8/12/2019 Linux Systm Architcture
4/39
2
Tehran
Polytechnic
University
Contents !hat is "ernel# "ernel Architecture $vervie%
User Space "ernel Space
"ernel &unctional $vervie% &ile System Process 'ana(ement )evice )river 'emory 'ana(ement *et%or+in(
8/12/2019 Linux Systm Architcture
5/39
3
Tehran
Polytechnic
University
Kernel Architecture Overview
User Space "ernel Space
)ata &lo% Bet%een User Space an-"ernel Space
8/12/2019 Linux Systm Architcture
6/39
4
Tehran
Polytechnic
University
User Space The User Space is the space in memory
%here user processes run. This memory is above the "ernel.
t inclu-es the rest o/ available memory.
This Space is protecte-. The system prevents one process /rom
inter/erin( %ith another process. $nly "ernel processes can access a user
process
8/12/2019 Linux Systm Architcture
7/39 5
Tehran
Polytechnic
University
Kernel Space The "ernel Space is the space in
memory %here all +ernel services areprovi-e- via +ernel processes.
The user has access to it only throu(hthe system call. A user process becomes a +ernel process
%hen it executes a system call.
8/12/2019 Linux Systm Architcture
8/39 6
Tehran
Polytechnic
University
System Call
User Space an- "ernel Space are in-i//erent spaces.
!hen a System 0all is execute-7 thear(uments to the call are passe- /rom
User Space to "ernel Space.
8/12/2019 Linux Systm Architcture
9/39 8
Tehran
Polytechnic
University
User Space and Kernel SpaceRelationship
UserProcess
Library Routine
Syscall ispatch
KernelService
UserSpaceKernelSpace
ata!low
8/12/2019 Linux Systm Architcture
10/39 19
Tehran
Polytechnic
University
Contents !hat is "ernel# "ernel Architecture $vervie%
User Space "ernel Space
"ernel &unctional $vervie% &ile System Process 'ana(ement )evice )river 'emory 'ana(ement *et%or+in(
8/12/2019 Linux Systm Architcture
11/39 11
Tehran
Polytechnic
University
Kernel !unctional Overview
&ile System Process 'ana(ement
)evice )river 'emory 'ana(ement *et%or+in(
8/12/2019 Linux Systm Architcture
12/39 1
Tehran
Polytechnic
University
Kernel !unctional Overview
8/12/2019 Linux Systm Architcture
13/39 1,
Tehran
Polytechnic
University
!unctional Layer "Architectural Layer
8/12/2019 Linux Systm Architcture
14/39
12
Tehran
Polytechnic
University
Contents !hat is "ernel# "ernel Architecture $vervie%
User Space "ernel Space
"ernel &unctional $vervie% &ile System Process 'ana(ement )evice )river 'emory 'ana(ement *et%or+in(
8/12/2019 Linux Systm Architcture
15/39
13
Tehran
Polytechnic
University
!ile System t is responsible /or storin( in/ormation
on -is+ an- retrievin( an- up-atin( thisin/ormation.
The &ile System is accesse- throu(hsystem calls such as : open7 rea-7 %rite7
;xample : &AT147 &AT,7 *T&S ext7 ext,
8/12/2019 Linux Systm Architcture
16/39
8/12/2019 Linux Systm Architcture
17/39
15
Tehran
Polytechnic
University
!ile System #Cont$%
>
>bin >etc >-ev >usr >home >root
ls pin( A B
-ata.txt pic.(i/
8/12/2019 Linux Systm Architcture
18/39
16
Tehran
Polytechnic
University
!ile System Structure
Boot Bloc+ : in/ormation nee-s to boot thesystem Super Bloc+ : &ile System Speci/ications
Si?e
'ax. number o/ /iles&ree bloc+s
&ree ino-es
ino-e List Bloc+ List :The /iles -ata
&oot&loc'
Super&loc'
inodeList
&loc'List
8/12/2019 Linux Systm Architcture
19/39
18
Tehran
Polytechnic
University
(node ;ach /ile has an ino-e structure that is
i-enti/ie- by an inumber. The ino-e contains the in/ormation
reuire- to access the /ile. t -oesnt contain /ile name.
8/12/2019 Linux Systm Architcture
20/39
9
Tehran
Polytechnic
University
(node #Cont$%
8/12/2019 Linux Systm Architcture
21/39
1
Tehran
Polytechnic
University
irectories
!ile)ame
inode )umber
8/12/2019 Linux Systm Architcture
22/39
Tehran
Polytechnic
University
Contents !hat is "ernel# "ernel Architecture $vervie%
User Space "ernel Space
"ernel &unctional $vervie% &ile System Process 'ana(ement )evice )river 'emory 'ana(ement *et%or+in(
8/12/2019 Linux Systm Architcture
23/39
8/12/2019 Linux Systm Architcture
24/39
2
Tehran
Polytechnic
University
Process *ana+ement#Cont$%
n the Unix system process 97 calle- thes%apper7 is al%ays assi(ne- to the process an-0PU sche-uler.
t mana(es the complete operation o/ processsche-ulin( an- s%appin(.
Process 9 is create as a part o/ system bootup. ;very other process in the system is create as
the result o/ a /or+system call. The /or+ system call splits a process into t%o
processes
8/12/2019 Linux Systm Architcture
25/39
3
Tehran
Polytechnic
University
Process *ana+ement#cont$%
;ach process is represente- by a tas+struct-ata structure. t contains the speci/ications o/ each process such
as: State Sche-ulin( in/ormation -enti/ier
The tas+vectoris an array o/ pointers to everytas+struct -ata structure in the system. This means that the maximum number o/ processes
in the system is limite- by the si?e o/ the tas+ vector
8/12/2019 Linux Systm Architcture
26/39
4
Tehran
Polytechnic
University
,ype o- Processes Cunnin(
The process is either runnin( or it is rea-y torun.
!aitin( The process is %aitin( /or an event or /or a
resource.
Stoppe-
The process has been stoppe-7 usually byreceivin( a si(nal.
Dombie This is a halte- process %hich7 /or some
reason7 still has a tas+struct -ata structure inthe tas+ vector.
8/12/2019 Linux Systm Architcture
27/39
5
Tehran
Polytechnic
University
Contents !hat is "ernel# "ernel Architecture $vervie%
User Space "ernel Space
"ernel &unctional $vervie% &ile System Process 'ana(ement )evice )river 'emory 'ana(ement *et%or+in(
8/12/2019 Linux Systm Architcture
28/39
6
Tehran
Polytechnic
University
evice river Associate- %ith each physical -evice or
virtual -evice is a piece o/ co-e7 calle--evice -river7 %hich mana(e the -evice
har-%are. The main /unctions o/ -evice -river:
Settin( up har-%are on initiali?ation. Brin(in( the associate- -evices into an- out
o/ services. Ceceivin( -ata /rom the har-%are an-
passin( it bac+ to the +ernel. Sen-in( -ata /rom the +ernel to the -evice.
)etectin( an- han-lin( -evice errors.
8/12/2019 Linux Systm Architcture
29/39
8/12/2019 Linux Systm Architcture
30/39
,9
Tehran
Polytechnic
University
*a.or )umber and *inor)umber
'aEor *umber The maEor number i-enti/ies the -river
associate- %ith the -evice.
'inor *umber The minor number is use- only by the -river
speci/ie- by the maEor numberF other parts o/the +ernel -onGt use it.
t is common /or a -river to control several-evices7 the minor number provi-es a %ay/or the -river to -i//erentiate amon( them.
8/12/2019 Linux Systm Architcture
31/39
,1
Tehran
Polytechnic
University
evice river #Cont$%
8/12/2019 Linux Systm Architcture
32/39
,
Tehran
Polytechnic
University
Contents !hat is "ernel# "ernel Architecture $vervie%
User Space
"ernel Space "ernel &unctional $vervie%
&ile System Process 'ana(ement )evice )river 'emory 'ana(ement *et%or+in(
8/12/2019 Linux Systm Architcture
33/39
,,
Tehran
Polytechnic
University
*emory *ana+ement Physical memory is -ivi-e- into
se(ments o/ eual si?e7 calle- pa(es. Type o/ memory:
Physical memory irtual memory S%ap memory
8/12/2019 Linux Systm Architcture
34/39
,2
Tehran
Polytechnic
University
/irtual and swap memory
S%ap t is a con/i(urable partition on -is+ treate- in a
manner similar to memory.
irtual memory Processes s%appin( in an- out o/ memory on a
recurrin( basis /ra(ment physical memory. t is impossible to (uarantee that exactly the same
physical memory bloc+s %ill be available to a speci/icprocess.
irtual a--ress space solves this problem byassi(nin( conti(uous virtual memory bloc+s to aprocess.
These bloc+s are mappe- to physical memory %hena process is s%ap in7 an- to s%ap -evice memory%hen the process is s%appe- out.
8/12/2019 Linux Systm Architcture
35/39
,3
Tehran
Polytechnic
University
Physical and /irtual memory
8/12/2019 Linux Systm Architcture
36/39
,4
Tehran
Polytechnic
University
Contents !hat is "ernel# "ernel Architecture $vervie%
User Space
"ernel Space "ernel &unctional $vervie%
&ile System Process 'ana(ement )evice )river 'emory 'ana(ement *et%or+in(
8/12/2019 Linux Systm Architcture
37/39
,5
Tehran
Polytechnic
University
)etwor'in+ The /irst inte(rate- communication
capability in Unix %as -evelope- /orBer+eley Unix 2.bs- as the soc+ets
implementation. Soc+ets provi-e a pro(rammin(
inter/ace /or net%or+in(.
8/12/2019 Linux Systm Architcture
38/39
8/12/2019 Linux Systm Architcture
39/39