This paper presents the technique for implementing a ‘sync to ID number’ function and a FOR_EACH_SECTOR macro. The sync to ID number function causes each sector to sync to exactly the same point in the code. This functionality is not currently available using the existing SyncStations() API. The FOR_EACH_SECTOR macro is similar to the FOR_EACH_SITE macro, but instead loops individually though each sector, rather than each site.
The problem that needs to be solved comes from the implementation of the SyncStations(int iSyncId) command available to users as an MST API. The way this command is currently implemented, although the iSyncId ID number of the sync point is available for debug purposes, the sectors are not guaranteed to sync to the same ID point in the program. This means that when trying to sync the sectors together the user can easily end up causing the sectors to ‘ping-pong’ instead. As we will explain in the paper there are many times the provided APIs are more than sufficient. But there can be problems in multiple cases.
This paper presents a solution to these problems using the cross-sector, shared memory resources of TerMSTapp to write user application code that is aware of the sync point that other sectors are at. It also tracks if the sector is frozen a that sync ID point, or if it is between sync points. Using this information when sectors get out of sync ‘lagging’ sectors are freed to catch up to ‘leading’ sectors and only the front most sector is paused at a sync point as all of the other lagging sectors catch up to it. A user adjustable max sync wait time is also provided and discussed.
Finally, this paper discusses specific use cases where it is important to sync each sector to the exact same point of code in order to avoid the possibility of significant test escapes.