The separate stack and data requirement involves both assembler assumptions and coding techniques. If you used the FARSTACK keyword as described in Section 18.3.1, “Choosing Module Attributes,” the assembler makes correct assumptions about the contents of DS and SS.
Summary: Do not assume that SS equals DS.
In your own code, avoid any optimizing techniques that use SS to access items in the data segment or DS to access stack data. For example, the following code uses the ASSUME statement to be sure the correct stack is accessed:
ASSUME DS:DGROUP
.
.
.
push ds
lds si, sourcead ; Load DS for string ops
ASSUME DS:NOTHING
.
.
.
ASSUME SS:STACK
mov bx, ss:thing ; Access near data thing through SS
ASSUME SS:NOTHING
Thread-specific variables can be stored on the stack, as shown in the example above.