> Shouldn't there be a computer saying no to the scheduling or at least some rail safety system?
It's called Positive Train Control (PTC).
https://railroads.dot.gov/research-development/program-areas...
https://en.wikipedia.org/wiki/Positive_train_control#Deploym...
The wiki includes a lot of good details about the challenges, for example no unified implementation and many "optional" (but basic) features that don't have to be used (but should; i.e. real time tracking of cars and locomotives in an identical fashion). By itself it won't stop collisions -- but it's the tech that, if used correctly, should.
Rolling it out is also non-trivial, and making PTC 2.0 happen in the future has a lot of challenges. In many ways it's easier to automate aircraft than it is railroads: you have the entire sky, lots of room to move, great visibility once above a certain altitude, and different altitudes for stacking traffic (e.g. one plant at 10000 ft, another at 17000 ft, another at 20000 ft). The challenge is mostly emergencies, and how to land/take off. Trains, meanwhile, have to share space with a lot of things that planes never do, such as avalanches, broken down cars, and routes that run though residential areas.
Plus railroads have plenty of money and are publicly traded -- they lobby as good as anyone. Many of the recent issues aren't due to any fancy control systems (or lack thereof), but the Trump administration allowing hazardous materials to be re-labelled as non-hazardous, and thus allowing them to travel at higher speeds.