“After Sandy Hook, a lot of schools got very panicky and bought $5,000 buzzer systems,” Dr. Klinger said. “They bought the system that was breached by the intruder in the first 30 seconds of Sandy Hook. He shot out the door and walked into the school. So your buzzer system did absolutely no good.”

Ms. Rush said that everyone at the front office should be informed when a student has been suspended or expelled. A photo should be posted, and they should call 911 if the person appears.

“This happens in corporate America all the time,” she said. “Workplace violence, where the person comes back and wants to kill the boss.”

Dr. Klinger said that schools should invest in teachers who mingle with students in the lobby or in hallways as a way to learn about troubling behavior that may be brewing.

Even in a large school, the experts said, doors need to be manned by someone who knows the students and will recognize anyone who looks out of place. Dr. Klinger said that this should be a teacher, who relates to the students, not a security guard.

“If you want to take this to the extreme, you can ensure the safety of kids by locking them in a cell, but that’s a prison,” Dr. Klinger said. “This is not a prison. It’s not a shopping mall.”

What if you can’t run or hide?

Cultivate the survivor mentality, experts said. Fight. “If he’s coming no matter what, if you got that one guy who starts breaking the door out, you take every object in the room and you beat the hell out of him to disarm him, because you’re going to die if you don’t,” Ms. Rush said. “So you might as well take your chances of trying to fight.”

Ms. Rush gave the example of a professor who, as a gunman approached, took his phone out to look at pictures of his children one last time before he died. “But a female student jumped and ran and locked the door. She had survivor instinct.”