Web workers allow running scripts in parallel to the main page thread using message passing. Service workers are a specific type of web worker that enable persistent background processing and features like push notifications and offline caching. They have a lifecycle that is independent of pages and provide event-driven processing and version management. While dedicated and shared workers are created and controlled at runtime, service workers are installed in the browser and provide persistent background processing capabilities even when pages aren't active.