Sei sulla pagina 1di 19

Linux 2.

0
Released in June 1996, 2.0 added two major new capabilities:
Support or multiple arc!itectures
"mpro#ed memor$%mana&ement code
"mpro#ed '()*") perormance
'!e Linux S$stem
'!e min s$stem libraries were started b$ t!e +,- project, wit! impro#ements
pro#ided b$ t!e Linux communit$
'!e Linux s$stem is maintained b$ a loose networ. o de#elopers collaboratin& o#er t!e
"nternet, wit! a small number o public tp sites actin& as de acto standard
repositories.
Linux /istributions
Standard, precompiled sets o pac.a&es, or distributions, include t!e basic Linux
s$stem, s$stem installation and mana&ement utilities, and read$%to%install pac.a&es o
common -,"0 tools
Red Hat and Debianare are popular distributions rom commercial and noncommercial
sources, respecti#el$.
'!e Red 1at )ac.a&e 2ana&er 3R)24 permits compatibilit$ amon& t!e #arious Linux
distributions.
Linux Licensin&
'!e Linux .ernel is distributed under t!e +,- +eneral )ublic License 3+)L4, t!e
terms o w!ic! are set out b$ t!e 5ree Sotware 5oundation.
6n$one usin& Linux, or creatin& t!eir own deri#ati#e o Linux, ma$ not ma.e t!e
deri#ed product proprietar$.
/esi&n )rinciples
Linux is a multiuser, multitas.in& s$stem wit! a ull set o -,"0%compatible tools
"ts ile s$stem ad!eres to traditional -,"0 semantics, and it ull$ implements t!e
standard -,"0 networ.in& model
2ain desi&n &oals are speed, eicienc$, and standardi7ation
(omponents o a Linux S$stem
Li.e most -,"0 implementations, Linux is composed o t!ree main bodies o code.
'!e most important distinction between t!e .ernel and all ot!er components.
'!e .ernelis responsible or maintainin& t!e important abstractions o t!e operatin&
s$stem.
8ernel code executes in kernel mode wit! ull access to all t!e p!$sical resources o t!e
computer.
6ll .ernel code and data structures are .ept in t!e same sin&le address space.
'!e s$stem libraries deine a standard set o unctions t!rou&! w!ic! applications
interact wit! t!e .ernel.
"mplement muc! o t!e operatin&%s$stem unctionalit$ t!at does not need t!e ull
pri#ile&es o .ernel code
'!e s$stem utilities perorm indi#idual speciali7ed mana&ement tas.s
8ernel 2odules
'!ese are sections o .ernel code t!at can be compiled, loaded, and unloaded
independent o t!e rest o t!e .ernel
6 .ernel module ma$ t$picall$ implement a de#ice dri#er, a ile s$stem, or a
networ.in& protocol
'!e module interace allows t!ird parties to write and distribute, on t!eir own terms,
de#ice dri#ers or ile s$stems t!at could not be distributed under t!e +)L.
8ernel modules allow a Linux s$stem to be set up wit! a standard, minimal .ernel,
wit!out an$ extra de#ice dri#ers built in.
'!ree components to Linux module support:
o module mana&ement
o dri#er re&istration
o conlict resolution
Sc!edulin&
'!e job o allocatin& ()- time to dierent tas.s wit!in an operatin& s$stem
9!ile sc!edulin& is normall$ t!ou&!t o as t!e runnin& and interruptin& o processes
"n Linux, sc!edulin& also includes t!e runnin& o t!e #arious .ernel tas.s
Runnin& .ernel tas.s encompasses bot! tas.s t!at are re:uested b$ a runnin& process
and executin& internall$ on be!al o a de#ice dri#er
Sc!edulin& al&orit!m ;preempti#e, priorit$%based.
)rocess Sc!edulin&
Linux uses two process%sc!edulin& al&orit!ms:
6 'ime%s!arin& al&orit!m
o or air preempti#e sc!edulin& between multiple processes.
6 real%time al&orit!m
o or tas.s w!ere absolute priorities are more important t!an airness
6 process<s sc!edulin& class deines w!ic! al&orit!m to appl$
5or time%s!arin& processes,
o Linux uses a prioriti7ed, credit based al&orit!m.
o '!e creditin& rule (redit = (redit * 2 > )riorit$
5actors in bot! t!e process<s !istor$ and its priorit$.
'!is creditin& s$stem automaticall$ prioriti7es interacti#e or "*?%bound processes
Linux implements t!e 5"5? and Round%Robin Real%'ime Sc!edulin& classes@
o "n case, eac! process !as a priorit$ in addition to its sc!edulin& class
'!e sc!eduler runs t!e process wit! t!e !i&!est priorit$@ or e:ual%priorit$ processes, it
runs t!e process waitin& t!e lon&est.
5"5? processes continue to run until t!e$ eit!er exit or bloc..
6 round%robin process will be preempted ater a w!ile and mo#ed to t!e end o t!e
sc!edulin& :ueue, so t!at round%robin& processes o e:ual priorit$ automaticall$ time%
s!are between t!emsel#es
2ana&in& )!$sical 2emor$
'!e pa&e allocator allocates and rees all p!$sical pa&es
"t can allocate ran&es o p!$sicall$%conti&uous pa&es on re:uest
'!e allocator uses a budd$%!eap al&orit!m to .eep trac. o a#ailable p!$sical pa&es
"n a budd$ s$stem, t!e allocator will onl$ allocate bloc.s o certain si7es, and !as man$
ree lists, one or eac! permitted si7e.
'!e permitted si7es are usuall$ eit!er powers o two, or orm a 5ibonacci se:uence
suc! t!at an$ bloc. except t!e smallest can be di#ided into two smaller bloc.s o
permitted si7es.
9!en t!e allocator recei#es a re:uest or memor$, it rounds t!e re:uested si7e up to a
permitted si7e, and returns t!e irst bloc. rom t!at si7eAs ree list.
" t!e ree list or t!at si7e is empt$, t!e allocator splits a bloc. rom a lar&er si7e and
returns one o t!e pieces, addin& t!e ot!er to t!e appropriate ree list.
9!en bloc.s are rec$cled, t!ere ma$ be some attempt to mer&e adjacent bloc.s into
ones o a lar&er permitted si7e.
'o ma.e t!is easier, t!e ree lists ma$ be stored in order o address.
'!e main ad#anta&e o t!e budd$ s$stem is t!at its implementation is c!eap because t!e
Bbudd$B o an$ ree bloc. can be calculated rom its address.
A binary buddy heap before allocation
A binary buddy heap after allocating a 8 kB block
A binary buddy heap after allocating a 10 kB block; note the 6 kB asted because of rounding up
5or example, an allocator in a binar$ budd$ s$stem mi&!t !a#e si7es o 16, C2, 6D,... 6D
.E.
"t mi&!t start o wit! a sin&le bloc. o 6D .E.
" t!e application re:uests a bloc. o F .E, t!e allocator would c!ec. its F .E ree list
and ind no ree bloc.s o t!at si7e.
"t would t!en split t!e 6D .E bloc. into two bloc. o C2 .E, split one o t!em into two
bloc.s o 16 .E, and split one o t!em into two bloc.s o F .E.
'!e allocator would t!en return one o t!e F .E bloc.s to t!e application and .eep t!e
remainin& t!ree bloc.s o F .E, 16 .E, and C2 .E on t!e appropriate ree lists.
" t!e application t!en re:uested a bloc. o 10 .E, t!e allocator would round t!is
re:uest up to 16 .E, and return t!e 16 .E bloc. rom its ree list, wastin& 6 .E in t!e
process.
6 5ibonacci budd$ s$stem mi&!t use bloc. si7es 16, C2, DF, F0, 12F, 20F,... b$tes, suc!
t!at eac! si7e is t!e sum o t!e two precedin& si7es. 9!en splittin& a bloc. rom one
ree list, t!e two parts &et added to t!e two precedin& ree lists.
6 budd$ s$stem can wor. #er$ well or #er$ badl$, dependin& on !ow t!e c!osen si7es
interact wit! t$pical re:uests or memor$ and w!at t!e pattern o returned bloc.s is.
'!e roundin& t$picall$ leads to a si&niicant amount o wasted memor$, w!ic! is
called internal ra&mentation.
'!is can be reduced b$ ma.in& t!e permitted bloc. si7es closer to&et!er.
2emor$ allocations in t!e Linux .ernel occur eit!er staticall$ 3dri#ers reser#e a
conti&uous area o memor$ durin& s$stem boot time4 or d$namicall$ 3#ia t!e pa&e
allocator4
9indows 0)
C2%bit preempti#e multitas.in& operatin& s$stem or "ntel microprocessors
8e$ &oals or t!e s$stem:
o portabilit$
o securit$
o multiprocessor support
o extensibilit$
o compatibilit$ wit! 2S%/?S and 2S%9indows applications.
-ses a micro%.ernel arc!itecture
6#ailable in our #ersions, )roessional, Ser#er, 6d#anced Ser#er, ,ational Ser#er
1istor$
"n 19FF, 2icrosot decided to de#elop a Gnew tec!nolo&$H 3,'4 portable operatin&
s$stem.
?ri&inall$, ,' was supposed to use t!e ?S*2 6)" as its nati#e en#ironment but durin&
de#elopment ,' was c!an&ed to use t!e 9inC2 6)", relectin& t!e popularit$ o
9indows C.0.
/esi&n )rinciples
Ixtensibilit$ J la$ered arc!itecture
o Ixecuti#e, w!ic! runs in protected mode, pro#ides t!e basic s$stem ser#ices
o ?n top o t!e executi#e, se#eral ser#er subs$stems operate in user mode
o 2odular structure allows additional en#ironmental subs$stems to be added
wit!out aectin& t!e executi#e
)ortabilit$ J0) can be mo#ed rom on !ardware arc!itecture to anot!er wit!
relati#el$ ew c!an&es
o 9ritten in ( and (>>
o )rocessor%dependent code is isolated in a d$namic lin. librar$ 3/LL4 called t!e
G!ardware abstraction la$erH 316L4
Reliabilit$ J0) uses !ardware protection or #irtual memor$, and sotware protection
mec!anisms or operatin& s$stem resources
(ompatibilit$ J applications t!at ollow t!e "III 100C.1 3)?S"04 standard can be
complied to run on 0) wit!out c!an&in& t!e source code
)erormance J0) subs$stems can communicate wit! one anot!er #ia !i&!%
perormance messa&e passin&
o )reemption o low priorit$ t!reads enables t!e s$stem to respond :uic.l$ to
external e#ents
o /esi&ned or s$mmetrical multiprocessin&
"nternational support J supports dierent locales #ia t!e national lan&ua&e support
3,LS4 6)"
0) 6rc!itecture
La$ered s$stem o modules
)rotected mode J 16L, .ernel, executi#e
-ser mode J collection o subs$stems
o In#ironmental subs$stems emulate dierent operatin& s$stems
o )rotection subs$stems pro#ide securit$ unctions
/epiction o 0) 6rc!itecture
S$stem (omponents J 8ernel

S$stem (omponents J 8ernel


5oundation or t!e executi#e and t!e subs$stems
,e#er pa&ed out o memor$@ execution is ne#er preempted
5our main responsibilities:
o t!read sc!edulin&
o interrupt and exception !andlin&
o low%le#el processor s$nc!roni7ation
o reco#er$ ater a power ailure
8ernel is object%oriented, uses two sets o objects
o dispatcher ob!ects control dispatc!in& and s$nc!roni7ation 3e#ents, mutants,
mutexes, semap!ores, t!reads and timers4
o control ob!ects 3as$nc!ronous procedure calls, interrupts, power noti$, power
status, process and proile objects4
8ernel J )rocess and '!reads
'!e process !as a #irtual memor$ address space, inormation 3suc! as a base priorit$4,
and an ainit$ or one or more processors
'!reads are t!e unit o execution sc!eduled b$ t!e .ernel<s dispatc!er
Iac! t!read !as its own state, includin& a priorit$, processor ainit$, and accountin&
inormation
6 t!read can be one o six states: ready" standby" running" aiting" transition, and
terminated
8ernel J Sc!edulin&
'!e dispatc!er uses a C2%le#el priorit$ sc!eme to determine t!e order o t!read
execution
o )riorities are di#ided into two classes
'!e real%time class contains t!reads wit! priorities ran&in& rom 16 to C1
'!e #ariable class contains t!reads !a#in& priorities rom 0 to 1K
(!aracteristics o 0)<s priorit$ strate&$
o 'rends to &i#e #er$ &ood response times to interacti#e t!reads t!at are usin& t!e
mouse and windows
o Inables "*?%bound t!reads to .eep t!e "*? de#ices bus$
o (omplete%bound t!reads soa. up t!e spare ()- c$cles in t!e bac.&round
Sc!edulin& can occur w!en a t!read enters t!e read$ or wait state, w!en a t!read
terminates, or w!en an application c!an&es a t!read<s priorit$ or processor ainit$
Real%time t!reads are &i#en preerential access to t!e ()-@ but 0) does not &uarantee
t!at a real%time t!read will start to execute wit!in an$ particular time limit
o '!is is .nown as soft realtime
9indows 0) "nterrupt Re:uest Le#els

8ernel J 'rap 1andlin&


'!e .ernel pro#ides trap !andlin& w!en exceptions and interrupts are &enerated b$
!ardware o sotware
Ixceptions t!at cannot be !andled b$ t!e trap !andler are !andled b$ t!e .ernelAs
e#ception dispatcher
'!e interrupt dispatc!er in t!e .ernel !andles interrupts b$ callin& eit!er an interrupt
ser#ice routine 3suc! as in a de#ice dri#er4 or an internal .ernel routine
'!e .ernel uses spin loc.s t!at reside in &lobal memor$ to ac!ie#e multiprocessor
mutual exclusion
Ixecuti#e J ?bject 2ana&er
0) uses objects or all its ser#ices and entities@ t!e object man&er super#ises t!e use o
all t!e objects
o +enerates an object handle
o (!ec.s securit$
o 8eeps trac. o w!ic! processes are usin& eac! object
?bjects are manipulated b$ a standard set o met!ods, namel$ create, open, close,
delete, :uer$ name, parse and securit$
Ixecuti#e J ,amin& ?bjects
'!e 0) executi#e allows an$ object to be &i#en a name, w!ic! ma$ be eit!er permanent
or temporar$
?bject names are structured li.e ile pat! names in 2S%/?S and -,"0
0) implements a symbolic link ob!ect, w!ic! is similar to symbolic links in -,"0 t!at
allow multiple nic.names or aliases to reer to t!e same ile
6 process &ets an object !andle b$ creatin& an object b$ openin& an existin& one, b$
recei#in& a duplicated !andle rom anot!er process, or b$ in!eritin& a !andle rom a
parent process
Iac! object is protected b$ an access control list
Ixecuti#e J Lirtual 2emor$ 2ana&er
'!e desi&n o t!e L2 mana&er assumes t!at t!e underl$in& !ardware supports #irtual
to p!$sical mappin& a pa&in& mec!anism, transparent cac!e co!erence on
multiprocessor s$stems, and #irtual addressin& aliasin&
'!e L2 mana&er in 0) uses a pa&e%based mana&ement sc!eme wit! a pa&e si7e o D
8E
'!e 0) L2 mana&er uses a two step process to allocate memor$
o '!e irst step reser#es a portion o t!e process<s address space
o '!e second step commits t!e allocation b$ assi&nin& space in t!e 2000 pa&in& ile
Lirtual%2emor$ La$out

'!e #irtual address translation in 0) uses se#eral data structures


o Iac! process !as a page directory t!at contains 102D page directory entries o si7e
D b$tes
o Iac! pa&e director$ entr$ points to a page table w!ic! contains 102D page table
entries 3)'Is4 o si7e D b$tes
o Iac! )'I points to a D 8E page frame in p!$sical memor$
6 10%bit inte&er can represent all t!e #alues orm 0 to 102C, t!ereore, can select an$
entr$ in t!e pa&e director$, or in a pa&e table
'!is propert$ is used w!en translatin& a #irtual address pointer to a b$e address in
p!$sical memor$
6 pa&e can be in one o six states: #alid, 7eroed, ree standb$, modiied and bad
Lirtual%to%)!$sical 6ddress 'ranslation

10 bits or pa&e director$ entr$, 20 bits or pa&e table entr$, and 12 bits or b$te
oset in pa&e
)a&e 5ile )a&e%'able Intr$

K bits or pa&e protection, 20 bits or pa&e rame address, D bits to select a pa&in& ile,
and C bits t!at describe t!e pa&e state. L = 0
Ixecuti#e J )rocess 2ana&er
)ro#ides ser#ices or creatin&, deletin&, and usin& t!reads and processes.
"ssues suc! as parent*c!ild relations!ips or process !ierarc!ies are let to t!e particular
en#ironmental subs$stem t!at owns t!e process.
Ixecuti#e J Local )rocedure (all 5acilit$
'!e L)( passes re:uests and results between client and ser#er processes wit!in a sin&le
mac!ine.
"n particular, it is used to re:uest ser#ices rom t!e #arious 0) subs$stems.
9!en a L)( c!annel is created, one o t!ree t$pes o messa&e passin& tec!ni:ues must
be speciied.
o 5irst t$pe is suitable or small messa&es, up to 2K6 b$tes@ portAs messa&e :ueue is
used as intermediate stora&e, and t!e messa&es are copied rom one process to
t!e ot!er.
o Second t$pe a#oids cop$in& lar&e messa&es b$ pointin& to a s!ared memor$
section object created or t!e c!annel.
o '!ird met!od, called $uick L)( was used b$ &rap!ical displa$ portions o t!e
9inC2 subs$stem.
Ixecuti#e J "*? 2ana&er
'!e "*? mana&er is responsible or
o ile s$stems
o cac!e mana&ement
o de#ice dri#ers
o networ. dri#ers
8eeps trac. o w!ic! installable ile s$stems are loaded, and mana&es buers or "*?
re:uests
9or.s wit! L2 2ana&er to pro#ide memor$%mapped ile "*?
(ontrols t!e 0) cac!e mana&er, w!ic! !andles cac!in& or t!e entire "*? s$stem
Supports bot! s$nc!ronous and as$nc!ronous operations, pro#ides time outs or
dri#ers, and !as mec!anisms or one dri#er to call anot!er
5ile "*?

5ile S$stem
'!e undamental structure o t!e 0) ile s$stem 3,'5S4 is a %olume
o (reated b$ t!e 0) dis. administrator utilit$
o Eased on a lo&ical dis. partition
o 2a$ occup$ a portions o a dis., an entire dis., or span across se#eral dis.s
6ll metadata, suc! as inormation about t!e #olume, is stored in a re&ular ile
,'5S uses clusters as t!e underl$in& unit o dis. allocation
o 6 cluster is a number o dis. sectors t!at is a power o two
o Eecause t!e cluster si7e is smaller t!an or t!e 16%bit 56' ile s$stem, t!e
amount o internal ra&mentation is reduced
5ile S$stem J "nternal La$out
,'5S uses lo&ical cluster numbers 3L(,s4 as dis. addresses
6 ile in ,'5S is not a simple b$te stream, as in 2S%/?S or -,"0, rat!er, it is a
structured object consistin& o attributes
I#er$ ile in ,'5S is described b$ one or more records in an arra$ stored in a special
ile called t!e 2aster 5ile 'able 325'4
Iac! ile on an ,'5S #olume !as a uni:ue "/ called a ile reerence.
o 6D%bit :uantit$ t!at consists o a DF%bit ile number and a 16%bit se:uence
number
o (an be used to perorm internal consistenc$ c!ec.s
'!e ,'5S name space is or&ani7ed b$ a !ierarc!$ o directories@ t!e index root
contains t!e top le#el o t!e E> tree
5ile S$stem J Reco#er$
6ll ile s$stem data structure updates are perormed inside transactions t!at are lo&&ed
o Eeore a data structure is altered, t!e transaction writes a lo& record t!at
contains redo and undo inormation
o 6ter t!e data structure !as been c!an&ed, a commit record is written to t!e lo&
to si&ni$ t!at t!e transaction succeeded
o 6ter a cras!, t!e ile s$stem data structures can be restored to a consistent state
b$ processin& t!e lo& records
'!is sc!eme does not &uarantee t!at all t!e user ile data can be reco#ered ater a
cras!, just t!at t!e ile s$stem data structures 3t!e metadata iles4 are undama&ed and
relect some consistent state prior to t!e cras!
'!e lo& is stored in t!e t!ird metadata ile at t!e be&innin& o t!e #olume
'!e lo&&in& unctionalit$ is pro#ided b$ t!e 0) log file ser%ice
Securit$
Securit$ o an ,'5S #olume is deri#ed rom t!e 0) object model
Iac! ile object !as a securit$ descriptor attribute stored in t!is 25' record
'!is attribute contains t!e access to.en o t!e owner o t!e ile, and an access control
list t!at states t!e access pri#ile&es t!at are &ranted to eac! user t!at !as access to t!e
ile
Lolume 2ana&ement and 5ault 'olerance
5t/is., t!e ault tolerant dis. dri#er or 0), pro#ides se#eral wa$s to combine multiple
S(S" dis. dri#es into one lo&ical #olume
Lo&icall$ concatenate multiple dis.s to orm a lar&e lo&ical #olume, a %olume set
"nterlea#e multiple p!$sical partitions in round%robin as!ion to orm a stripe set 3also
called R6"/ le#el 0, or Gdis. stripin&H4
o Lariation: stripe set ith parity" or R6"/ le#el K
/is. mirrorin&, or R6"/ le#el 1, is a robust sc!eme t!at uses a mirror set J two
e:uall$ si7ed partitions on tow dis.s wit! identical data contents
'o deal wit! dis. sectors t!at &o bad, 5t/is., uses a !ardware tec!ni:ue called sector
sparing and ,'5S uses a sotware tec!ni:ue called cluster remapping
Lolume Set ?n 'wo /ri#es

Stripe Set on 'wo /ri#es

Stripe Set 9it! )arit$ on '!ree /ri#es

2irror Set on 'wo /ri#es

o 5ile S$stem J (ompression


'o compress a ile, ,'5S di#ides t!e ile<s data into compression units, w!ic! are bloc.s
o 16 conti&uous clusters
5or sparse iles, ,'5S uses anot!er tec!ni:ue to sa#e space
o (lusters t!at contain all 7eros are not actuall$ allocated or stored on dis.
o "nstead, &aps are let in t!e se:uence o #irtual cluster numbers stored in t!e
25' entr$ or t!e ile
o 9!en readin& a ile, i a &ap in t!e #irtual cluster numbers is ound, ,'5S just
7ero%ills t!at portion o t!e caller<s buer
)ro&rammer "nterace J )rocess 2ana&ement
)rocess is started #ia t!e (reate)rocess routine w!ic! loads an$ d$namic lin. libraries
t!at are used b$ t!e process, and creates a primary thread
6dditional t!reads can be created b$ t!e (reate'!read unction
I#er$ d$namic lin. librar$ or executable ile t!at is loaded into t!e address space o a
process is identiied b$ an instance handle
Sc!edulin& in 9inC2 utili7es our priorit$ classes:
o "/LIM)R"?R"'NM(L6SS 3priorit$ le#el D4
o ,?R26LM)R"?R"'NM(L6SS 3le#elF J t$pical or most processes
o 1"+1M)R"?R"'NM(L6SS 3le#el 1C4
o RI6L'"2IM)R"?R"'NM(L6SS 3le#el 2D4
'o pro#ide perormance le#els needed or interacti#e pro&rams, 0) !as a special
sc!edulin& rule or processes in t!e ,?R26LM)R"?R"'NM(L6SS
o 0) distin&uis!es between t!e foreground process t!at is currentl$ selected on t!e
screen, and t!e background processes t!at are not currentl$ selected
o 9!en a process mo#es into t!e ore&round, 0) increases t!e sc!edulin&
:uantum b$ some actor, t$picall$ C
'!e .ernel d$namicall$ adjusts t!e priorit$ o a t!read dependin& on w!et!er it is "*?%
bound or ()-%bound
'o s$nc!roni7e t!e concurrent access to s!ared objects b$ t!reads, t!e .ernel pro#ides
s$nc!roni7ation objects, suc! as semap!ores and mutexes
o "n addition, t!reads can s$nc!roni7e b$ usin& t!e 9ait5orSin&le?bject or
9ait5or2ultiple?bjects unctions
o 6not!er met!od o s$nc!roni7ation in t!e 9inC2 6)" is t!e critical section
6 iber is user%mode code t!at &ets sc!eduled accordin& to a user%deined sc!edulin&
al&orit!m
o ?nl$ one iber at a time is permitted to execute, e#en on multiprocessor
!ardware
o 0) includes ibers to acilitate t!e portin& o le&ac$ -,"0 applications t!at are
written or a iber execution model
"nter )rocess (ommunication
9inC2 applications can !a#e interprocess communication b$ s!arin& .ernel objects
6n alternate means o interprocess communications is messa&e passin&, w!ic! is
particularl$ popular or 9indows +-" applications
o ?ne t!read sends a messa&e to anot!er t!read or to a window
o 6 t!read can also send data wit! t!e messa&e
I#er$ 9inC2 t!read !as its own input :ueue rom w!ic! t!e t!read recei#es messa&es
'!is is more reliable t!an t!e s!ared input :ueue o 16%bit windows, because wit!
separate :ueues, one stuc. application cannot bloc. input to t!e ot!er applications
)ro&rammer "nterace J 2emor$ 2ana&ement
Lirtual memor$:
o Lirtual6lloc reser#es or commits #irtual memor$
o Lirtual5ree decommits or releases t!e memor$
o '!ese unctions enable t!e application to determine t!e #irtual address at w!ic!
t!e memor$ is allocated
6n application can use memor$ b$ memor$ mappin& a ile into its address space
o 2ultista&e process
o 'wo processes s!are memor$ b$ mappin& t!e same ile into t!eir #irtual
memor$
2emor$ 2ana&ement
6 !eap in t!e 9inC2 en#ironment is a re&ion o reser#ed address space
o 6 9in C2 process is created wit! a 1 2E default heap
o 6ccess is s$nc!roni7ed to protect t!e !eap<s space allocation data structures
rom dama&e b$ concurrent updates b$ multiple t!reads
Eecause unctions t!at rel$ on &lobal or static data t$picall$ ail to wor. properl$ in a
multit!readed en#ironment, t!e t!read%local stora&e mec!anism allocates &lobal
stora&e on a per%t!read basis
o '!e mec!anism pro#ides bot! d$namic and static met!ods o creatin& t!read%
local stora&e

Potrebbero piacerti anche