⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 realtime.html

📁 unix 下的C开发手册,还用详细的例程。
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html><head><!-- Copyright 1997 The Open Group, All Rights Reserved --><title>Realtime</title></head><body bgcolor=white><center><font size=2>The Single UNIX &reg; Specification, Version 2<br>Copyright &copy; 1997 The Open Group</font></center><hr size=2 noshade><blockquote><center><h3><a name = "tag_000_008">&nbsp;</a>Realtime</h3></center><xref type="2" name="realtime"></xref>This section defines system interfaces to support the sourceportability of applications with realtime requirements.<p>The definition of<i>realtime</i>used in defining the scope of XSI provisions is:<div><dl compact><dt> <dd>Realtime in operating systems: the ability of the operating systemto provide a required level of service in a bounded response time.</dl></div><p>The key elements of defining the scope are:<ol><p><li>defining a sufficient set of functionality to cover a significant partof the realtime application program domain, and<p><li>defining sufficient performance constraintsand performance-related functions to allow a realtime applicationto achieve deterministic response from the system.<p></ol><p>Specifically within the scope, it is required to define interfacesthat do not preclude high-performance implementations ontraditional uniprocessor realtime systems.<p>Wherever possible, the requirements of other application environments areincluded in this interface definition.It is beyond the scope of these interfaces to support networking ormultiprocessor functionality.<p>The specific functional areas included in this section and their scopeinclude:<ul><p><li><i>Semaphores</i>:A minimum synchronisation primitive to serve as a basisfor more complex synchronisation mechanismsto be defined by the application program.<p><li><i>Process memory locking</i>:A performance improvement facility to bind application programsinto the high-performance random access memoryof a computer system.This avoids potential latencies introducedby the operating system in storingparts of a program that were not recently referencedon secondary memory devices.<p><li><i>Memory mapped files</i> and<i>shared memory objects</i>: A performance improvement facility to allow forprograms to access files as part of the address space andfor separate application programs to have portions of their addressspace commonly accessible.<p><li><i>Priority scheduling</i>:A performance and determinism improvement facility to allow applicationsto determine the order in which threads that are ready to runare granted access to processor resources.<p><li><i>Realtime signal extension</i>:A determinism improvement facility that augments the BASE signals mechanismto enable asynchronous signal notifications to anapplication to be queued without impacting compatibility with the existingsignals interface.<p><li><i>Timers</i>:A functionality and determinism improvement facility to increase theresolution and capabilities of the time-base interface.<p><li><i>POSIX Interprocess communication</i>:A functionality enhancement to add a high-performance,deterministic interprocess communication facility for local communication.Network transparency is beyond the scope of this interface.<p><li><i>Synchronised input and output</i>:A determinism and robustness improvement mechanismto enhance the data input and output mechanisms,so that an application can insure that the data being manipulatedis physically present on secondary mass storage devices.<p><li><i>Asynchronous input and output</i>:A functionality enhancement to allow an application processto queue data input and output commands with asynchronousnotification of completion.This facility includes in its scopethe requirements of supercomputer applications.<p></ul><p>All the interfaces defined in the Realtime Feature Group will beportable, although some of the numeric parameters used by animplementation may have hardware dependencies.<h4><a name = "tag_000_008_001">&nbsp;</a>Signal Generation and Delivery</h4><p>Some signal-generating functions, such ashigh-resolution timer expiration,asynchronous I/O completion, interprocess message arrival, and the<i><a href="sigqueue.html">sigqueue()</a></i>function, support the specification of an application-defined value,either explicitly as a parameter to the function or in a<b>sigevent</b>structure parameter.The<b>sigevent</b>structure is defined in<i><a href="signal.h.html">&lt;signal.h&gt;</a></i>and contains at least the following members:<p><table  bordercolor=#000000 border=1 align=center><tr valign=top><th align=center><b>Member Type</b><th align=center><b>Member Name</b><th align=center><b>Description</b><tr valign=top><td align=left>int<td align=left>sigev_notify<td align=left>Notification type<tr valign=top><td align=left>int<td align=left>sigev_signo<td align=left>Signal number<tr valign=top><td align=left>union sigval<td align=left>sigev_value<td align=left>Signal value<tr valign=top><td align=left>void(*)(unsigned sigval)<td align=left>sigev_notify_function<td align=left>Notification<tr valign=top><td align=left>(pthread_attr_t*)<td align=left>sigev_notify_attributes<td align=left>Notification attributes</table><p>The<i>sigev_notify</i>member specifies the notification mechanism to usewhen an asynchronous event occurs.This document defines the following values for the<i>sigev_notify</i>member:<dl compact><dt>SIGEV_NONE<dd>No asynchronous notification will be deliveredwhen the event of interest occurs.<dt>SIGEV_SIGNAL<dd>A queued signal, with an application-defined value, will be generatedwhen the event of interest occurs.<dt>SIGEV_THREAD<dd>A notification function will be called to perform notification.</dl><p>An implementation may define additional notification mechanisms.<p>The<i>sigev_signo</i>member specifies the signal to be generated.The<i>sigev_value</i>member is the application-defined valueto be passed to the signal-catching functionat the time of the signal delivery as the<i>si_value</i>member of the<b>siginfo_t</b>structure.<p>The<b>sigval</b>union is defined in<i><a href="signal.h.html">&lt;signal.h&gt;</a></i>and contains at least the following members:<p><table  bordercolor=#000000 border=1 align=center><tr valign=top><th align=center><b>Member Type</b><th align=center><b>Member Name</b><th align=center><b>Description</b><tr valign=top><td align=left>int<td align=left>sival_int<td align=left>Integer signal value<tr valign=top><td align=left>void *<td align=left>sival_ptr<td align=left>Pointer signal value</table>The<i>sival_int</i>member is used when the application-defined value is of type<b>int</b>;the<i>sival_ptr</i>member is used when the application-defined value is a pointer.<p>When a signal is generated by the<i><a href="sigqueue.html">sigqueue()</a></i>functionor any signal-generating function that supports the specificationof an application-defined value,the signal is marked pending and, if the SA_SIGINFOflag is set for that signal, the signal is queued to the processalong with the application-specified signal value.Multiple occurrences of signals so generated are queued in FIFO order.It is unspecified whether signals so generated are queued when theSA_SIGINFO flag is not set for that signal.<p>Signals generated by the<i><a href="kill.html">kill()</a></i>function or other events that cause signals to occur,such as detection of hardware faults,<i><a href="alarm.html">alarm()</a></i>timer expiration, or terminal activity,and for which the implementation does not support queuing,have no effect on signals already queued for the same signal number.<p>When multiple unblocked signals, all in the rangeSIGRTMIN to SIGRTMAX, are pending,the behaviour is as ifthe implementation delivers the pending unblocked signalwith the lowest signal number within that range.No other ordering of signal delivery is specified.<p>If, when a pending signal is delivered,there are additional signals queued to that signal number,the signal remains pending.Otherwise, the pending indication is reset.<h4><a name = "tag_000_008_002">&nbsp;</a>Asynchronous I/O</h4>An asynchronous I/O control block structure<b>aiocb</b>is used in many asynchronous I/O function interfaces.It is defined in<i><a href="aio.h.html">&lt;aio.h&gt;</a></i>and has at least the following members:<p><table  bordercolor=#000000 border=1 align=center><tr valign=top><th align=center><b>Member Type</b><th align=center><b>Member Name</b><th align=center><b>Description</b><tr valign=top><td align=left>int<td align=left>aio_fildes<td align=left>File descriptor<tr valign=top><td align=left>off_t<td align=left>aio_offset<td align=left>File offset<tr valign=top><td align=left>volatile void*<td align=left>aio_buf<td align=left>Location of buffer<tr valign=top><td align=left>size_t<td align=left>aio_nbytes<td align=left>Length of transfer<tr valign=top><td align=left>int<td align=left>aio_reqprio<td align=left>Request priority offset<tr valign=top><td align=left>struct sigevent<td align=left>aio_sigevent<td align=left>Signal number and value<tr valign=top><td align=left>int<td align=left>aio_lio_opcode<td align=left>Operation to be performed</table><p>The<i>aio_fildes</i>element is the file descriptor on which the asynchronous operation isto be performed.<p>If O_APPEND is not set for the file descriptor<i>aio_fildes</i>,and if<i>aio_fildes</i>is associated with a device that is capable of seeking,then the requested operation takes place at the absolute position inthe file as given by<i>aio_offset</i>,as if<i><a href="lseek.html">lseek()</a></i>were called immediately prior to the operation with an<i>offset</i>argument equal to<i>aio_offset</i>and a<i>whence</i>argument equal toSEEK_SET .If O_APPEND is set for the file descriptor, or if<i>aio_fildes</i>is associated with a device that is incapable of seeking,write operations append to the file in the same order as the callswere made,with the following exception.Under implementation-dependent circumstances,such as operation on a multiprocessor orwhen requests of differing priorities are submitted at the same time,the ordering restriction may be relaxed.After a successful call to enqueue an asynchronous I/O operation,the value of the file offset for the file is unspecified.The<i>aio_nbytes</i>and<i>aio_buf</i>elements are the same as the<i>nbyte</i>and<i>buf</i>arguments defined by<i><a href="read.html">read()</a></i>and<i><a href="write.html">write()</a></i>respectively.<p>If _POSIX_PRIORITIZED_IO and _POSIX_PRIORITY_SCHEDULINGare defined, then asynchronous I/O is queued in priority order,with the priority of each asynchronous operation based on thecurrent scheduling priority of the calling process.The<i>aio_reqprio</i>member can be used to lower (but not raise)the asynchronous I/O operation priorityand will be within the range zero throughAIO_PRIO_DELTA_MAX, inclusive.The order of processing of requestssubmitted by processes whose schedulers are notSCHED_FIFO or SCHED_RR is unspecified.The priority of an asynchronous request is computed as(process scheduling priority) minus<i>aio_reqprio</i>.The priority assigned to each asynchronous I/O request is anindicationof the desired order of execution of the requestrelative to other asynchronous I/O requests for this file.If _POSIX_PRIORITIZED_IOis defined, requests issued with the same priority to a characterspecial file will be processed by the underlying device in FIFOorder;the order of processing of requests of the same priority issued tofilesthat are not character special files is unspecified.Numerically higher priority values indicate requests of higherpriority.The value of<i>aio_reqprio</i>has no effect on process scheduling priority.When prioritized asynchronous I/O requests to the same fileare blocked waiting for a resource required for that I/O operation,the higher-priority I/O requests will be granted the resourcebefore lower-priority I/O requests are granted the resource.The relative priority of asynchronous I/O and synchronous I/Ois implementation-dependent.If _POSIX_PRIORITIZED_IO is defined,the implementation defines for which filesI/O prioritization is supported.<p>The<i>aio_sigevent</i>determines how the calling process will be notified upon I/O completionas specified in<xref href=siggendel><a href="sigaction.html#tag_000_008_620_001">Signal Generation and Delivery</a></xref>.If<i>aio_sigevent.sigev_notify</i>is SIGEV_NONE, then no signal will be posted upon I/O completion,but the error status for the operation and the return status for the operationwill be set appropriately.<p>The<i>aio_lio_opcode</i>field is used only by the<i><a href="lio_listio.html">lio_listio()</a></i>call.The<i><a href="lio_listio.html">lio_listio()</a></i>call allows multiple asynchronous I/O operations to be submittedat a single time.The function takes as an argument an array of pointers to<b>aiocb</b>structures.Each<b>aiocb</b>structure indicates the operation to be performed (read or write)via the<i>aio_lio_opcode</i>field.<p>The address of the<b>aiocb</b>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -