Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!news2.euro.net!newsfeed.freenet.ag!news.space.net!news.m-online.net!.POSTED!not-for-mail From: Wolfgang Draxinger Newsgroups: comp.lang.java.programmer,comp.lang.c Subject: Re: Arithmetic overflow checking Date: Thu, 8 Sep 2011 21:12:43 +0200 Organization: (posted via) M-net Telekommunikations GmbH Lines: 18 Message-ID: <20110908211243.7932aa0c@loki.yggdrasil.draxit.de> References: <015aeb15-57db-48ab-9cd4-77f8448b632f@w24g2000yqw.googlegroups.com> <2rydnez7l-H5BYnTnZ2dnUVZ_vGdnZ2d@earthlink.com> <9LWdnZH2hdfmyYvTnZ2dnUVZ_vidnZ2d@posted.palinacquisition> <3797038f-22d1-40b2-8c12-60db5a0976b8@t5g2000yqj.googlegroups.com> <20110908210243.710b9d01@loki.yggdrasil.draxit.de> NNTP-Posting-Host: ppp-188-174-60-249.dynamic.mnet-online.de Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: news.m-online.net 1315509164 10736 188.174.60.249 (8 Sep 2011 19:12:44 GMT) X-Complaints-To: news@news.m-online.net NNTP-Posting-Date: Thu, 8 Sep 2011 19:12:44 +0000 (UTC) X-Newsreader: Claws Mail 3.7.8 (GTK+ 2.20.1; x86_64-pc-linux-gnu) Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:7711 comp.lang.c:10030 Am Thu, 8 Sep 2011 21:02:43 +0200 schrieb Wolfgang Draxinger : > To give you some figures: Processing an interrupt takes Linux about 1 > to 10=C2=B5s. On a 3GHz CPU that amounts to 30000 clockcycles, and most > modern, pipelined CPUs finish at least 1 instruction per clock cycle; > on a Intel Pentium or Core for the majority of instructions have a up > to 8 finished instructions per clock cycle. In the time your proposed > overflow-check interrupt is processed you can do about 200000 flag > checks. Well, I was off by a factor of ~10. The typical Linux ISR takes about 2000 clock cycles. Still going such a long way is still a lot slower than checking the flag in under a cycle. Wolfgang