SharePoint 2010 introduces new feature sandbox solution.Here are major difference between sandbox solution and farm solution.
1.The scope of sandbox solution is site collection where as The scope of farm level solution is farm level.
2.Sandboxed solutions, which are hosted in the SharePoint user code solution worker process (SPUCWorkerProcess.exe)Whereas Sandboxed solutions, which are hosted in the SharePoint user code solution worker process (SPUCWorkerProcess.exe)
3.Sandbox run code that can only affect the site collection of the solution.The process runs under a CAS policy that restricts programmatic access to any resource outside the sandbox.Whereas Farm Solution run code that can affect the whole farm.
4.Sandbox Never restart the IIS application pool.If you run any code it will affect only the site collection of the solution. Whereas If you deploy any feature or retract any feature the whole application pool got recycled in farm solution.
5.Sandboxed solutions are uploaded and activated whereas Farm solutions are installed and deployed.
6.we canÃ¢â¬â¢t create VISUAL web parts in Sandbox solutions whereas VISUAL web parts can be created in farm solution.
7.When the Sandboxed Solution property is set to True, selecting Build\Deploy Solution deploys the solution to the site collection Solution Gallery.whereas When the Sandboxed Solution property is set to False, selecting Build\Deploy will deploy the solution to the Farm Solution Gallery.