您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 招聘面试 > 编程之美__微软技术面试心得
——200811——————VSTS9601——...11.1CPU...31.2...131.3...201.4...301.5...351.6...401.7...451.8...501.9...541.10...591.11NIM1...641.12NIM2“”...671.13NIM3...721.14...861.15...911.1624...99——2008121.17...1081.18...1162——...1172.11...1192.2...1252.3“”...1292.41...1322.5K...1392.6...1472.7...1502.8...1552.9Fibonacci...1602.10...1662.11...1712.12...1782.13...1822.14...1852.15...1922.16...1982.17...2042.18...2072.19...2112.20...2152.21...2173——...219——2008133.1...2213.2...2243.3...2303.4...2343.5...2373.6...2413.7...2443.8...2503.9...2563.10...2623.11...2684——...2734.1...2754.2...2794.3...2824.4...2864.5...2914.6...2944.7...2994.8...3034.9...3074.10...3154.11...322-——200814(interviewee)while(true){if(busy)i++;else}else“50%CPU”“”“”“SOA”WindowsLinux“WindowsCPU50%”·CPU90%·CPU·dual-core“”“”2005“IT”“”“”“”“”bye-bye——200815CPU“CPU”“CPU”“”“”“”·20·40·60“”()–·CPU‘’···——200816·1.2.IT“”3.123/4/5620072200711“”——Nothingreplaceshardwork“”-——200817DECSRCSRC15“offer2008-————200818“”()24“”CPUTaskmgrAPICPU(list)hash“Ourgoalistoshipatopqualitybook.Ican'——200819tsayworldclass,butdefinitelybestinChinalevel.”20082-CSDN“”“”“”——2008110“”IT“Aha”-“”“”“”“”()——2008111“”…….[JZ1]arrXarrYarrZboolMergeSort(int*arrX,intnX,int*arrY,intnY,int*arrZ,intnZ)——“arrXarrY”bug()bugChenYuan————VSTS“”“”ASP.NETAJAX——2008112ACMICPCC#“”CMSofferJ“”“”“”“”“”“”“”“”“”“”“”——2008113“”JuLiangBOP“BeautyOfProgramming”——outlookboppuzzlebopBOP——“”“”BOP20078——/20077trainingEngineeringtrainingcoachStoneQuizBOPBOPreviewactivepeerrevieweditorreviewactivecommitmentreview——[JZ2]RuiHu——20081149“Betterlaterthannever”“”“”[JZ3]TieFengprobeproblemsolving,codingskills,algorithmanalysisskills——2008115codereviewreviewreviewreleaseprojectcodereviewcandidate33onsiteHR20%“”“”probeskillsbug-CPU——2008116WindowsTaskManagerCPU1.CPU50%2.CPU1~1003.CPUwhile(true){if(busy)i++else}elseCPUCPUCPU”——MSRATTGMicrosoftResearchAsia,TechnologyTransferGroup1-1——20081171-1CPUCPU100%CPUCPUCPUCPUCPUProcessSystemIdleProcessCPU——WaitForSingleObject()Sleep()CPUCPUCPUCPU1CPUusageCPUTaskManagerbusyidleloopCPUUsage2BusyloopidleSleep()——2008118loopSleepfornnfor(i=0;in;i++)CPUloop:movdxi;idxincdx;dx1movidx;dxicmpin;injlloop;inCPUP42.4Ghz2.4*10CPU2400000000*2/5=960000000CPU1960000000n=60000000Sleep(1000)CPU——50%n=960000010Sleep(10)10Windows11-1intmain(){for(;;){for(inti=0;i9600000;i++);Sleep(10);}return0;——2008119}960000050%CPU1.sleep/awakeCPU2.systemcallI/OprivilegeinstructionCPUCPUGetTickCount()Sleep()GetTickCount()49.Sleep()GetTickCount()busyloopSleep()idleloop1-2intbusyTime=10;//10msintidleTime=busyTime;//sameratiowillleadto50%cpuusageInt64startTime=0;while(true){startTime=GetTickCount();//busyloopwhile((GetTickCount()-startTime)=busyTime);//idleloopSleep(idleTime);}——200812010%CPU40%CPU50%50%CPU——Perfmon.exPerfmonWindowsNTWindows1-2PerfmonPerfmonRAMCPU1-2PerfmonPerfmonMicrosoft.NetFrameworkPerformanceCounter()CPU——1-3//C#codestaticvoidMakeUsage(floatlevel){——2008121PerformanceCounterp=newPerformanceCounter(Processor,%ProcessorTime,_Total);while(true){if(p.NextValue()level)System.Threading.Thread.Sleep(10);}}CPU1-4//C++codetomaketaskmanagergeneratesinegraph#includeWindows.h#includestdlib.h#includemath.hconstdoubleSPLIT=0.01;constintCOUNT=200;constdoublePI=3.14159265;constintINTERVAL=300;int_tmain(intargc,_TCHAR*argv[]){DWORDbusySpan[COUNT];//arrayofbusytimesDWORDidleSpan[COUNT];//arrayofidletimesinthalf=INTERVAL/2;——2008122doubleradian=0.0;for(inti=0;iCOUNT;i++){busySpan[i]=(DWORD)(half+(sin(PI*radian)*half));idleSpan[i]=INTERVAL-busySpan[i];radian+=SPLIT;}DWORDstartTime=0;intj=0;while(true){j=j%COUNT;startTime=GetTickCount();while((GetTickCount()-startTime)=busySpan[j]);Sleep(idleSpan[j]);j++;}return0;}CPUCPUCPU50%CPUCPUGetProcessorInfo()SetThreadAffinityMask()——2008123RDTSCCPUx86inline__int64GetCPUTickCount(){__asm{rdtsc;}}x64#defineGetCPUTickCount()__rdtsc()CallNtPowerInformationAPICPU1-5_PROCESSOR_POWER_INFORMATIONinfo;CallNTPowerInformation(11,//queryprocessorpowerinformationNULL,//noinputbuffer0,//inputbuffersizeiszero&info,//outputbufferSizeof(info));//outbufsize__int64t_begin=GetCPUTickCount();//dosomething__int64t_end=GetCPUTickCount();doublemillisec=((double)t_end–(double)t_begin)/(double)info.CurrentMhz;RDTSCCPUCPUCPUCPU——2008124CPUSetThreadAffinityMaskCPUAPI1.Sleep()——“”2.WaitForSingleObject()——3.GetTickCount()——Tick“”4.QueryPerformanceFrequency()QueryPerformanceCounter()——CPU5.timeGetSystemTime()——6.PerformanceCounter——7.GetProcessorInfo()/SetThreadAffinityMask()CPU8.GetCPUTickCount()CPU-1-3——20081251-33×3{d10,f10,d8,f8{d3,f3,d1,f1d10d1d2d3ABAB1~91-4——20081261-41~9ABbooltruefalsebyteintbyte28=2564bit4bitbit16bitbytenbyteb101001014bit0101n0011bitsbits:11110000LMASK&10100101b-----------1010000010100000LMASK&b^00000011n------------10100011——2008127nbyteb101001014bit1010n0011bitsbits:00001111RMASK&10100101b-----------00000101byten4=0011000000000101RMASK&b^00110000n4-----------00110101nbyte4bits4bitse.g.1010010110100101bitsbits00001111RMASK&10100101b-----------00000101bitsbits11110000LMASK&1
本文标题:编程之美__微软技术面试心得
链接地址:https://www.777doc.com/doc-1056899 .html