Bulletin number: 359 Products affected: D7214 D4214 D5214 Description: Using segment ordering Component: icconf Date: Mon Feb 4 18:09:49 GMT 1991 ----- Some people are not altogether clear about the use of segment ordering with icconf. So here are a few examples to help out. The basic principle is that the more negative the value assigned to each segment the lower in memory it will be placed. This doesn't mean that you can't use positive values or a mixture of both. The implications should become clear in the following examples. process(stacksize = 10K, heapsize = 10K, interface(...) ,order(stack = +3, code = +4) ) task1; process( stacksize = 10K , heapsize = 10K, interface(...) ,order(stack = -4, code = -2) ) task2; process( stacksize = 10K , heapsize = 10K, interface(...) ,order(stack = +5, code = -3) ) task3; Note that segments not mentioned in the order attribute such as heap and static in this case, are treated as if they had been given the value 0. Those segments assigned positive values are above the zero valued ones and those assigned negative values are below them. This produces the following memory map: ------------------ | stack task3 (+5) ------------------ | code task1 (+4) ------------------ | stack task1 (+3) ------------------ | heap task1 (implicit 0) ---- These segments are in default ------------------ order (page 211 C Toolset User Manual) | heap task2 (implicit 0) The heap for task1 is above that for ------------------ task2 and task3 as task1 is above task2 | heap task3 (implicit 0) and task3 in the *.cfs file. ------------------ Similar explanation for the static | static task1 (implicit 0) segment. ------------------ | | static task2 (implicit 0) | ------------------ | | static task3 (implicit 0) ------ ------------------ | code task2 (-2) ------------------ | code task3 (-3) ------------------ | stack task2 (-4) ------------------ LoadStart If we assign the same value to the code segments for two or more processes, then their order in memory depends on their order in the *.cfs file. The nearer to the top of the file that the process and its attributes are described, so the nearer to the top of memory that process will be placed. This applies to any group of segments of the same type. Example: process( stacksize = 10K , heapsize = 10K, interface(...) ,order(stack = -2, code = -3) ) task1; process( stacksize = 10K , heapsize = 10K, interface(...) ,order(stack = -1, code = -3) ) task2; ------------------ | heap task1 (implicit 0) ------------------ | heap task2 (implicit 0) ------------------ | static task1 (implicit 0) ------------------ | static task2 (implicit 0) ------------------ | stack task2 (-1) ------------------ | stack task1 (-2) ------------------ | code task1 (-3) ------------------ | code task2 (-3) ------------------ LoadStart If we assign the code segment of one process and the stack segment of another the same value, then the default ordering system is used to determine the order of the segments in memory. See page 211 of the C Toolset user manual for the default ordering. Example: process( stacksize = 10K , heapsize = 10K, interface(...) ,order(stack = +4, code = +1) ) task1; process( stacksize = 10K , heapsize = 10K, interface(...) ,order(stack = +1, code = +2) ) task2; ------------------ | stack task1 (+4) ------------------ | code task2 (+2) ------------------ | code task1 (+1) ------------------ | stack task2 (+1) ------------------ | heap task1 (implicit 0) ------------------ | heap task2 (implicit 0) ------------------ | static task1 (implicit 0) ------------------ | static task2 (implicit 0) ------------------ LoadStart In order to be absolutely clear, use the order attributes to uniquely specify each segment and don't leave any segment unmentioned. Alternatively, always use unique negative numbers for the values of those segments of interest, that way any segment not mentioned will be above those which are. Those which are mentioned will have a clear position by virtue of the unique numbers chosen for them.