Computerized railway interlocking systems have seen significant evolution and improvement since their introduction in 1985 and have demonstrated a high level of safety and reliability in safety-critical systems. However, it is costly and troublesome to develop current interlocking systems to ensure safety. In this paper, we present a new approach which aims to significantly improve interlocking system safety and reliability and to curtail system costs by developing a component-based railway interlocking system (CBRIS). We illustrate a method of modeling CBRIS using deterministic and stochastic Petri nets (DSPNs). Based on this modeling method, we also discuss a method of analyzing the safety and reliability of the presented CBRIS.