Let M be any simply-connected Gorenstein space over any field. Félix and Thomas have extended to simply-connected Gorenstein spaces, the loop (co)products of Chas and Sullivan on the homology of the free loop space H * (LM ). We describe these loop (co)products in terms of the torsion and extension functors by developing string topology in appropriate derived categories. As a consequence, we show that the Eilenberg-Moore spectral sequence converging to the loop homology of a Gorenstein space admits a multiplication and a comultiplication with shifted degree which are compatible with the loop product and the loop coproduct of its target, respectively.We also define a generalized cup product on the Hochschild cohomology HH * (A, A ∨ ) of a commutative Gorenstein algebra A and show that over Q, HH * (A P L (M ), A P L (M ) ∨ ) is isomorphic as algebras to H * (LM ). Thus, when M is a Poincaré duality space, we recover the isomorphism of algebras H * (LM ; Q) ∼ = HH * (A P L (M ), A P L (M )) of Félix and Thomas.