Medical school is undergraduate medical education, whereas residency is graduate medical education. This classification makes sense, since most med. schools don't formally require the completion of a thesis for the MD degree. The U.S. MD degree is the rough equivalent of a foreign Baccalaureate of Medicine (e.g. the UK's MBBS).