According to this, either you or your tenant must give 30 days written notice:
http://www.mass.gov/ocabr/docs/landlordrights.pdf
So, unless your contract is more specific than that, it would be 30 calendar days.
If your roommate/tenant moves out without notice, then in my opinion, the day they move out would be considered day one of 30 days notice, so they'd owe you rent for the next 30 days.
However, in MA, landlords must make an effort to find a new tenant as soon as possible using reasonable means. So, you'd have to advertise for a new tenant right away. You don't have to take just anyone, they must meet your normal criteria
Then, you charge the leaving tenant who did not give notice, rent until the net tenant starts paying rent - but only until that 30 days is used up.
Make sure you follow the law in the brochure I linked to above, regarding what to do with the security deposit.