The medullary cavity is a central cavity found within the diaphysis of long bones. This cavity is primarily responsible for housing the bone marrow, which plays a crucial role in the production of blood cells. The medullary cavity is lined by a thin vascular membrane known as the endosteum.