?? 00000009.htm
字號:
serial port <br />some Ethernet cards <br />most harddisk/SCSI drivers <br />most CD-ROM drivers <br />Especially for the serial port, it would be very nice to have a way to <br />switch to low dispatch latency interrupt handling, such that an <br />application can react as fast as possible on any incoming serial byte. <br />Apart from the "fast" interrupt handler type, another important cause <br />of latency in the serial port are the 16550 FIFO UARTs. At the moment, <br />the UARTs are configured to trigger an interrupt (except for for bit <br />rates < 2400 bit/s) only if the FIFO is filled with at least eight <br />bytes or if an UART timeout has occured (this happens after four <br />character transmission times). The 16550 chip can be configured to <br />trigger limits 1, 4, 8, and 14, but Linux currently provides no <br />ioctl() for this. For details about the FIFO UART, please consult the <br />National Semiconductor PC16550D data sheet. <br />For real-time applications, it would be very desirable to change the <br />FIFO trigger limit to one byte so that incoming serial bytes are <br />immediately delivered to the waiting process. Applications that depend <br />heavily on minimum serial port interrupt dispatch latency are for <br />example MIDI music systems, DCF77 reference time long-wave radio signal <br />receivers in Europe, packet radio network interfaces, and ISO 7816 <br />smartcard interfaces. <br />Some existing work in this area: <br />Stuart Cheshire <<a href="mailto:cheshire@DSG.Stanford.EDU>">cheshire@DSG.Stanford.EDU></a> has implemented a "smart" <br />interrupt handler that can switch between the classic "fast" and <br />"slow" alternatives (see <URL:<a href="http://mosquitonet.stanford.edu/">http://mosquitonet.stanford.edu/</a> <br />smartirq.html> for details). This way, you can get the real-time <br />advantage of "slow" handling for the serial port without introducing a <br />permanent system overhead even when no real-time application is <br />active. <br />Nick Simicich <<a href="mailto:njs@scifi.emi.net>">njs@scifi.emi.net></a> and Rik Faith <<a href="mailto:faith@cs.unc.edu>">faith@cs.unc.edu></a> <br />have written a program called "cytune" which can change the FIFO <br />thresholds for individual ports in the Cyclades async mux driver. <br />Problem 2: Timer resolution <br />On most Linux architectures, a timer interrupt occurs every 10 ms (HZ <br />= 100). One exception is the Alpha architecture, where the timer <br />interrupt comes every 1 ms (HZ = 1024). The macro HZ, which specifies <br />the timer frequency, is defined in <asm/param.h>. At the moment, the <br />kernel timer mechanism, on which the itimer and nanosleep <br />implementation is based, checks after each timer interrupt whether a <br />software timer has expired, makes the corresponding process runnable <br />again, and calls the scheduler. This means that a highest priority <br />real-time process can have to wait up to 2 * (1 s / HZ) = 20 ms longer <br />than requested. <br />An excellent solution would be to implement an interrupt-on-demand <br />timer facility. The 8253 timer/counter chip in the PC would then have <br />to be programmed such that it delivers an interrupt with microsecond <br />precision exactly at the time when a software timer expires. This <br />would increase the software timer precision by a factor of 10 000! As <br />the 8253 timer would be programmed in a single shot mode, a lost <br />interrupt might cause an accidental system halt. If this is problem, <br />the CMOS battery clock, which can also be used to implement periodic <br />interrupts, should be utilized to trigger periodic calls to the <br />scheduler in order to ensure process preemption and kernel clock <br />update. The time stamp counter (TSC) available in all Pentium <br />processors is a 64-bit counter clocked at CPU frequency. It can be <br />used on Pentium systems in order to get extremely precise timing <br />information with theoretically close to nanosecond resolution and <br />without overflow problems. <br />Literature <br />---------- <br />For those of you who have become interested in POSIX.1b, there exists <br />a good book: <br />Bill O. Gallmeister, POSIX.4 -- Programming for the Real World, <br />O'Reilly & Associates, 1995, ISBN 1-56592-074-0. <br />This book is not only a good introduction into POSIX.1b (which was <br />originally called POSIX.4), it is also an easy reading nice way into <br />the world of real-time operating systems for those developers who have <br />so far been very UNIX and time-sharing oriented. <br />You can order the POSIX.1b standard (officially called IEEE Std <br />1003.1b-1993; this book includes also all text of POSIX.1 and costs <br />114 USD) as well as the other POSIX standards directly from IEEE: <br />phone: +1 908 981 1393 (TZ: eastern standard time) <br />1 800 678 4333 (from US+Canada only) <br />fax: +1 908 981 9667 <br />e-mail: <a href="mailto:stds.info@ieee.org">stds.info@ieee.org</a> <br />Information about POSIX and other IEEE standards is also available on <br /><URL:<a href="http://stdsbbs.ieee.org/>">http://stdsbbs.ieee.org/></a> and <URL:<a href="http://www.knosof.co.uk/">http://www.knosof.co.uk/</a> <br />posix.html>, however unfortunately the full standard documents are <br />only available as books or on CD-ROM, not on the Internet. Having <br />access to the POSIX specs is certainly a good idea for any Linux <br />kernel hacker. <br />Here is a brief list of some of the POSIX standards: <br />POSIX.1 Basic OS interface (C language) <br />POSIX.1a Misc. extensions (symlinks, etc.) <br />POSIX.1b Real-time and I/O extensions (was: POSIX.4) <br />POSIX.1c Threads (was: POSIX.4a) <br />POSIX.1d More real-time extensions (was: POSIX.4b) <br />POSIX.1e Security extensions, ACLs (was: POSIX.6) <br />POSIX.1f Transparent network file access (was: POSIX.8) <br />POSIX.1g Protocol independent communication, sockets (was: POSIX.12) <br />POSIX.1i Technical corrections to POSIX.1b <br />POSIX.2 Shell and common utility programs (date, ln, ...) <br />POSIX.3 Test methods <br />POSIX.5 ADA binding to POSIX.1 <br />POSIX.7 System administration <br />POSIX.9 FORTRAN-77 binding to POSIX.1 <br />POSIX.15 Supercomputing extensions (checkpoint/recovery, etc.) <br />and a few others which are still in early draft stage. If you want to <br />follow progress on POSIX standardization, you should read the <br />announcements in the moderated USENET group comp.std.unix. The current <br />status of POSIX drafts is summarized in <URL:<a href="http://stdsbbs.ieee.org/">http://stdsbbs.ieee.org/</a> <br />groups/pasc/standing/sd11.html>. <br />ISO has also published POSIX.1 as ISO/IEC 9945-1:1990. ISO and IEEE <br />will soon publish the new revision of this standard: ISO/IEC <br />9945-1:1996. This will be the new 1996 revision of POSIX.1, which will <br />contain in one single standard POSIX.1(1990), POSIX.1b(1993), <br />POSIX.1c(1995), and POSIX.1i(1995) (perhaps also POSIX.1a(1996) if it <br />gets ready in time). If you want to order the POSIX standard but are <br />not in a hurry, may be it is a good idea to wait a few months until <br />ISO/IEC 9945-1:1996 is available. All differences between <br />POSIX.1(1990) and POSIX.1(1996) will be marked by bars at the page <br />margins. <br />This text just summarizes POSIX.1b and related work on Linux. Many <br />people interested in POSIX.1b support seem also to be interested in <br />POSIX.1c support (threads). Some information about POSIX.1c support is <br />on <URL:<a href="http://www.mit.edu:8001/people/proven/pthreads.html>">http://www.mit.edu:8001/people/proven/pthreads.html></a> and <br /><URL:<a href="http://www.aa.net/~mtp/>.">http://www.aa.net/~mtp/>.</a> There is now a production release <br />package called "PCthreads (tm) POSIX threads for Linux" available from <br /><URL:<a href="ftp://sunsite.unc.edu/pub/Linux/devel/lang/c/>.">ftp://sunsite.unc.edu/pub/Linux/devel/lang/c/>.</a> It is maintained <br />by Michael T. Peterson <<a href="mailto:mtp@big.aa.net>.">mtp@big.aa.net>.</a> A POSIX.1c package that <br />provides real kernel-threads using the clone() system call is <br />available from <URL:<a href="http://pauillac.inria.fr/~xleroy/linuxthreads/>">http://pauillac.inria.fr/~xleroy/linuxthreads/></a> <br />and has been developed by Xavier Leroy <<a href="mailto:Xavier.Leroy@inria.fr>.">Xavier.Leroy@inria.fr>.</a> <br />Markus <br />-- <br />Markus Kuhn, Computer Science student -- University of Erlangen, <br />Internet Mail: <<a href="mailto:mskuhn@cip.informatik.uni-erlangen.de>">mskuhn@cip.informatik.uni-erlangen.de></a> - Germany <br />WWW Home: <<a href="http://wwwcip.informatik.uni-erlangen.de/user/mskuhn>">http://wwwcip.informatik.uni-erlangen.de/user/mskuhn></a> <br /> <br />-- <br /> <br />※ 來源:·BBS 水木清華站 smth.org·[FROM: 166.111.161.11] <br /><a href="00000008.htm">上一篇</a><a href="javascript:history.go(-1)">返回上一頁</a><a href="index.htm">回到目錄</a><a href="#top">回到頁首</a><a href="00000010.htm">下一篇</a></h1></center><center><h1>BBS 水木清華站∶精華區(qū)</h1></center></body></html>
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -