精通
英语
和
开源
,
擅长
开发
与
培训
,
胸怀四海
第一信赖
锐英源精品开源心得,转载请注明:“锐英源www.wisestudy.cn,孙老师作品,电话13803810136。需要全文内容也请联系孙老师。
Barriers, are defined in the advanced real-time POSIX (IEEE Std 1003.1-2001), as part of the advanced real-time threads extensions. A barrier is a simple and efficient synchronisation utility. A barrier ensures that all processes in a group are ready before any of them proceed.
同步屏障,被定义在高级实时POSIX(IEEE标准1003.1-2001)中,做为高级实时线程扩展的一部分。一个同步屏障是一种简单而高效的同步实用程序。同步屏障确保所有的过程全部都准备好然后在继续。
It is a high-level RTLinux component, since it do not modifies the existing RTLinux kernel, but adds functionalities to it.
它是一个高级RTLinux组件,因为它不修改现有RTLinux内核,但增加了功能。
The API is defined by the POSIX standard. Here is a list of the functions that are going to be implemented.
定义的API是POSIX标准。这里是一个列表的功能实现。
Basically, the implementation will consist of two files (pthread_barrier.c and pthread_barrier.h) that implements the functions of the API. This component must not be implemented by means of a mutex, since this is an inefficient method.
基本上,实现将包含两个文件(pthread的barrier.c和pthread的barrier.h)实现API的功能。这个组件不能通过一个互斥对象实现,因为这是一个低效率的方法。
In order to test the correct behaviour of Posix Barriers, some tests will be provided with the component. Some debugging code will be inserted to validate the component. A barrier can be used to force periodic threads to execute its first activation at the first time. In real-time scheduling theory this is called the critical instant, that is, when all threads want to execute its first activation at the first time. Therefore, barriers will be very useful to implement this synchronisation. The test, in this case, will consist of one barrier. All threads block on the barrier before making periodic. When the last thread arrives to the barrier, then all threads are allowed to continue execution. The chronogram generated must prove how all threads stop before making periodic and are active at the same time.
为了测试正确的Posix同步屏障行为,,将提供一些测试与组件。一些调试代码会插入验证组件。同步屏障可以用来迫使周期性线程在第一时间执行首次激活。当所有线程想要在第一时间执行首次激活,在实时调度理论这叫做临界时刻,。因此,屏障实现这种同步非常有用。测试中,在这种情况下,将包括一个屏障。所有线程在实行定期之前阻塞屏障。当最后一个线程到达屏障,然后所有线程被允许继续执行。生成的定时器必须证明所有线程停止,随后再周期活跃和在同一时间激活。
It also can be implemented some tests to use barriers with client-server systems. For example, as a simple test one thread can write on a fifo whenever other thread wants. This can be implemented by means of a barrier. When the client enters the barrier, then the other thread can follow its execution that consists of a rt_fifo writing operation. The results can be observed in the console.
它还可以实现一些测试,在客户机-服务器环境下的同步屏障测试。举个例子,一个简单的测试,线程能写入到fifo,而它是一个其他线程想要的。这可以通过一个屏障来实现。当客户端进入屏障,那么其他线程可以按照它的执行,包含先进先出写入操作。结果可以在控制台中观察到。
The proposed implementation will relay on special processor instructions to achieve low overhead, instead of using mutexes to synchronise processes.
建议的实施将依赖特殊的处理器指令来实现低开销,代替使用互斥来同步进程。