Heinlein also tackled some of these problems with generation ships in Orphans of the Sky[1].
1: https://en.wikipedia.org/wiki/Orphans_of_the_Sky