The peritoneal cavity is a potential space between the parietal peritoneum (the peritoneum that surrounds the abdominal wall) and visceral peritoneum (the peritoneum that surrounds the internal organs).
Both the parietal and visceral peritonea are not different but the same peritoneum given two names depending on their function/location. It is one of the spaces derived from the coelomic cavity of the embryo, the others being the pleural cavities around the lungs and the pericardial cavity around the heart.
It is the largest serosal sac, and the largest fluid-filled cavity, in the body and secretes approximately 50 mL of fluid per day. This fluid acts as a lubricant and has anti-inflammatory properties.