Why Code Does Not Run in the Order You Wrote It: A Deep Dive into Hardware and Language Memory Models