P. 1


|Views: 2|Likes:
Published by Gurpreet Kaur

More info:

Published by: Gurpreet Kaur on Dec 03, 2011
Copyright:Attribution Non-commercial


Read on Scribd mobile: iPhone, iPad and Android.
download as DOCX, PDF, TXT or read online from Scribd
See more
See less





In computer science, thrashing is a situation where large amounts oI computer resources are

used to do a minimal amount oI work, with the system in a continual state oI resource
contention. Once started, thrashing is typically selI-sustaining until something occurs to
remove the original situation that led to the initial thrashing behavior.
Usually thrashing reIers to two or more processes accessing a shared resource repeatedly
such that serious system perIormance degradation occurs because the system is spending a
disproportionate amount oI time just ,..0883 the shared resource. Resource access time
may generally be considered as wasted, since it does not contribute to the advancement oI
any process. This is oIten the case when a CPU can process more inIormation than can be
held in available RAM; consequently the system spends more time preparing to execute
instructions, than actually executing them.
Silly window syndrome is a type oI communications system thrashing.
0/it] Ov0rvi0
In modern computers, thrashing may occur in the paging system (iI there is not 'suIIicient'
physical memory or the disk access time is overly long), or in the communications system
(especially in conIlicts over internal bus access), etc. Depending on the conIiguration and
algorithms involved, the 974:5:9 and ,903. oI a system may degrade by multiple orders
oI magnitude.
In virtual memory systems, thrashing may be caused by programs or workloads that present
insuIIicient locality oI reIerence: iI the working set oI a program or a workload cannot be
eIIectively held within physical memory, then constant data swapping, i.e., thrashing, may
occur. The term was Iirst used during the tape operating system days to describe the sound
the tapes made when data was being rapidly written to and read Irom them. Many older low-
end computers have insuIIicient RAM (memory) Ior modern usage patterns and increasing
the amount oI memory can oIten cause the computer to run noticeably Iaster. This speed
increase is due to the reduced amount oI swapping necessary.
An example oI this sort oI situation occurred on the IBM System/370 series mainIrame
computer, in which a particular instruction could consist oI an execute instruction, which
crosses a page boundary, that the instruction points to a move instruction, that itselI also
crosses a page boundary, targeting a move oI data Irom a source that crosses a page
boundary, to a target oI data that also crosses a page boundary. The total number oI pages
thus being used by this particular instruction is eight, and all eight pages must be present in
memory at the same time. II the operating system allocates less than eight pages oI actual
memory in this example, when it attempts to swap out some part oI the instruction or data to
bring in the remainder, the instruction will again page Iault, and it will thrash on every
attempt to restart the Iailing instruction.
To resolve thrashing due to excessive paging, a user can do any oI the Iollowing.
1. Increase the amount oI RAM in the computer (generally the best long-term solution).
2. Decrease the number oI programs being run on the computer.
3. Replace programs that are memory-heavy with equivalents that use less memory.
The term is also used when a small set oI Iaster storage space, intended to be used to speed up
access to a larger set oI slower storage space, is accessed in a way that cancels out any
beneIits Irom the Iaster storage. An example oI this is .a.h0 thrashing, where main memory
is accessed in a pattern that leads to multiple main memory locations competing Ior the same
cache lines, resulting in excessive cache misses. This is most problematic Ior caches that have
low associativity.

Resource contention
lrom Wlklpedlaţ Lhe free encyclopedla
!ump Loť navlgaLlonţ search
In computer science, r0sour.0 .ont0ntion is a conIlict over access to a shared resource such
as random access memory, disk storage, cache memory, internal busses or external network
Resolving resource contention problems is one oI the basic Iunctions oI operating systems.
Various low-level mechanisms can be used to aid this, including locks, semaphores, mutexes
and queues.
Failure to properly resolve resource contention problems may result in a number oI problems,
including deadlock, livelock and thrashing.

hen reIerring to a computer, thrashing or /isk thrashing is a term used to describe when
the hard disk drive is being overworked by moving inIormation between the system memory
and virtual memory excessively. Thrashing is oIten caused w hen the system
does not have enough memory, the system swap Iile is not properly conIigured, or too much
is running on the computer and it has low system resources.
hen thrashing occurs, a user will notice the computer hard disk drive always working and a
decrease in system perIormance. Thrashing is bad on a hard disk drive because oI the amount
oI work the hard disk drive has to do and iI is leIt unIixed will likely cause an early Iailure oI
the hard disk drive.
To resolve hard disk drive thrashing, a user can do any oI the below.
Ŧ ncrease Lhe amounL of 8AM ln Lhe compuLerŦ
2Ŧ ecrease Lhe amounL of programs belng run on Lhe compuLerŦ
Ŧ Ad[usL Lhe slze of Lhe swap flle

hat is pag0 thrashing?
Some operating systems (such as UNIX or indows in enhanced mode) use virtual memory.
Virtual memory is a technique Ior making a machine behaves as iI it had more memory than
it really has, by using disk space to simulate RAM (random-access memory). In the 80386
and higher Intel CPU chips, and in most other modern microprocessors (such as the Motorola
68030, Sparc, and Power PC), exists a piece oI hardware called the Memory Management
Unit, or MMU.
The MMU treats memory as iI it were composed oI a series oI 'pages.¨ A page oI memory is
a block oI contiguous bytes oI a certain size, usually 4096 or 8192 bytes. The operating
system sets up and maintains a table Ior each running program called the Process Memory
Map, or PMM. This is a table oI all the pages oI memory that program can access and where
each is really located.
Every time your program accesses any portion oI memory, the address (called a 'virtual
address¨) is processed by the MMU. The MMU looks in the PMM to Iind out where the
memory is really located (called the 'physical address¨). The physical address can be any
location in memory or on disk that the operating system has assigned Ior it. II the location the
program wants to access is on disk, the page containing it must be read Irom disk into
memory, and the PMM must be updated to reIlect this action (this is called a 'page Iault¨).

Because accessing the disk is so much slower than accessing RAM, the operating system
tries to keep as much oI the virtual memory as possible in RAM. II you`re running a large
enough program (or several small programs at once), there might not be enough RAM to hold
all the memory used by the programs, so some oI it must be moved out oI RAM and onto
disk (this action is called 'paging out¨).
The operating system tries to guess which areas oI memory aren`t likely to be used Ior a
while (usually based on how the memory has been used in the past). II it guesses wrong, or iI
your programs are accessing lots oI memory in lots oI places, many page Iaults will occur in
order to read in the pages that were paged out. Because all oI RAM is being used, Ior each
page read in to be accessed, another page must be paged out. This can lead to more page
Iaults, because now a diIIerent page oI memory has been moved to disk.
The problem oI many page Iaults occurring in a short time, called 'page thrashing,¨ can
drastically cut the perIormance oI a system. Programs that Irequently access many widely
separated locations in memory are more likely to cause page thrashing on a system. So is
running many small programs that all continue to run even when you are not actively using
them. To reduce page thrashing, you can run Iewer programs simultaneously. Or you can try
changing the way a large program works to maximize the capability oI the operating system
to guess which pages won`t be needed. You can achieve this eIIect by caching values or
changing lookup algorithms in large data structures, or sometimes by changing to a memory
allocation library which provides an implementation oI malloc() that allocates memory more
eIIiciently. Finally, you might consider adding more RAM to the system to reduce the need to
page out.

llrsL of all Lhere ls a one senLence deflnlLlon of Þage 1hrashlng ( belleve someone posLed a slmllar
answer here)ť

Þage 1hrashlng only comes abouL when you use vlrLual Memory whlch requlres an MMu and ƍfoolsƍ
a process lnLo bellevlng LhaL lL has memory avallable Lhan acLual 8eal MemoryŦ Poweverţ lL requlres
Þage ManagemenL and an CS LhaL brlngs needed (accessed) pages from lsk Lo Memory Cn emand
(when Lhe process accesses a memory address LhaL ls currenLly on dlsk lL musL be read from dlsk Lo
real memory an *mapped* Lo LhaL processƌs memory address spaceŦ *Þage 1rashlng* occurs when
Lhe CSƌs Þage Manager (or leLƌs [usL say Lhe CS) ls spendlng more Llme or an excesslve amounL of
Llme *paglng ln and ouL* Lhan runnlng needed LasksŦ 1he process of paglng requlres subsLanLlal
processor LlmeŦ

ƍÞrograms LhaL frequenLly access many wldely separaLed locaLlons ln memory are more llkely Lo
cause page Lhrashlng on a sysLemŦ ƍ why ???

belleve Lhls would only be Lhe case ln processes LhaL access shared memoryŦ 1he Þage Manager
would be forced Lo flrsL make room for Lhe new page Lo be brlnged ln and Lhen brlng ln Lhe needed

MosL commonly Þage 1rashlng occurs wlLh hlgh acLlvlLy and Llme sllclng leadlng Lo Lhe runnlng
process belng Llmed ouL and a new process golng lnLo ƍrunnlngƍ sLaLe and requlrlng lLs pages Lo be
ƍswappedƍ Lo real memoryŦ 1hls ls whaL causes Wlndows Lo go lnLo a long delay whlle you see your
dlsk acLlvlLy llghL qulckly flashlngŦ

ƍSo ls runnlng many small programs LhaL all conLlnue Lo run even when you are noL acLlvely uslng
Lhemƍƍ why??

Lƌs noL Lhe slze of Lhe program ls Lhe amounL of memory Lhey useŦ As llLLle as Lwo or Lhree processes
can lead Lo Þage 1rashlng lf your ƍLlme sllceƍ ls shorL and each of Lhose processes access Lhelr vlrLual
memory ln a dlspersed formŦ

Visk trasing
In systems that use virtual memory, the resulting condition oI a hard drive being used
excessively Ior virtual memory because the physical memory (i.e., RAM) is Iull. (The
process oI moving data into and out oI virtual memory also is called swapping pages.) Disk
thrashing considerably slows down the perIormance oI a system because data has to be
transIerred back and Iorth Irom the hard drive to the physical memory.
A sure sign that your computer is thrashing is when an application stops responding but the
disk drive light keeps blinking on and oII. Thrashing is generally caused by too many
processes competing Ior scarce memory resources. To temporarily stop thrashing, you need
to terminate one or more applications. To stop it permanently, you need to install more main
Disk thrashing can result in permanent Iailure oI the hard drive; as the data is transIerred back
and Iorth, the hard drive??s read/write heads are subjected to considerable wear and tear.

943 .097.0-4:3/..08 9:8-03:80/-985.082:89-057080393 20247.9.250 039.088.:903897:.3/.8090.35.3/07 903897:.041/.7 9.3/997.:..01.. 807082.20920 1904507.:.79..7 9.24.9080889.3 .20 .1742..9.70.341901443    3.9435439894.83/:0940..79901.70941/.990259947089.24.4:/.:807.5.7941903897:.0841.79.9:8008820247  .03897:..09.5. 202473980.425:907 0307.9.289.425:907 3.7020247 0.84.3/4.99801.9.7093.73897:.07 .0-4:3/.425:907    #05.84:7.90-08943 907284:943    0.9.943  %47084.54:984205.9388902.73897:.317.0-4:3/.94 -73390702.84 ..748808.9.33897:.03989.9908.9902598948.5.9903897:.24:3941#390.8430.5.70.9:.80903:2-07415747.05747.0 -4:3/. .943.748808.4388941.748808.300.943.5.28-037:34390.943809 .4.9.94347/.906:.943 9.3:2-07415.:9 .05.3095.748808.7 %0949.095.9.7 94.

809411.943-09003908890220247  039088902 .097.0.147.:70945745077084.834.:/34.0880/3.7078094184078947.03..54708 2:9008 .08-034.425:9078..82.0 %7.:7041 90..%090728.0880/3..83 0702.:807349..0 30..7//8/7..83    ^S_ZY 03701077394.425:907 97.838-.08  0397.08820247 /88947..20 ..7//8/7.431.3 -0301981742901..9072:80/94/08.020.08894.:804190.425:907.70/7084:7..89078947.3/97./4.90.:80.8347/897.894/4.0 %7..990739.320247 8.7//8/7..:807..0308 708:9330.3/6:0:08  ..089.3:2-0741574-028  3...803889025071472..08:./8942:9502.0 7084:7.9438414507.3-0:80/94.0 .3/4..0 8.43903943574-0282.30947 /0..84:80/03.425:907.088..70..79:.08  #084...71.25041988.3/9.3/.9.085.838.3/42. 87:3334390.8 802.090.0.-:88084709073.5108349574507..74:84 0..097.9...  %47084.7//8/7. .8..3.431:70/ 479442:.0 4.7//8/7.084:9.04...5.0 3903/0/94-0:80/948500/:5 .8.87.:80/ /408349. ..7-003 90.43903943574-02884304190-./98 3.9.89078947.83 .9    W_[a^UWU[Z`WZ`[Z ¯J½ f  €  °nn½ f ¯½ °f–f° ¾ fn 3.884.84889027084:7.1:3.9..:78 .0.37084:7.83841903..08894..202470.3828.:/3/0.9438..07.028808 %882489574-02.93889028  '.3/.24:39 414790.088.07470/-24..30.425093147908..708:93..34190-04    °n f¾  f¯°€.° n¯½      n f¾  f¯°€½–f¯¾ °–°° n¯½   .07084:7.020247 39073..331472.3..0.8473./43. /0.0.439039438.0-0.0034:20247 90889028.7//8/7.3202474..0.

..3/!407! 0898..20247 .9.2090.35479434120247 90..37:310075747..32502039.097.30-0..289.90# 7. 5.3-0.9.5747.3/070 0..83 4:. 47-908 %04507.7.30.039 3.439..0980110. 5.85488-03# 14: 707:333.35..//32470#9490889029470/:.3/07390!&.0/900247..../3905.4.0/24/0 :80.8 -:83/885.:805.0/90!74.7:3335747.4393:0947: 5..-01470..28 8484204192:89-024.01.0/ 5.. ..0880/-90& %0&448390!9413/4:907090 20247870...08..3.0883# 904507.8-003:80/3905..28.05.705747..3.041202478 .08 5.3/32489490724/0732.08820247 390  .9020247:80/-905747.82:.3..84079.0841202479.70.03034:..02039 &39 47&  %0&970.0/.3 4.9820247..0/.//7088.09482:.//7088 %058.89 19:08808743 471 4:75747..439:4:8-90841.9388902 94:088..89049474.0/4:941#.2.943-7.943 988...3/0 805.04120247.79:.3344:5..0880247 ..70 034:5747.5.998.3390.2./394-0.2.090300/94 5.3.34:9  %04507.8479920 .5 47! %88.0.2478942.90/ ..   ©¾ ¾ € ¾f½€     .../1742/8394 20247 .0/90 58.84120247..74574.349075. .70....3.-.3 /7..90/  .:80.:0847 .9.20247.905.0 907029349-0034:#944/ .79:.3 970..93 889028098: .8070841 5.83 $4204507.3392:89-070..2 4780..438/07.870./11070395..08 2.0/4:9 %8. 4:29.0 1.9:708 4784209208-.28.0882.38...3/2.041..9-.95747.4190.397 .8830/1479 1904.- $48 7:3332./9424705.93889028 8:.:8034.4.04:9     .4.20247  '79:..097.79:.9433202474743/89.7/.079....070.88902 !747..819.02:89-05. 0 :8:.819070.//7088 8574.703 9094-0:80/147.-941904507.   $ 9-0300/0/ 4:..702470094.:98 -0.7.9.:73 47/079470.097.70/.83 .2882:9..943.088390/88842:.90705.9438..94390 5747.304:8  74:.:984.425480/41. .8.479283.:9   0.3394.3/42 .380 :8:..89..41#8-03:80/ 1470.80/4349020247..0:83 902 %470/:.39894...:9905071472.-4..3.82.382. .:80..70349.90/947010.9388902 970894005.9388902.0/94/8  %0574-02412.4.3/90!2:89-0:5/.8&473/48303..079204:75747..3/4394 /8 98.:984.088843/8 905..9388902970894:088.088478 8:.91706:039..202478.908202472470 011..0/4:9 0.90/4.//7088 ..897:.36:01472.

¯n  ¾f°.3 574.20247  0 # 81:  %0 574.3/.¾n¯¯°9f– @f¾°–nn¾–fnf° ¯ ¾n°– f °– °°°– ½n ¾¾ °–¯ f° f° ½n ¾¾–°–° °°°– ¾f f°  °–¾½f– ¾  ¾f½½  f¯ ¯ @¾¾fnf¾ ¾J° ¾–°f°– f ¾  ¾fn–n€f¾°–   ¾°°°–¯f°¾¯f½–f¯¾ffn°° °  ° °f °fn ¾°–  ¯ ""   ¾° ¾ € ½–f¯¾ f¯°€¯ ¯ ¾ ¾ f¾ ½n ¾¾ ¾ nf° f 9f– @f¾°–€ ¯ ¾n ¾¾f°  fn€¾ ½n ¾¾ ¾fnn ¾¾ f ¯ ¯°f ¾½ ¾ €¯    V_`^S_ZY 38890289..7. ¯° ¯f°  % ° ½n ¾¾fnn ¾¾ ¾f¯ ¯f  ¾¾f¾n °° ¾¯¾  f €¯ ¾  f¯ ¯f°&¯f½½ &f½n ¾¾ ¾¯ ¯f  ¾¾¾½fn &9f– @f¾°–&nn¾ °   ¾9f– .9...088.3/4:941.  ¾€f  ¾f° ¾ ° °n  €°°€9f– @f¾°–%   ¾¯ ° ½¾ f¾¯f f°¾   %   9f– @f¾°–°n¯ ¾f  °¾ If.20247  8:70839.90430472470.3/1479174290.0202477084:7.08808..438/07..:80/-9442.f°f– ¯ °f° f°f °–¾° %fnn ¾¾ %½f– ¾€¯¾.Df°  €¾  f½n ¾¾°  °–ff¾¯ ¯fff  f°fnf f.20247 90708:93.79:..894-0 97.7//7...83803.041.4250931478.0-03:80/ 0.88902-0.7//7..20247.79:.:809058..94389458708543/3-:990 /8/7.0949058..20247-0.3.0884124.0147.0/8.848.8380307.3/411 %7..3039 4:300/94389.43/94341.9:80.f°f–    €n €¾¯f ¯€ ° ½f–   °– °f°  ° °–° °  ½f–   .3.24702. ¯      ¾ 9f– .394..55.94:7.83 4:300/ 9490723.3 20247  .090058-3343.9438 %4894595072.f°f– %  ¾©¾¾f %¾¾½ ° °–¯ ¯ f° n ¾¾ f¯°€ ¯ &½f–°–°f° &f°°°°–° f¾¾ @ ½n ¾¾€½f–°–  ¾¾ ¾f°f ½n ¾¾¯    9–f¯¾f€  °fnn ¾¾¯f° ¾ ½ff nf°¾°¯ ¯f ¯   nf¾ ½f– f¾°–°f¾¾ ¯  """     ¾ °  nf¾ °½n ¾¾ ¾ffnn ¾¾¾f ¯ ¯ @ 9f– .55.:80/.5535.9.08 %4902547.3810770/-..425:907897.7894597.79:.-848/43905071472.83.08 8 97..

83.897. .30391.:704190.3708:935072.0870.897.3/1479 90.7//7.3810770/-./.9..0..7//7.890/.

708:-0.7900.3/90.7    .90/94.7./8.-00.438/07.

You're Reading a Free Preview

/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->