0 ratings0% found this document useful (0 votes) 54 views11 pagesUnit - 3
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here.
Available Formats
Download as PDF or read online on Scribd
tnt
Assemblfes , Thread and App domains
GH assemolies —
-FGgac
ate eee
fe Abp domain :
L_ process _ Concept
: Thread P aie a cc :
_L Mutexes
een ree, a + :“Assembly
An Assembly ts a basic building block o
sNet Framework appifcatiens - It fs baxtealy’
rb
Net _asse “May ov may wot b
eveurtabie fe they might erist as the
ereurtable (eve) file or dynamic Unk
Worory Cod ll) ft
sHet Support three Kind 0] anem ilies.
Teprivete shared —s® Satelite
; private Assembly as
Tt requires vé
_____ Separately in all application
\devs where we want to vse that
amembly's_ fonctionalities; usitluout eopying.,
_Commot acters the private anembly ©
Private assembly |
_have one ,» We
not requried to
sepaodtly iter ak
piwtion folders - Public Amenebly fs _
alvo ule — Shared Anenrbly » Oy one,
fy required in SyStem level ,
[there is no need Jo wpy the cisem bly
cto he applitadiow Jolder
— Trastat Tia GAC( Global Acolyte)GAC (evel Ascently Cuetec) “read
Re Global Assembly Cache (GAC) Fs a A -tmcad fs defined ax Ihe executfon path
folder in Windows diirectory to Store ol & program. Each Wead defines a
“he Nek assemblies that “are specifiiaug) —huique flew of, conhol +
clasignated to be shaved by att applitatiny —-) an application involves complicated
Creurted on A system: J aud Hime Consuming operations y then
° E J it fs often helput “to” Sed ajperat
T+ provide Secuuity Jo the amem dies cretutiou pets oy threads, wlth each
So-that ro one carn tamper ~Hhem. threat pesferming O. pordiaulan Job:
} \ System Thyeadings ad Cleus 7s used wht ted
We can register The axembly -fo globat Threads are lightwofglt procenses » Use oy
Qwembly cache by using qacutic 4hveads saves wart ge CPU ele |
commamct . qucel fcrease ef frcoucey oy an capplicaciou|
fin awembly must ave 0. Strong- Thread Life Cycle +
mame to be installed in the 9nd? ° Unst + FE fs the situation
when The Mmsfence Of fread fs Ceated but
= the Store methocl & not cated
Se : : Bit oie eh fF fs the situtiou when
ig the hed 1s redy #0 von And wafting CPU yele-
Tost sees Pree ——— oshe Not Eupnatie Slate whew . Sleep
: metiod 1S Called » Wert method Fs called ov
Blocked by Ifo operations
aa oTe Dead Stare + Thread is abortecl oy”
Completed ere tutte.we vu use Context ~ Obj ae
vet fe other Othe page.
oe
Coute xt ub used | Ato 9 roup bjects ey euit —
_sindlaxn requirement fer Hs
More than
we Must VIE
Server. Trow Ley metal to yedivect
Context, A conttrt Object mem be use:
Tausmit valve t/eo Web pages.
oO comainey an
he Net yontime _
as a conteline
The CLR can
appiicaHeu te
The CLR
_tonsideved ays
FOCeSS wich is bot
“Dovndary .
Use san AppDomat a
os Oo containey for_wode ancl data, just
fike we operating system _USes a procers
fer code and dada.
ght
allow the multiple. -Net
rou in O single
_AppDomas
fsolate each application domain
_ other applicatieu domain and
A figuration 5 Security 5 or
a yunming «Net app fiom
other application -
ore “generally. creakd by
Ap. >pDomat a
_Enterne+ Exploveya PP Domain
CreateDomeiue
using the.
When Qh AppDomai ig ho longer iy
vse, tH canbe vuloaded. 3
actin clans inoplements a
Set enable
events thot enable applicatfey
to Fespond —_ Wh sg
loased y wher an application domain
will be vuloaded, oy wh an i
unhoucalled
exeeptiou is _ thrown.
~_ comcepts - of,
~ auother
one ob ‘the powerful
Multithreading _ ts on
any Programming louguage -
Tt is_ basically thread based multiproceditn
Th this: procem , the program fs _ divided’
dnd these ports
executes concurrently
“ey simuttaneouly + ee et
The _beneftt of _Usin multfthreading in
a pregrew fs that Si maitnin, e
“wiilizatfen of the CPU of our syste.
A +hread.
is a leigntweiyht —sub-procers
thor
fqut shaxe yesourcea with
shread + That is why Pprogran
using multithrenctin g mechanism Huds
to cowume few’ space This yaseies
with —_ uutitajeing. ox fn that tare
Seperate _ menvory Ts abtocated fer
different tasks:
cicumscmuusaas nS-giws deo Wa onnteeey
ewhenever there fs a need fo¥ the thred to
execute fn O section of, code without the
a ony other Hed we make
use of .
“prvead
Locks. ~
The leck siakement 15 used to “fake
4he _mutuat-excdusion i:
“Te -time dur ing which the lock
ts active , the “thre that holds
he lock can again fake and _
release the lack. *
Point be noted that other thread
canner access the lock Quel f+ waft
___Unless ~the lock fs. Teleased - oe
cos a
Syriert
______ tock (exp) The “lock” ke werk |
£ is used to gera |
_Wredy eck fer_a single |
seek, 2 hvead
5 “week ts made to wait oF
~ Hocked uuifl the execute of the tnrene
—~yrak is atreddy exeorting im the secHou
tne lek is _
@ Making “use of Wek ts aq rusre joy
di Convenieut ‘way to handle +ne? i
weds tn maulithreading “programming:
eo The otk Ys “Telemed after the _
if fou of exeuritou of the thread
wuich fs already exearting in the stcton
_o} cade allowing te oth ex treads to
_ ereatte sme Secon of, codle-
ciscucmsusast OES
Leck rranaga Threads foser and mar
__pleasant: _ asMoniloy _ 3
A moniloy is a mechanism for ensuyigg>
Whe only one Thread at ct time may)
ke cunning, & ceytatn piece of Code}
Cevivieat SecHon) «A moanttor Nar 4 lock,”
ond only one thread at a me may
acquive tt
‘To von in certain blocks of Code sq
Wea must have acquired the
montioy A noowltor Js always
nvceferted wrth a Speciffc Object and 3
Caunot be cissocianted “from ov
*splaced wots that object -
Features of Moutfoy ¢
PTH is associated with an object
on cemand
© 4 Ts unbound , which mean
Com be catted cltvectHy from
Quy Context
© AN fnstance
Of The Monitor clay
Cousmot be
Creattd
Mouttor Clave Provides a mechanism
synchronizes accers ‘to objects.
Mouttoy claw is a collection of
methods that provides accers
so the Noritey amodated — WH a _
ret Lot object which is spedtted
Arswogh the mettod’s fest argument
The
“fra
“he
static
The claw _ provide ‘following method 7
© Monfioy « Enitr() - Acquires an excwsive leck
© Mouitor « Exit() — Reldose an exclusive leck
® Mouitod «© Pules()- Notifies “a tread inthe
Wwasling queue ef q Shange
Tw Me locked obfect™s stake
~@ Mouttor © Walt() —Releore tre Leck mma bse
we torrent “Oust TE
Teague Hae beck:
© Mouttor » Puler ALC) Neve ast walling snrends
© Moutiny « Tey Enter()— ARere He seaurh a
geelusive WEde Ow FE
Spedpied object
The Mouttor ‘aud Lock keyword are
App format — oly + we manage the lock
oud Keep tne reoultor Ss identifteation
Using an iwstantiaded object -
ciccumscmuuseat Ons4] 4ivose "ead er locky have been released,
the next “thread usaiting’ Ih the writer
veve pif any, ts_gy
jock, Ga soon.
_ for me thread « “In s'
“resource fs chan mged _Tnfrequenily + a
ReaderWriter Lock _ provides better throughput
how a simple one-ot-a-Hme becky
accen Ove rece
— epee Ond of Short duraHew.
Mul wit single
reader uot
aye blocked for “Teng as
ore “queued
hen a _Head _ RitaReaderLockHeld Get a vawe
Value for “Hie Hime out
_ © Eek (object) Betermive wetne
“Speed objed ts equa fo tue
re
we tnd
whewer he carrene ee
weld a _"reacter tock
he |
Mutex
_Muiex is a synchyonizattou primitive
, Anat yrants exclusive access to the
shaved Fesovrce +to_only One thread.
a tovead acquires “mutex y the!
second thread that wants to acquire
muitx js suspended Outil the
“pirst Hovead Jeosdieanes | the mute.
Con use’ ine Walt fondle swattoné
method to, )_ request the ownership of
a mutex
>
“The +nread that ons O muity Can
‘request the Same mukx iv repeated
CANS +0 WaltOne without bleckin
Ws exeautfon « However 3 the tnred ue
call the
o Helena Reader Lock) ‘Lock Gut _ derreme ts
vet objet |
ReleareMuity meted. =e same
__number _ oh times
a_ mutex
athe. mui is seid to be
cicuscmsTngeennsset to stgnaled ’ “aud. “the 7 net |
_ Waiting thread get ownerskih . > Thread posting is he procens of “creating
ae ton
a colle 9} threads during tne
__Mutues are of too type
~qritializatton | of a _multithyeactned applicatie.
i ten reusing nose “Head, fee new
4fosk Os and when required , i rd
Oh creating new tnreads- 7
used by — Anread in au proces
nat hes a Jweherence_ te, the _ Mutex
_Every Hhread iw the pool “hay a spedtfed
_ objet.
“given task » The | read retin to’
the pool dud walt for the nex *
evatgnment when the given 4 Auk is
Completed -_
2 Named, ee
HR operntin sy
Usually the Hrvead’ pool is requried
P
wher we have nore task thay
__ treads -
= as soon ay a thread eens is
7 ask will request the next Fak
feom the queve vretl aw “task *
how & been complettd
cicuscmsume@ennsrr
—j|. Task Queve ___ |
it
not need to be created from scratch -
do
oTvead pooling saves the CLR from _the
overhead of Creating an entirely new
ynread for every _ Shor! -lived task and |
reclaiming ffs resources once it dies.
© Thread peolng
_ slices _ according
sunning im the
“optimizes the “thread Hme
to the _omrent process _|
system.
“he +Net Fromework Ibrow include,
System. “Threading. Thread Pool eles, |-
Thread “enables a
several wi trout hawiiag to set
__the propertes_ sfor_ each thread
"@ Thread pooling ‘cau be employed ‘to fix
he _marimumt number _ of thread {or _
procening co paritudax “requests
- read peeling Traptoves the responce
fme of an appitation os threads ay
already. available in the thread peo|