[subject] + 同时 + [verb phrase]
在 + [verb phrase] + 的同时,[sentence]
[sentence],同时 + [sentence]
同时 says two things happen at once. Before a verb, it means "simultaneously"; the subject is often two people or two actions.
在 + verb phrase + 的同时 sets one activity as the background for another: "while doing X". The main clause often has 也 or 还.
At the head of a clause, 同时 adds another fact or requirement of equal weight, like "also" or "at the same time". This use is common in writing and formal speech.
一边…一边 describes one person doing two physical actions together, and is spoken: 一边吃饭一边看电视. 同时 is neutral, works for any two events, and doesn't need the same subject.
与此同时 "meanwhile", which links two whole sentences in writing, has its own point.