To the naked, untrained eye, an AR barrel looks like one solid piece of metal. However, it’s actually TWO!
The barrel is threaded and the barrel extension is attached. The extension houses the feed ramps and is what sits inside the upper receiver in order to improve accuracy. The index pin sits inside the notch in the upper receiver to ensure the barrel seats properly.
Got some time to kill? Check out the patent application for the barrel extension here: http://www.patentsencyclopedia.com/app/20160010938