ISO16750-3-2012
ISO16750-3-2012Road vehicles — Environmentalconditions and testing for electricaland electronic equipment —Part 3:Mechanical loadsContents PageForeword.............................................................................................................................................Iso16750-3:2012[EContentsPageForewordScope12Normative references1Terms and definitions4Tests and requirements4.1ibration4.2 Mechanical shock274.3 Free fall…294.4 Surface strength/ scratch and abrasion resistance294.5 Gravel bombardmentCode letters for mechanical loads29Documentation…,…………111111130Annex A (informative) Guideline for the development of test profiles for vibration tests.32Annex B (informative) Recommended mechanical requirements for equipment depending on themounting location44Bibliography46C ISO 2012-All rights reservedIso16750-3:2012EForewordISo (the International Organization for Standardization) is a worldwide federation of national standardsbodies (Iso member bodies). The work of preparing International Standards is normally carried outthrough iso technical committees. Each member body interested in a subject for which a technicalcommittee has been established has the right to be represented on that committee. Internationaorganizations, governmental and non-governmental, in liaison with ISO, also take part in the workIso collaborates closely with the International Electrotechnical Commission (IEC) on all matters ofelectrotechnical standardizationInternational Standards are drafted in accordance with the rules given in the ISo/IEC Directives, Part 2The main task of technical committees is to prepare lnternational standards. draft InternationalStandards adopted by the technical committees are circulated to the member bodies for votingublication as an International Standard requires approval by at least 75 of the member bodiescasting a voteAttention is drawn to the possibility that some of the elements of this document may be the subject ofpatent rights. ISO shall not be held responsible for identifying any or all such patent rightsIso 16750-3 was prepared by Technical Committee ISO/TC 22, Road vehicle, Subcommittee SC 3,Electrical and electronical equipment.This third edition cancels and replaces the second edition (Iso 16750-3: 2007), which has beentechnically revisedISo 16750 consists of the following parts, under the general title road vehicles-Environmental conditionsand testing for electrical and electronic equipment:Part 1: GeneralPart 2: electrical loadsPart 3: Mechanical loadsPart 4: Climatic loadsPart 5: chemical loadso ISO 2012-All rights reservedINTERNATIONAL STANDARDIso16750-3:2012(E)Road vehicles- Environmental conditions and testing forelectrical and electronic equipmentPart 3Mechanical loads1 ScopeThis part of IS0 16750 applies to electric and electronic systems/components for road vehicles. Itdescribes the potential environmental stresses and specifies tests and requirements recommended forthe specific mounting location on/in the vehicleThis part of iso 16750 describes mechanical loads2 Normative referencesThe following referenced documents are indispensable for the application of this document. For datedreferences, only the edition cited applies For undated references, the latest edition of the referenceddocument (including any amendments applies.Iso16750-1, Road vehicles- Environmental conditions and testing forelectrical andelectronicequipment-Part 1: GeneralIEC 60068-2, 6, Environmental testing- Part 2-6: Testing, Test Fc: Vibration SinusoidalIEC60068-2, 14, Basicenvironmental testing procedures- Part 2-14: Tests-Test Nb: Change oftemperatureTEC 60068-2, 64, Environmental testing Part 2-64: Test methods -Test Fh -Vibration, broad-bandrandom(digital control)and guidanceIEC 60068-2, 80, Environmental testing- Part 2-80: Tests- Test Fi: Vibration - Mixed mode testingIEC 60068-2-31, Environmental testing procedures- Part 2: Tests; Test Ec: Free fall, Clause 5.23 Terms and definitionsFor the purposes of this document, the terms and definitions given in Iso 16750-1 app4 Tests and requirements4.1 Vibration41.1 GeneralThe vibration test metho ds specified consider various levels of vibration severities applicable to on-board electrical and electronic equipment. It is recommended that the vehicle manufacturer andsupplier choose the test method, the environmental temperature and vibration parameters dependingon the specific mounting locationFollowing the expressions in MIL-STD please noticeC ISO 2012-All rights reservedIso16750-3:2012EWhen applied properly, the environmental management and engineering processes described in this partof Iso 16750 can be of enormous value in generating confidence in the environmental worthiness andoverall durability. However, it is important to recognize that there are limitations inherent in laboratorytesting that make itimperative to use proper caution and engineering judgement when extrapolating theselaboratory results to results that may be obtained under actual service conditions. In many cases, realworld environmental stresses (singularly orin combination cannot be duplicated practically or reliably intestlaboratories. Therefore, users of this part of Iso 16750 should not assume that a system or componentthat passes laboratory tests of this part of Iso 16750 would also pass field/ fleet verification trialsThe specified values are the best estimation one can get up to the moment when results frommeasurements in the car are received - but they do not replace a car measurement!The specified values apply to direct mounting in defined mounting locations. Using a bracket formounting can resultin higher or lower loads. If the device under test ( DUT)is used in the vehicle with abracket then all vibration and mechanical shock test shall be done with this bracketCarry out the vibration with the dut suitably mounted on a vibration table. The mounting method (sused shall be noted in the test report. Carry out the frequency variation by logarithmic sweeping of 0,5octave/minute for sinusoidal tests and the sinusoidal part of sine on random tests. The scope of therecommended vibration tests is to avoid malfunctions and breakage mainly due to fatigue in the fieldTesting for wear has special requirements and is not covered in this part of ISo 16750Loads outside of the designated test frequency ranges are to be considered separatelNOTE Deviations from the load on the DUT can result, should vibration testing be carried out according tothis part of Iso 16750 on a heavy and bulky dut, as mounting rigidity and dynamic reaction on the vibrator tableexcitation are different compared to the situation in the vehicle. This deviation can be minimized by applying theaverage control method(see Annex A)Application of the weighted average control method according to IEC 60068-2, 64 is to be agreed uponSubject the dut during the vibration test to the temperature cycle according to iEC 60068-2, 14, withelectric operation according to diagram 1. Alternatively, a test at constant temperature may be agreed onOperate the dutelectrically as indicatedin Figure l at Tmin(Short functional testafterthe dUT completelyreached Tmin). This functional test shall be as short as possible- only long enough to check the properperformance of the dUt. This minimizes self-heating of the dUT. Additional electrical operation of theDUT between 210 min and 410 min of the cycle (see Figure 1)Additional drying of test chamber air is not permittedIn the vehicle, vibration stress can occur together with extremely low or high temperatures; for thisreason, this interaction between mechanical and temperature stress is simulated in the test, too. afailure mechanism is, for example, a plastic part of a system/component, which mellows due to the hightemperature and cannot withstand the acceleration under this condition2o ISO 2012-All rights reservedIso16750-3:2012[EYmax20aburditt0100200300400500600yY temperature[°C]x time [ minIa Operating mode 3.2 according to ISo 16750-1.b Operating mode 2. 1 according to ISo 16750-1One cycleFigure 1-Temperature profile for the vibration testTable 1- Temperature versus time for the vibration testTimeTemperaturemin°C0206040150-4021020300max41048020See Is016750-44.1.2 Tests4.1.2.1 Test I- Passenger car, engine4.1.2.1.1 PurposeThis test checks the dUt for malfunctions and breakage caused by vibrationThe vibrations of a piston engine can be split up into two kinds: Sinusoidal vibration which results from theunbalanced mass forces in the cylinders and random noise due to all other vibration-schemes of an engine,C ISO 2012-All rights reserved3Iso16750-3:2012Ee.g. closing of valves. In the lowest frequency range from 10 Hz to 100 Hz the influence of rough-roadconditions is taken into account. The main failure to be identified by this test is breakage due to fatigueNOTE 1 Road profile usually has negligible impact on engine-mounted components. Shock inputs are effectivelysolated by suspension, and engine-mounting systemsThe test profiles specified in the following clauses apply to loads generated by(four strokereciprocating enginesNotE 2 If the dut is to be tested for a specific resonance effect, then a resonance dwell test according to 8.3.2of IEC 60068-2, 6: 2007 can also be applied4.12.1.2Test4.1.2.1.2.1 GeneralIt is required to perform this test as a mixed mode vibration test according to IEC 60068-2, 80NOTE The test duration is based on A 4. The temperature in the chamher is above room temperature (rt)atthe end of the test (2 3/4 temperature cycles4.1.2.1.2.2 Sinusoidal vibrationPerform the test according to IEC 60068-2, 6, but using a sweep rate of s 0,5 octave/minute. Use a testduration of 22 h for each plane of the dUTUse curve l in Table 2/ Figure 2 for DUT intended for mounting on engines with 5 cylinders or fewerUse curve 2 in Table 2/Figure 2 for dUT test intended for mounting on engines with 6 cylinders or moreBoth curves may be combined to cover all engine types in one test2502001501005050100150200250300350400450500ⅩKeyamplitude of acceleration [m/s2IXfrequency [Hzcurve1(≤5 cylinders)curve 2(5 cylindersFigure 2- Vibration severity curves4o ISO 2012-All rights reservedIso16750-3:2012[ETable 2- values for max acceleration versus frequencyCurve 1(see Figure 2FrequencyAmplitude of accelerationHz100100200200240200270100440100Curve 2(see Figure 2)FrequencyAmplitude of accelerationHm/s2100100150150440150CombinationFrequencyAmplitude of accelerationH1001001501502002002402002551504401504,1.21.2.3 Random vibrationPerform the test according to IEC 60068-2, 64. Use a test duration of 22 h for each plane of the DUTThe r.m.s. acceleration value shall be 181 m/s2The psd versus frequency are referred to in Figure 3 and Table 3NoTE The Power Spectral Density(PSD)values (random vibration] are reduced in the frequency range of thesinusoidal vibration testC ISO 2012-All rights reserved5Iso16750-3:2012EY100100,110100100010000KeyY PSD [(m/s2)2/HzX frequency [Hz]Figure 3- PSD of acceleration versus frequencyTable 3- Values for frequency and PsDFrequencyPSDH:(m/s2)2/Hz1010100103000,5150020200024.1.2.1.3 RequirementBreakage shall not occur.Functional status a see iso 16750-1) is required during operating mode 3.2 as defined in ISo 16750-1and functional status C during periods with other operating modes4.1.2.2 Test II-Passenger car, gearbox4.1.2.2.1 PurposeThis test checks the dut for malfunctions and breakage caused by vibrationThe vibrations of a gearbox can be split up into two kinds which result partly from sinusoidal vibrationfrom unbalanced mass forces of the engine(e. g dominating orders) in the frequency range from 100 Hzto 440 Hz and vibration from the friction of the gear wheels and other schemes, which are tested in therandom part. In the lowest frequency range from 10 Hz to 100 Hz the influence of rough-road conditionsis taken into account The main failure to be identified by this test is breakage due to fatigueChanging the gears can create additional mechanical shock and shall be considered separatey brationsThe test profiles specified in the following subclauses apply to loads generated by gearbox vibo ISO 2012-All rights reserved
- 2020-12-08下载
- 积分:1
c++笔试面试之网络和多线程
该文档是我总结的c++笔试面试通常会问的一些问题。另外可以从我的资源目录下找c++数据结构与算法,c++笔试面试基础两部分材料,综合这三个材料一起看,我相信大家一定尽快找到工作。ClientServerFIN WAIT 1IFIN MCLOSE WAITack M+1FIN WAIT 2LAST ACKFIN NTIME WAITACK=1 ack=K+CLOSEDm由于TCP连接是全双工的,因此,每个方向都必须要单独进行关闭,这一原则是当一方完成数据发送任务后,发送个FIN来终止这·方向的连接,收到个FIN只是意味着这方向上没有数据流动了,即不会再收到数据了,但是在这个TCP连接上仍然能够发送数据,直到这一方向也发送了FIN。首先进行关闭的一方将执行主动关闭,而另一方则执行被动关闭,上图描述的即是如此第一次挥于Client发送个HN,用来关闭 Client到 Server的数据传送, Client进入 FIN WA1状第二次挥手Server收到FIN后,发送一个ACK给 Clien,确认序号为收到序号+1(与SN相同,一个FIN占用一个序号), Server进入 CLOSE WAIT状态。第三次挥手Server发送一个FIN,用来关闭 Server到 Client的数据传送, Server进入 LAST ACK状态。第四次挥手Client收到FIN后, Client进入 TIME WAIT状态,接着发送一个ACK给 Server,确认序号为收到序号+1, Server进入CL0SED状态,完成四次挥手。5.tcp为什么建立连接是三次握手,而关闭连接却是四次挥手呢?当主杋A确认发送完数据且知道B已经接受完了,想要关闭发送数据口(当然确认信号还是可以发),就会发FN给主机B;主机B收到A发送的F⊥N,表示收到了,就会发送ACK回复;但这是B可能还在发送数据,没有想要关闭数据口的意思,所以FⅣN与ACK不是同时发送的,而是等到B数据发送完了,才会发送FIN给主机A:;A收到B发米的FIN,知道B的数据也发送完∫,回复ACK,A等待2MSL以后,没有收到B传来的任何消息,知道B已经收到自己的ACK了,A就关闭链接,B也关闭链接了。6.TCP头大小,包含字段?TCP协议头最少20个字节,包括TCP的源端口,目的端口,序列号,应答号等等。7.tcp与udp的区别?为什么TCP要叫做数据流?1).基于连接与无连接2).对系统资源的要求(TCP较多,UDP少)3).UDP程序结构较简单4).流模式与数据报模式5).TCP保证数据正确性,UDP可能丢包,TCP保证数据顺序,UDP不保证6).TCP有拥塞控和流量控制,UDP没有TCP提供的是面向连接、可靠的字节流服务。当客户和服务器彼此交换数据前,必须先在双方之间建立一个TCP连接,之后才能传输数据。TCP提供超时重发,丟弃重复数据,检验数据,沇量控制等功能,保证数据能从端传到另·端UDP是一个简单的面向数据报的运输层协议。∪DP不提供可靠性,它只是把应用程序传给IP层的数据报发送出去,但是不能保证它们能到达目的地。山于UDP在传输数据报前不用在客户和服务器之间建立一个连接,且没有超时重发等机制,故而传输速度很快8使用udp和tcp进程网络传输,为什么tcp能保证包是发送顺序,而udp无法保证?因为TCP发送的数据包是按序号发送,有确认机制和丢失重传机制,而udp是不可靠的发送机制,发送的对应端口的数据包不是按顺序发送的。9tcp三次握手的, accept发生在三次握手哪个阶段?三次握手:C--->SYNK>ACK K+1 SYN JC->ACK]+1DONELclient的 connect引起3次握于server在 socket,bind, listen后,阻塞在 accept,三次握手完成后, accept返回一个fd,TCP服务器端sackettTC客户端bindosten)connecto建立连接阻寒直到有客户端连接请求数据writereadr处理请求回应数据readr结束连接readr yclose10.流量控制和拥塞控制的实现机制数据的传送与接收过程当中很可能出现收方来不及接收的情况,这时就需要对发方进行控制,以免数据丢失。流量控制是一种解决发送端与接收方吞吐量不匹配问题的机制。网络拥瘧现象是指到达通信了网中杲部分的分组数量过多,使得该部分网络来不及处理,以致引起这部分乃至整个冈络性能下降的现象,严重时甚至会导致网络通信业务陷入停顿即出现死锁现象。拥塞控制是处理网络拥塞现象的一种机。11.滑动窗口的实现机制滑动窗凵机制是tcp流量控制的一种机制。滑动窗口分为发送窗凵和接收窗口,发送窗口会根据接受窗口返回的ack中的大小来确定发送数据多少,如果ack返回可接受为零时,发送窗口不发送数据,然后启动定时器,一定时间内给接收端发送探测报文。为了传递效率提扃,发送数据吋会尽量次发送多个字节,这里会通过算法控制接收窗口发送窗口接收窗口取决发送窗口取决于对于本段应用端接收窗囗应用应用接收窗口取决发送窗口取决于对于本段应用端接收舍口发送窗口接收窗口字节流方向窗囗关联方问发送窗口中的四个概念:已发送并收到确认;凵发送但未收到确认;允许发送但未发送;不允许发送。每次成功发送完数据后,发送窗口都会根据接受窗口返冋的ack大小来调整窗口大小后浩前沿前移收缩前移A的发送窗凵=20E区图国时国时网國國回回区画乎图已发送井不允许发送收到确认允许发送的序号B期望收到的序号图5-15根据B给出的窗口值,A构造出自己的发送窗口12. linux的五种I0模式/异步模式1)同步阻塞I/O2)同步非阻塞I/O(只能阻塞个io)3)同步I/O复用模型(可以阻塞多个i,用一个进程/线程调用多个io,其实是复用进稈/线程)4)同步信号驱动I/O5)异步I/O模型3.网络编程设计模式, reactor/ proactor/半同步半异步模式?reactor模式:同步阻塞I/O模式,注册对应读写事件处理器,等待事件发生进而调用事件处理器处理事件。 proactor模式:异步I/O模式。 Reactor和 Proactor模式的主要区别就是真正的读取和写入操作是有谁来完成的, Reactor中需要应用程序自己读取或者写入数据, Proactor模式中,应用程序不需要进行实际读写过程。Reactor是:主线程往epo‖l核上注册 socket读事件,上线程调用 epoll_wait等待 socket上有数据可读,当 socket上有数据可读的时候,主线程把 socket可读事件放入请求队列。睡眠在请求队列上的某个工作线程被唤醒,处理客户请求,然后往epo‖!内核上注册 socket写请求事件。主线程调用 epoll_wait等待写请求事件,当有事件可写的时候,主线程把 socket可写事件放入请求队刎。睡眠在请求队列上的工作线程被唤醒,处理客户请求。Proactor主线程调用 aio read函数向内核注册 socket上的读完成事件,并告诉内核用广读缓冲区的位置,以及读完成后如何通知应用程序,主线程继续处理其他逻辑,当 socket上的数据被读入用户缓冲区后,通过信号告知应用程序数据已经可以使用。应用程序预先定义好的信号处理凼数选择一个工作线程来处理客户请求。工作线程处理完客户请求之后调用ao wrⅰte函数向内核注册 socke写完成事件,并告诉内核写缓冲区的位置,以及写完成时如何通知应用程序。主线程处玛其他逻辑。当用户缓存区的数据被写入 socket之后内核向应用程序发送一个信号,以通知应用程序数据已经发送完毕。应用程序预先定义的数据处理函数就会完成工作。半同步半异步模式上:层的任务(如:数据库查询,文件传输)使用同步IO模型,简化了编写并行程序的难度而底层的任务(如网络控制器的中断处理)使用异步I/O模型,提供了执行效率14.1inux下io多路复用的方案 select、poll、epol1的区别select:利用一个数组结构(最大1024)来存储需要检测的描述符,每次调用需要清空数组结构后重新存入新的描述符文件,然后遍历需要操作的描述符。可以用仨检测单个描述符可以理解为拉取pol:也是利用数组结构存储,但是没有描述符个数限制,而且每次调用时不需要清空存储描述符结构数组。可以用于检测大量描述符的情况。可以理解为拉取epoll:是 select/po!的升级版本,它的机制是可以监视大量的描述符,当有需要连接时将改描述符存放到队列中,而epol只监视和执行队列中即可。可以用于大量并发连接中只有少量活跃的情况。可以理解为推送http://blog.csdnnet/lookatthestars/article/details/5210877315.epo11哪些触发模式,有啥区别?(必须非常详尽的解释水平触发和边缘触发的区别,以及边缘触发在编程中要做哪些更多的确认epo‖有EPoL和 EPOLLET两种触发模式,LT是默认的模式,ET是高速"模式。LT模式下,只要这个fd还有数据可读,每次 epoll_wait都会返回它的事件,提醒用户稈序去操作,而在ET(边缘触发)模式中,它只会提示一次,直到下次再有数据流入之前都不会再提小」,无论fd中是否还有数据可读。所以在ET模式下,read一个fd的时候一定要把它的 buffer读光,也就是说一直读到read的返回值小于请求值。也就是说在LT模式的情况下‘定要确认收发的数据包的 buffer是不是足够大如果收发数据包大小大于 buffer的大小的时侯就可能会出现数据丢失的情况。16. Boost.asio、 libevent、1ibev简介。Boost.asio是一个跨平台的C++库,用于网络和底层I/0编程,可以在I/0对象(如socket)上执行同步和异步操作。 boost.asio的跨平台性原理是在win系统(支持I0CP)linux系统(支持epo11)。 boost:asio将整个异步平台抽象成 boost::asio: lo service,用work控制 1o service生命周期,通知它是否结束,只要对象work( 1o servi ce)存在,10 service就不会结束。利用 buffer类存储数据libevent是一个C语言与的网络库,官方主要支持的是类 linux操作系统,最新的版本添加了对 windows的I0CP的支持由于I0CP是异步I0,与 linux下的POL模型, EPOLL型,还有 freebsd的 KQUEUE等这些同步模型在用法上完全不一致,所以使用方法也不样,就好比ACE中的 Reactor和 Proactor模式一样,使用起来需要转变思路。如果对性能没有特别的要求,那么使用 Libevent中的 select模型来实现跨平台的操作, select模型可以橫跨 windows, linux,unix, solaris等系统。libel是一个C语言写的,只支持1inux系统的库,我以前研究的时候只封装了EPOL模型,不知道现在的新版有没有改进。使用方法类似 libevent,但是非常简洁,代码量是最少的一个库,乜貮几千行代码。显然这样的代码跨平台肯定是无法支持的了,如果你只需要在1inux下面运行,那用这个库也是可以的。17. connect可能会长时间阻塞,怎么解决?1.使用定时器;(最常用也最有效的·种方法2.采用非阻塞模式:设置非阻塞,返回之后用 select检测状态18. keepalive是什么东西?如何使用?keepalive,是在TCP中一个可以检测死连接的机制。1).如果主机可达,对方就会响应ACK应答,就认为是存活的。2).如果可达,但应用程序退岀,对方烑发RST应答,发送TCP撤消连接。3).如果可达,但应用程序崩溃,对方就发FIN消息。4).如果对方主杋不响应ack,rst,继续发送直到超时,就撤消连接。默认二个小时。19. socket什么情况下可读?1. socket接收缓冲区中己经接收的数据的字节数大于等于 socket接收缓冲区低潮限度的当前值;对这样的 socket的读操作不会阻塞,并返回一个大于0的值(准备好读入的数据的字节数)2连接的读一半关闭(即:接收到对方发过来的FIN的TCP连接)并且返回03.s0cket收到了对方的 connect请求已经完成的连接数为非0这样的 socket处于可读状态;4.异常的情况下 socket的读操作将不会阻塞,并且返同一个错误(-1)。20. socket编程,如果 client断电了,服务器如何快速知道?使用定时器(适合有数据流动的情况);使用sock吐t选项SO_ KEEPALIVE(适合没有数据流动的情况);1)、自己编写心跳包程序,简单的说就是自己的程序加入一条线程,定时向对端发送数据包,看是否有ACK,根据ACK的返回情况来管理连接。此方法比较通用,般使用业务层心跳处理,灵活可控,但改变了现有的协议2)、使用TCP的 keepalive机制,∪NX网络编程不推荐使用SO_ KEEPALIVE米做心跳检测。keepalive原理:TCP内嵌有心跳包,以服务端为例,当 serve检测到超过一定时间(/proc/sys/net/ipv4/tcp_ keepalive_ time7200即2小时)没有数据传输,那么会向client端发送一个 keepalive packet21.如果 select返回可读,结果只读到0字节,什么情况?某个套接字集合中没有准备好,可能会 select内存用 FD CLR清为0.22.网络中,如果客户端突然掉线或者重启,服务器端怎么样才能立刻知道?若客户端掉线或者重新启动,服务器端会收到复位信号,每一种tcp/ip得实现不一样,控制机制也不·样。23.TTL是什么?有什么用处,通常那些工具会用到它?ping? traceroute? ifconfig?netstat?TTL是 Time to live,每经过一个路由就会被减去一,如果它变成0,包会被丢掉。它的主要目的是防止包在有回路的网络上死转,浪费网络资源。ping和 traceroute用到它。24请说出http协议的优缺点1.支持客户/服务器模式。2.简单快速:客户向服务器请求服务吋,只需传送请求方法和路径,通信速度很快。3.灵活:HTTP允许传输任意类型的数据对象。4.无连接:无连接的含义是限制每次连接只处理一个请求。服务器处理完客户的请求,并收到客户的应答后,即断廾连接。采用这种方式可以节省传输时间。5.无状态:HTTP协议是无状态协议。无状态是指协议对于事务处理没有记忆能力。缺少状态意味着如果后续处理需要前面的信息,则它必须重传,导致每次连接传送的数据量增大。缺点就是不够安全,可以使用hps完成使用25大规模连接上来,并发模型怎么设计Epol1+线程池(epo11可以采用 libevent处理)26.tcp怎么做到不丢包。TCP提供超时重发(每一个seq后都有ack,计时时间到后重发seq),丢重复数据(通过判断seq和ack的大小,如果seq比ack小说明发过了),检验数据(通过tcp的伪首部),流量控制(利用滑动窗口实伣流量控制)等功能,保证数据能从一端传到另一端。27.TCP的确认重发机制A发—B/a向b发送数据B确认-A//b收到数据后发送给a确认包A-在重发数据中将发送成功的数据删掉28.I0CP和epo1l的联系与区别?联系:两者都是高效的io模型,都是基于事件驱动。区别:TOCP用在 Windows上,epo11用在1inux上;IQCP本质是异步非阻塞的,而epo1l是同步非阻塞的;1OCP是当事件完成时再通知,而 epoll是当事件满足处理要求是通知处理。boost中的asio网络模块的跨平台性原理是在win系统(支持IOCP),1inuκ系统(支持epollhttps://yg.aliyun.com/articles/53621进程与线程1.进程之间的通信无名管道:单向通信,只能亲戚关系才能传递,般用在父了进程之间有名管道:单向通信,可以用在任意两个进程之间通信。信号量:是一种计数器,主要用于资源共亨,用在多个进程或者进程内多个线程之间同步手段共享内存:一个进程创建共多个进程使用,和信号一起使用在进程同步与通信。信号:比较复朵的·种通信。套接字:消息队列:客服信号传递信息少,管道缓冲区受限。2.线程同步临界区,互斥对象,事件,信号量3.多线程和多进程的区别1)进程数据是分丌的:共享复岽,需要用IPC,同步简单;多线程共享进程数据:共享简单,同步复杂2)进程创建销毁、切换复杂,速度慢:线程创建销毁、切换简单,速度快3)进程占用内存多,CPU利用率低;线程占用内存少,CPU利用率高4)进程编程简单,调试简单;线程编程复杂,调试复杂5)进程间不会相互影响;线程个线程挂掉将导致整个进程挂抻6)进程适应于多核、多机分布;线程适用于多核线程所私有的:线程jd、寄存器的值、栈、线程的优先级和调度策略、线程的私有数据、信号屏蔽字、ero变量。4.多线程锁的种类有哪些?a.互斥锁( mutex)b.递归锁C.自旋锁d.读写锁5.自旋锁和互斥锁的区别?白旋锁中当锁被其他线程占用时,其他线程并不是睡眠状态,而是不停的消耗CPU,获取锁;互斥锁则不然,保持睡眠,直到互斥锁被释放溦活。自旋锁,递归调用容易造成死锁,对长时间才能获得到锁的情况,使用自旋锁容易造成CPU效率低,只有内核可抢占式或SMP情况下才真正需要自旋锁6.多线程程序架构,线程数量应该如何设置?应尽量和CPU核数相等或者为CPU核数+1的个数7.有一个计数器,多个线程都需要更新,会遇到什么问题,原因是什么,应该如何做?如何优化?有可能一个线程更新的数据已经被另外一个线程更新了,更新的数据就会出现异常,可以加锁,保证数据史新只会被一个线程完成
- 2020-11-27下载
- 积分:1