Hi
Why is Substrate of Nmos or Pmos always connected to gnd or vdd respectively. Wouldnt it be better to short it to source so as to avoid body effect?
The reason is cost and capacitance. To short the source-body junction of more than one device, these distinct devices each have to be in their own well. So, the packing density of the devices goes down, increasing cost. Also, since how you've diffused or implanted a well into your substrate, you will have additional capacitance which can impact performance.
The key trade off is cost. Also, if you're talking about integrated circuits, most processes only provide one flavor of well (n-well or p-well). That means you can source-body connect either your NMOS devices or your PMOS devices, but not both (which depends on the process).