The media scanner runs in a separate CPU thread in the host, hence minimising potential impacts on CasparCG server outputs (and inputs). The SVT client accesses the media lists and thumbnails via AMCP commands sent to the server.
The scanner also exposes some path endpoints, such as
localhost:8000/tls enabling a third party application to create a media browsing interface on a web browser. The list of exposed access paths is available here.
You can restart the server with the scanner still running. Of course if there has been a glitch in tthe server, for example by a hardware issue, it does no harm to restart both. It is also good practice to keep the scanner running if you are adding or removing files in the media and template folders.