190 likes | 323 Views
Message Passing in VDK. Agenda. Review Of Semaphores Introduction To Message Passing Advantages and Disadvantages Using Message Passing with VDK An Unsuccessful Example A Successful Example Summary Questions. Review Of Semaphores.
E N D
Agenda • Review Of Semaphores • Introduction To Message Passing • Advantages and Disadvantages • Using Message Passing with VDK • An Unsuccessful Example • A Successful Example • Summary • Questions
Review Of Semaphores • Semaphores allow processes to query and alter status information. • They are mainly used to control and monitor availability of system resources such as shared memory.
Message Passing • Message passing can provide the same control and monitoring of system resources as semaphores, but also send a buffer with additional information as well.
Advantages Of Message Passing • Useful if a shared memory architecture is not wanted or not possible. • One thread sends the necessary information or a pointer to that information to another thread.
Disadvantages Of Message Passing • Added communication overhead. • Can dramatically slow the system if large amounts of data need to be sent.
Using Message Passing in VDK • Basic message passing is accomplished through 4 VDK commands • id# CreateMessage(tag, size, pt_buffer) • void PostMessage(dest, pt_buffer, channel) • id# PendMessage(channel, timeout) • void GetMessagePayload(id#, tag, size, pt_buffer)
The Unsuccessful Attempt • Attempted to use 4 threads in a ring topology passing around an array containing all the thread ID numbers. • Encountered problems putting the second thread in the ring
The Unsuccessful Attempt • Added the functionality into this thread generated the following linker error: [Error li2007] Out of memory in memory segment "seg_pmco" in "p0". While processing the input section "seg_pmco" from file "dtor_list.doj" of size 0x2e words [Error li2007] Memory allocation errors. See the MAP file ".\Debug\individ.map" for details
The Unsuccessful Attempt • Apparently the memory layout in the 21061 LDF file is incorrect according to a bug report on Analog Devices Web page. (bug number 15425)
The Successful Attempt • Couldn’t fix the LDF file, so built a two thread ring instead of a four thread ring
Summary • Message passing does have advantages over using semaphores, especially when the architecture doesn’t allow for shared memory access • However, the overhead inherent to message passing can slow the overall performance of the system.
References • Visual DSP++ help files • Bug report 15425 at http://www.analog.com/processors/technicalSupport/toolsAnomalies.html