Professional Documents
Culture Documents
payberah@yahoo.com
Contents
User Space "ernel Space &ile System Process 'ana(ement )evice )river 'emory 'ana(ement *et%or+in(
What is Kernel ?
'o-ules or sub.systems that provi-e the operatin( system /unctions. The 0ore o/ $S 1t is %ritten in 0
Contents
User Space "ernel Space &ile System Process 'ana(ement )evice )river 'emory 'ana(ement *et%or+in(
2
User Space "ernel Space )ata &lo% Bet%een User Space an"ernel Space
User Space
The User Space is the space in memory %here user processes run. This memory is above the "ernel.
1t inclu-es the rest o/ available memory. The system prevents one process /rom inter/erin( %ith another process. $nly "ernel processes can access a user process
Kernel Space
The "ernel Space is the space in memory %here all +ernel services are provi-e- via +ernel processes. The user has access to it only throu(h the system call.
System Call
User Space an- "ernel Space are in -i//erent spaces. !hen a System 0all is execute-7 the ar(uments to the call are passe- /rom User Space to "ernel Space.
Kernel Service
Contents
User Space "ernel Space &ile System Process 'ana(ement )evice )river 'emory 'ana(ement *et%or+in(
19
Contents
User Space "ernel Space &ile System Process 'ana(ement )evice )river 'emory 'ana(ement *et%or+in(
12
!ile System
1t is responsible /or storin( in/ormation on -is+ an- retrievin( an- up-atin( this in/ormation. The &ile System is accesse- throu(h system calls such as : open7 rea-7 %rite7 : ;xample :
!ile System
#Cont$%
0ontain in/ormation entere- into them by a user7 an application or : 'ana(e the catalo(in( o/ the /ile system Use- to access the peripheral -evices
)irectory &iles
!ile System
>
#Cont$%
>bin >etc ls
Tehran Polytechnic University
>-ev
: >usr
pin(
-ata.txt
Super &loc'
inode List
&loc' List
Boot Bloc+ : in/ormation nee-s to boot the system Super Bloc+ : &ile System Speci/ications
Si?e 'ax. number o/ /iles &ree bloc+s &ree ino-es
(node
;ach /ile has an ino-e structure that is i-enti/ie- by an i.number. The ino-e contains the in/ormation re@uire- to access the /ile. 1t -oesnAt contain /ile name.
(node
#Cont$%
irectories
!ile )ame
inode )umber
Contents
User Space "ernel Space &ile System Process 'ana(ement )evice )river 'emory 'ana(ement *et%or+in(
Process *ana+ement
The Unix $S is a time.sharin( system. ;very process is sche-ule- to run /or a perio- o/ time <time slice=. "ernel creates7 mana(es an- -eletes the processes
Process *ana+ement
#Cont$%
Tehran Polytechnic
University
1n the Unix system process 97 calle- the s%apper7 is al%ays assi(ne- to the process an0PU sche-uler. 1t mana(es the complete operation o/ process sche-ulin( an- s%appin(. Process 9 is create as a part o/ system boot.up. ;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 <Parent an- 0hil-=. ;ach process has a uni@ue i-enti/ier <Process 1)=.
Process *ana+ement
#cont$%
The tas+Bvector is an array o/ pointers to every tas+Bstruct -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
3
,ype o- Processes
Cunnin(
The process is either runnin( or it is rea-y to run. The process is %aitin( /or an event or /or a resource. The process has been stoppe-7 usually by receivin( a si(nal. This is a halte- process %hich7 /or some reason7 still has a tas+Bstruct -ata structure in 4 the tas+ vector.
!aitin(
Stoppe
Dombie
Contents
User Space "ernel Space &ile System Process 'ana(ement )evice )river 'emory 'ana(ement *et%or+in(
5
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 anpassin( it bac+ to the +ernel. Sen-in( -ata /rom the +ernel to the -evice. )etectin( an- han-lin( -evice errors.
6
,ype o- devices
0haracter -evices
A character <char= -evice is one that can be accesse- as a stream o/ bytes. ;xample : "eyboar-7 'ouse7 : A bloc+ -evice can be accesse- only as multiples o/ a bloc+7 %here a bloc+ is usually one +ilobyte o/ -ata or another po%er o/ . ;xample : -is+7 :
8
Bloc+ -evices
'aEor *umber
The maEor number i-enti/ies the -river associate- %ith the -evice. The minor number is use- only by the -river speci/ie- by the maEor numberF other parts o/ the +ernel -onGt use it. 1t is common /or a -river to control several -evices7 the minor number provi-es a %ay /or the -river to -i//erentiate amon( them.
,9
'inor *umber
evice
river #Cont$%
Contents
User Space "ernel Space &ile System Process 'ana(ement )evice )river 'emory 'ana(ement *et%or+in(
,
*emory *ana+ement
Physical memory is -ivi-e- into se(ments o/ e@ual si?e7 calle- pa(es. Type o/ memory:
S%ap
1t is a con/i(urable partition on -is+ treate- in a manner similar to memory. Processes s%appin( in an- out o/ memory on a recurrin( basis /ra(ment physical memory. 1t is impossible to (uarantee that exactly the same physical memory bloc+s %ill be available to a speci/ic process. Hirtual a--ress space solves this problem by assi(nin( conti(uous virtual memory bloc+s to a process. These bloc+s are mappe- to physical memory %hen a process is s%ap in7 an- to s%ap -evice memory %hen the process is s%appe- out.
,2
Hirtual memory
Contents
User Space "ernel Space &ile System Process 'ana(ement )evice )river 'emory 'ana(ement *et%or+in(
,4
)etwor'in+
The /irst inte(rate- communication capability in Unix %as -evelope- /or Ber+eley Unix 2. bs- as the soc+ets implementation. Soc+ets provi-e a pro(rammin( inter/ace /or net%or+in(.
Contents
User Space "ernel Space &ile System Process 'ana(ement )evice )river 'emory 'ana(ement *et%or+in(
,6
0uestion?
Tehran Polytechnic University
,8