I have heard many exchange works like, Holds all their users funds into the exchange main wallet not directly to their user's wallet. These exchange just provide a deposit address to their users for depositing BTC or ETH and their users are never given private keys. So when a deposit is done under any user's address, Its actually transferred into the exchange main wallet at the same time or at the time of selling coin? Selling coins to exchange does not cost any fee for miners?
I want to learn more regarding this matter, Can anyone redirect me to any link that can explain this in easy words and easy way to setup such wallet?