The Shirriffs, also known as "the Watch", were the only form of law enforcement in the Shire, and the closest thing to a form of defense or deterrent that Hobbit society possessed.
The position of Shirriff was a voluntary honor. There were a total of twelve Shirriffs at a time, three for each Farthing, though more could be appointed in time of need (as happened around TA 3001). Shirriffs were distinguished merely by a feather worn in their hats. They carried sturdy walking sticks, with which they kept "strange folks" and menaces at bay, giving them enough time to call any needed reinforcements.
The Shirriffs were probably based on some form of ancient tradition, possibly dating back to the Kingdom of Arnor. But as the Shire was a peaceful place, their only purpose was protecting the Shire from trespassers. They were also possibly responsible for deputizing hobbits into service of the Bounders, who patrolled the borders.
When Lotho Sackville-Baggins ruled the Shire under Saruman during the War of the Ring, he took personal control of the Shirriffs service under the title "Chief Shirriff". The Shirriffs were increased in number, many against their will, and those that already were appointed couldn't quit; but some liked it or even signed up, and were organized into troops or companies such as the First Eastfarthing Troop, and supported by the Ruffians. The Shirriffs were also armed far more heavily than previously. Their orders during these troubled times were to arrest anyone who broke the rules.
The term Shirriff is most likely based upon "Shire Reeve", the Anglo-Saxon term that eventually gave rise to the word "Sheriff" in modern English. Shire being analogous to "county" and "reeve" being an English term for an appointed official who represents a landlord.