ILto

uctools  时间:2021-02-05  阅读:()
October25,2006AnewMonoGCPaoloMolarolupus@novell.
com2CurrentGC:whyBoehmPortedtothemajorarchitecturesandsystemsFeaturefullVeryeasytointegrateHandlesmanagedpointersinunmanagedlandSomesupportfortypedobjectsFinalizationsemanticsmostlymatchWeakreferencesHightlytunedThread-localalloc3CurrentGC:whynotWedon'tneedorusesomeofthefeaturesIncremental(handlingofsignals.
.
.
)Resourceusage(publicAPI)FinalizationsemanticsnotthesameasneededFinalizationofobjectsinvolvedincycles(whichorder)WeakreferencesupportTrackresurrectionHeapfragmentationZeroingoverhead(atomicalloc.
.
.
)Pausetimes4NewGC:needsExactfinalizationandweakreferencesemanticsSmallheapsizesandlow-pausetime(desktopapps)Objectpinning(automaticandAPI-controlled)Fastallocation(bump-pointerandinlinableinmanagedcode)LargeobjecthandlingPrecisetypetracking5NewGC:needs(continued)InteriorpointersonthestackAppdomainunloadissues(freealltheobjectsintheappdomain)Allocationofnon-movingobjects(internedstrings.
.
.
)Nicetotheuser(nobigmemorychunk)StillalloweasyembeddingofMonoKeepingtheonlyreferencetoamanagedobjectintheCstackisfineThreadsupport6ImplementationGenerationalOldgenerationandnursery(thenewgeneration)MovingFromthenurserytotheoldgenerationCompactingoftheoldgenerationStoptheworldcollectionLargeobjectspaceCollectedwithmark&sweepduringmajorcollectionsFixedheapForinternedstrings(andmaybelaterothertypes)Collectedwithmark&sweepduringmajorcollections7GetHashCode()Objectsnowcanmove,can'tusetheobjectaddressashashcodeDatastoredinthelockwordoftheheaderWhentheobjectislocked,thehashcodeismovedinsidethefatlockstructureLoad+check+shiftinthefastpathAdditionalcheck+loadotherwiseInterlockedopwhenfirstsettingthehashmono_object_hash()forruntimehashtables8PinnedobjectsHowtocreatethem:corlibAPI:GCHandleembeddingAPI:mono_gchandle_new(obj,TRUE)fixedC#statement(PINNEDflagforlocalILvars)duringP/InvokecallsAdditionalcasesobjectsandpointersfoundintheuntypedCstackoftheruntimeandembeddingapplicationsobjectstheruntimesdoesn'twanttomove(internedstrings,Threadobjects,currentlyTypehandles)Fewoftheminpractice9PinnedobjectissuesWillfragmenttheheapWillcausemorecollectionsWillslowdownallocationsandcollectionsMakesureyoupinobjectsonlywhenreallyneededandforaslittletimeaspossibleRuntimeenhancements:TypeinformationaboutregistersandmanagedstackframeswillallowtoconsiderthereferencedobjectsnotpinnedUnmanagedstackframeswillstillpinreferencedobjectsforhassle-freeruntimecodeandmonoembedding10Pinnedobjects:findingthemGivena(possiblyinterior)pointerObjectsareallocatedsequentiallyNeedtostartfromthebeginningofanheaparea,visitingeachobjectuntilthecorrectoneisfoundDuringallocation,every4KBsavetheobjectstart–Needtoscanatmost4KBofmemorytofindobject–4KBsizeissubjecttochange–ThepinningaddressesaresortedandthelastpinnedobjectiscachedsousuallythisscanningisveryfastWhenfoundsetthePINflagoraddtopinnedobjectsarray11ThenurseryMostobjectsbornhereTypically512KB-2MBforcommonappsServersmightwantseveralMbsBump-pointerallocationstyleFastandcanbeinlinedinmanagedcodeWhenfull,triggeraminorcollectionUnlessamajorcollectionisneeded(oldgenerationisfull,too)Dividedinsmallerchunksduetofragmentationorthread-localallocation12NurseryandpinningPinnedobjectsfragmentthenurseryChunksoffreenurseryspacebetweenpinnedobjectsusedforallocationsWhenthenurseryiscompletelypinned,allocateobjectsintheoldgenerationAlternativesinclude:enlargethenursery,allocateanewnurseryPinobjectsonlywhenaboslutelyneededforshortamoutsoftimeTrackreferencespreciselyonthestack13MinorcollectionStoptheworldIdentifypinningobjectsScantheroots(includingpinnedobjects)CopytooldgenerationasyougoPlacepointertonewcopyintheoldobject'splaceScanthecopiedobjects(theyareroots,too)Checkthefinalizationandweak-reflistsPreparefornewallocsRestarttheworldPokethefinalizerthread14StoppingtheworldNeededtonotallowthemutatorstoseenon-coherentdatainobjectsforwardingpointersflagsintheobjectheadertwocopiesofthesameobjectNosupportforsafepoints(yet)Implementedwithsignalswin32/OSXhaveproperOSsupportLessthan1msforheapsupto100MBon1.
6PMParallelizemajorcollectionlater15TherootsStaticmanagedvariablesRegisteredroots(runtimeandembeddingdatastrutcures)HandletablesRememberedsetsOld-generationobjectsreferencingnurseryobjectsPinnedobjectsRuntimestackNeedtypeinfoforregistersandmanagedstackframes16HowtocopyanobjectEnsurewehaveenoughroomintheoldgenerationWeneedtoensureeveryreferencepointstothenewobjectForeachpointerfieldobj.
field=copy_object(obj.
field);Placeaforwardingpointerintheheader–It'sthepointertothenewhomeoftheobjectIfanobjecthasaforwardingpointerit'salreadycopiedPinnedobjectsreturnthesamepointerincopy_object()17ThemarkingstackWeneedtorecursivelycopytheobjectsreferencedbycopiedobjectRecursionnotasafethingintheGCTheruntimestackcouldbeverysmallandtherecursionverydeepThecopiedobjectsareaisanexplicitstackOncetherootsarescanned,scanthecopiedarea,untilnomoreobjectsarecopiedGrayobjectsaremarkedbutthefieldshavenotbeentraced18FinalizationWhentherootsarescanned,thenon-copiedobjectsaregarbageunlesstheyarepinnedorneedfinalizationCopyfinalizableobjectstotheoldgenerationsotheysurviveRecursivelycopyfromtheirfields,tooLoopuntilnomorefinalizableobjectsarefounddeadPutfinalizableobjectsinaseparatelistWeak-refsdon'tneedcopyinghandledimmediately19PreparefornewallocsCreatelistoffreefragmentsinnurserymemsetthememoryto0bytestoomuchoverheaddoingitateachobjectalloctoomuchoverheaddoingitforthewholenursery–touchestoomuchmemoryandtrashesthedatacache–doitonlyafragmentatatimeweneedunusednurseryareastobezeroedbeforecollectionsforthepinned-objectsfindingalgorithmAssignfragmentstothreadstoeachasmuchastheyneed(andresourcesallow)20MajorcollectionCurrentlycopy-basedLaterusemark/copytoreducememoryrequirementsIdentifypinnedobjectsinthewholeheapRememberedsetsareclearedScantherootsasusualLargeandfixedobjectsarejustmarkedbysettingaflagintheobjectheaderSweepunmarkedobjectsFreeunusedsectionsFinalize/Prepare/Restart21ObjectsweepingWalkthelistoflargeobjectsandfreetheunmarkedonesUnsetthemarkflagfortheothersFixedobjectsareinpinnedchunksfreedbyputtinginafree-listunmarkedaswellBoththelargeobjectlistandthenumberoffixedobjectsshouldbesmall22MemorysectionsHeapdividedinsectionsMoreflexiblethanusingabigvirtualareaEasierfortheuserExpandsasneededFairtoothercodeinthesameprogramcompetingforvirtualaddressspaceOfcourseit'shardertoimplementsomeperformanceissueslikelythedefaulton64bitsystems(hugevirtualmemoryspace)23PinnedchunksDatastructureforGC-internaldataandforfixedobjectallocationOnlyforsmallobjectsEachpagehasobjectsofsamesizeAllocationusingfreelistsPageassignedtoasizeasneededLimitedfragmentationissues(fewsizes,mostlyruntimeandGC-controlled)Mini-BoehmGCincluded24LargeobjectsExpensivetomoveCurrentlyusedforobjectsize>=64KBCollectedonlyduringmajorcollectionsusingmarkandsweepAllocatedwithmmapalreadycleared,noneedtotouchpagesNeedfortuningknobshowmuchmemorydoweallowinlargeobjectsbeforeamajorcollection25ObjectlayoutKeepreferencesclosetoeachotherBettercachelocalityBetterencodingofreferencebitmapsDegeneratecases.
.
.
Doctor,ithurtsWeshouldsetreasonablelimitsforuntrustedcodeTheJVMdoeshaveamuchbettertimewiththis.
.
.
nostructsnofixedorsequentiallayout26GCdescriptorsSeveraltypesneeded:stringsvectorsbitmapsrun-lengthencodinglargebitmapsFasthandlingofptrfreeobjectsandarraysStoredinMonoVTable27WritebarriersKeeptrackofreferencestonurseryobjectsfromtheoldgeneration:theybecomerootsforaminorcollectionComplicatedbystructsareferencecanbestoredintheheaporonthestackcopyofstructsCustomonesoptimizedforeachcasearraycopystructhandling28API/ABIchangesAfewsimplechangesneededforruntimehackersandembeddersObjectscanmove,sotheGCneedstoknowaboutallreferencesortheymustbepinnedsomeway–NomorevalidtoknowanobjectiskeptaliveandstoreareferenceinmallocmemoryFieldandarrayelementsettingmustgothroughwritebarriers–OnlyreferencesorvaluetypeswithreferencesInteriorpointerissues–ApointertotheendofanobjectisnotavalidinteriorpointerNewAPI:–MONO_OBJECT_SETREF(object,fieldname,value)–mono_array_setref(array,index,value)29TODOlistUsemark-compactforoldgenerationcollectionReducesmemoryrequiredforoldgencollectionUsemark-tablebasedwritebarriersFasterandinlineableThread-localallocationRemoveslockoverheadInlineallocationinjittedmanagedcodeNomanagedunmanagedtransitionsPrecisestackwalkReduceriskoffalsepositiveGCreferencesFixtheruntime30PreliminaryresultsStilluntuned,soexpectimprovementswritebarriers,thread-localalloc,alloccodeinliningSome(rare:-)testcases:5-7xspeedupUsually(withthread-local-alloc):10-50%speedupUsuallysmallerheap(butminimumislarger)Degeneratecases:manypinnedobjectsmanyreferencestores(writebarriers)longlinkedlists31KernelhelpThreadstart/stopneedtobeabletogetcontextofstoppedthreadmprotect(addr,size,MAP_DISCARD);dropthepagesfrommemorywillbeclearedwhenreadagainPagetablesdirtybitaccessMorecoarsewritebarriersupportNoneedforwritebarriersFixed(andpossiblytoolarge)markwindow32CompactingGarbageCollector.
33CompactingCollector34Nursery.
35NurseryandPinnedObjects.

Sharktech:美国/荷兰独立服务器,10Gbps端口/不限流量/免费DDoS防护60G,319美元/月起

sharktech怎么样?sharktech (鲨鱼机房)是一家成立于 2003 年的知名美国老牌主机商,又称鲨鱼机房或者SK 机房,一直主打高防系列产品,提供独立服务器租用业务和 VPS 主机,自营机房在美国洛杉矶、丹佛、芝加哥和荷兰阿姆斯特丹,所有产品均提供 DDoS 防护。此文只整理他们家10Gbps专用服务器,此外该系列所有服务器都受到高达 60Gbps(可升级到 100Gbps)的保护。...

【IT狗】在线ping,在线tcping,路由追踪

IT狗为用户提供 在线ping、在线tcping、在线路由追踪、域名被墙检测、域名被污染检测 等实用工具。【工具地址】https://www.itdog.cn/【工具特色】1、目前同类网站中,在线ping 仅支持1次或少量次数的测试,无法客观的展现目标服务器一段时间的网络状况,IT狗Ping工具可持续的进行一段时间的ping测试,并生成更为直观的网络质量柱状图,让用户更容易掌握服务器在各地区、各线...

IonSwitch:$1.75/月KVM-1GB/10G SSD/1TB/爱达荷州

IonSwitch是一家2016年成立的国外VPS主机商,部落上一次分享的信息还停留在2019年,主机商提供基于KVM架构的VPS产品,数据中心之前在美国西雅图,目前是美国爱达荷州科德阿伦(美国西北部,西接华盛顿州和俄勒冈州),为新建的自营数据中心。商家针对新数据中心运行及4号独立日提供了一个5折优惠码,优惠后最低1GB内存套餐每月仅1.75美元起。下面列出部分套餐配置信息。CPU:1core内存...

uctools为你推荐
企业信息查询系统官网怎么在网上查询企业营业执照是否存在?支付宝调整还款日蚂蚁借呗还款日能改吗什么是支付宝支付宝是什么意思?flashfxp下载求最新无需注册的FlashFXP下载地址360防火墙在哪里设置360安全防护中心在哪360免费建站搭建卡盟分站(卡乐购系统,免费360网站收录)只要29元,想建的找2208647548!大飞资讯单仁资讯集团怎么样科创板首批名单江苏北人的机器人在同行中的评价怎么样?瑞东集团福能集团是一个什么企业?网站制作套餐做一个网站要多少钱
php主机租用 免费二级域名申请 老域名全部失效请记好新域名 buyvm a2hosting 免费cdn加速 directadmin 免费名片模板 轻博 免空 百兆独享 hostker 有奖调查 怎样建立邮箱 域名接入 爱奇艺vip免费试用7天 免费dns解析 彩虹云 架设邮件服务器 西安服务器托管 更多