{"id":4551,"date":"2019-07-18T04:16:21","date_gmt":"2019-07-18T11:16:21","guid":{"rendered":"https:\/\/www.coretechnologies.com\/blog\/?p=4551"},"modified":"2022-04-19T21:58:54","modified_gmt":"2022-04-20T04:58:54","slug":"patterns","status":"publish","type":"post","link":"https:\/\/www.coretechnologies.com\/blog\/windows-services\/patterns\/","title":{"rendered":"Windows Service Patterns"},"content":{"rendered":"<div align=\"center\"><img loading=\"lazy\" decoding=\"async\" class=\"no-lazy-load image-padding\" src=\"\/blog\/images\/windows-service-patterns.webp\" title=\"Windows Service Patterns\" alt=\"Windows Service Patterns\" border=\"0\" width=\"272\" height=\"164\" \/><\/div>\n<p><a href=\"\/WindowsServices\/FAQ.html#WhatIsAWindowsService\">Windows Services<\/a> are special applications designed to run unattended on your PC. A service an do virtually anything its programmer demands, such as reading files, sending email, checking for viruses &mdash; whatever.<\/p>\n<p>Yet in the midst of that tremendous diversity, the vast majority of services have a lot in common. With inspiration from <a href=\"https:\/\/books.google.com\/books\/about\/Professional_NT_Services.html?id=Flen6TsOyqwC\" target=\"_blank\" rel=\"noopener noreferrer\">Professional NT Services<\/a>, it is our observation that the majority of windows services can be placed in one of four categories: <b>Server, Agent, Processor<\/b> or <b>Canary<\/b>.<\/p>\n<ol style=\"margin-left:1.3em;padding:0;\">\n<li>\n<h2 class=\"blog-caption\">Server: Accept and fulfill requests for services and\/or resources<\/h2>\n<p>The majority of Windows services implement the Server pattern. They typically act as the proxy\/gatekeeper to a well-defined area of the operating system, fulfilling requests as they come in.<\/p>\n<p>For example:<\/p>\n<ul>\n<li>\n<p><b><a href=\"\/blog\/windows-services\/spooler\/\">Spooler<\/a><\/b> implements the <a href=\"https:\/\/docs.microsoft.com\/en-us\/windows\/desktop\/printdocs\/print-spooler-api\" target=\"_blank\" rel=\"noopener noreferrer\">Print Spooler API<\/a>. It accepts print requests from desktop applications and negotiates with printers to ensure that they all documents are (eventually) printed.<\/p>\n<\/li>\n<li>\n<p><b>User Profile Service<\/b> is responsible for loading and unloading user information on behalf of all applications.<\/p>\n<\/li>\n<li>\n<p><b>Windows Event Log<\/b> records application, system and security events through the <a href=\"https:\/\/docs.microsoft.com\/en-us\/windows\/desktop\/wes\/using-windows-event-log\" target=\"_blank\" rel=\"noopener noreferrer\">Event Log API<\/a>.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<h2 class=\"blog-caption\">Agent: Perform a task regularly on behalf of a person<\/h2>\n<p>Many services implement the Agent pattern. They run in the background, performing requested tasks at pre-defined times.<\/p>\n<p>For example:<\/p>\n<ul>\n<li>\n<p><b>Google Update Service<\/b> keeps your Google software up to date, applying security patches and other improvements as they become available.<\/p>\n<\/li>\n<li>\n<p>The <b><a href=\"\/blog\/windows-services\/schedule\/\">Schedule<\/a><\/b> service works in conjunction with the <a href=\"https:\/\/en.wikipedia.org\/wiki\/Windows_Task_Scheduler\" target=\"_blank\" rel=\"noopener noreferrer\">Windows Task Scheduler<\/a>, launching each scheduled task at its appointed date and time.<\/p>\n<\/li>\n<li>\n<p><b>Windows Update<\/b> automatically detects, downloads, and installs of updates for Windows and other Microsoft programs.<\/p>\n<\/li>\n<\/ul>\n<li>\n<h2 class=\"blog-caption\">Processor: Watches for important events then takes action<\/h2>\n<p>A Processor springs to life in response to a triggering event. It has the autonomy to take action and resolve the issue at hand.<\/p>\n<p>For example:<\/p>\n<ul>\n<li>\n<p><b>Windows Time<\/b> ensures that your PC&#8217;s clock is correct, synchronizing it with clients and servers in the network.<\/p>\n<\/li>\n<li>\n<p><b>Background Intelligent Transfer Service<\/b> opportunistically transfers files in the background when network traffic is low.<\/p>\n<\/li>\n<li>\n<p><b>Bluetooth Support Service<\/b> supports the discovery and pairing of nearby Bluetooth devices.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<h2 class=\"blog-caption\">Canary: Notify a person (or application) when something important happens<\/h2>\n<p>A Canary is a special kind of Processor. It too watches for important events, but its primary task is to shout loudly instead of taking definitive action.<\/p>\n<p>For example:<\/p>\n<ul>\n<li>\n<p><b>Windows Defender Advanced Threat Protection Service<\/b> helps protect against advanced threats by monitoring and reporting security events that happen on the computer.<\/p>\n<\/li>\n<li>\n<p><b>System Event Notification Service<\/b> monitors system events and notifies subscribers to COM+ Event System of these events.<\/p>\n<\/li>\n<li>\n<p><b>Connected User Experiences and Telemetry<\/b> enables features that support in-application and connected user experiences. The service manages the event driven collection and transmission of diagnostic and usage information (used to improve the experience and quality of the Windows Platform) when the diagnostics and usage privacy option settings are enabled under Feedback and Diagnostics.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<h2 class=\"blog-caption\">Many desktop applications follow a Windows Service pattern too!<\/h2>\n<p>\nThose four patterns apply to regular desktop applications as well. Most notably:<\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/www.apple.com\/itunes\/\" target=\"_blank\" rel=\"noopener noreferrer\">iTunes<\/a> enables your Apple devices to play any track from your media library. <b>iTunes is a Server.<\/b><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/en.wikipedia.org\/wiki\/SyncToy\" target=\"_blank\" rel=\"noopener noreferrer\">SyncToy<\/a> will synchronize two file systems on demand. <b>SyncToy is an Agent.<\/b><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/www.dropbox.com\/\" target=\"_blank\" rel=\"noopener noreferrer\">Dropbox<\/a> watches your file system and copies updated files to the server. <b>Dropbox is a Processor.<\/b><\/p>\n<\/li>\n<li>\n<p><a href=\"http:\/\/www.almico.com\/speedfan.php\" target=\"_blank\" rel=\"noopener noreferrer\">SpeedFan<\/a> monitors your computer&#8217;s voltage, fan speeds and temperatures and lets you know when something is wrong. <b>SpeedFan is a Canary.<\/b><\/p>\n<\/li>\n<\/ul>\n<p>If you are responsible for a legacy\/desktop application that aligns with one of the four service patterns, you should consider <a href=\"\/products\/AlwaysUp\/\">installing it as a Windows Service<\/a>. It probably should have been built as a service in the first place!<\/p>\n<!-- relpost-thumb-wrapper --><div class=\"relpost-thumb-wrapper\"><!-- filter-class --><div class=\"relpost-thumb-container\"><style>.relpost-block-single-image, .relpost-post-image { margin-bottom: 10px; }<\/style><h3>You may also like...<\/h3><div style=\"clear: both\"><\/div><div style=\"clear: both\"><\/div><!-- relpost-block-container --><div class=\"relpost-block-container relpost-block-column-layout\" style=\"--relposth-columns: 3;--relposth-columns_t: 2; --relposth-columns_m: 2\"><a href=\"https:\/\/www.coretechnologies.com\/blog\/windows-services\/local-session-manager-service\/\"class=\"relpost-block-single\" ><div class=\"relpost-custom-block-single\"><img decoding=\"async\" loading=\"lazy\" class=\"relpost-block-single-image\" alt=\"Essential Windows Services: Local Session Manager \/ LSM\"  src=\"https:\/\/www.coretechnologies.com\/blog\/wp-content\/uploads\/local-session-manager-service-150x150-1.webp\" style=\"aspect-ratio:1\/1\" style=\"aspect-ratio:1\/1\"><\/img><div class=\"relpost-block-single-text\"  style=\"height: 75px;font-family: Arial;  font-size: 12px;  color: #333333;\"><h2 class=\"relpost_card_title\">Essential Windows Services: Local Session Manager \/ LSM<\/h2><\/div><\/div><\/a><a href=\"https:\/\/www.coretechnologies.com\/blog\/windows-services\/how-to-restart-at-specific-time\/\"class=\"relpost-block-single\" ><div class=\"relpost-custom-block-single\"><img decoding=\"async\" loading=\"lazy\" class=\"relpost-block-single-image\" alt=\"Q&amp;A: How do I Restart my Windows Service at a Specific Time every Week?\"  src=\"https:\/\/www.coretechnologies.com\/blog\/wp-content\/uploads\/restart-service-schedule-150x150-1.png\" style=\"aspect-ratio:1\/1\" style=\"aspect-ratio:1\/1\"><\/img><div class=\"relpost-block-single-text\"  style=\"height: 75px;font-family: Arial;  font-size: 12px;  color: #333333;\"><h2 class=\"relpost_card_title\">Q&amp;A: How do I Restart my Windows Service at a Specific Time every Week?<\/h2><\/div><\/div><\/a><a href=\"https:\/\/www.coretechnologies.com\/blog\/windows-services\/essential-tools-windows-services-sc-exe\/\"class=\"relpost-block-single\" ><div class=\"relpost-custom-block-single\"><img decoding=\"async\" loading=\"lazy\" class=\"relpost-block-single-image\" alt=\"Use SC.EXE to manage your Windows Service\"  src=\"https:\/\/www.coretechnologies.com\/blog\/wp-content\/uploads\/windows-sc-command-150x150.png\" style=\"aspect-ratio:1\/1\" style=\"aspect-ratio:1\/1\"><\/img><div class=\"relpost-block-single-text\"  style=\"height: 75px;font-family: Arial;  font-size: 12px;  color: #333333;\"><h2 class=\"relpost_card_title\">Essential Tools for Windows Services: SC.EXE<\/h2><\/div><\/div><\/a><\/div><!-- close relpost-block-container --><div style=\"clear: both\"><\/div><\/div><!-- close filter class --><\/div><!-- close relpost-thumb-wrapper -->","protected":false},"excerpt":{"rendered":"<p>Windows Services are special applications designed to run unattended on your PC. A service an do virtually anything its programmer demands, such as reading files, sending email, checking for viruses &mdash; whatever. Yet in the midst of that tremendous diversity, &hellip; <a href=\"https:\/\/www.coretechnologies.com\/blog\/windows-services\/patterns\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":7049,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[18],"tags":[114,196],"class_list":["post-4551","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-windows-services","tag-patterns","tag-windows-services-2"],"_links":{"self":[{"href":"https:\/\/www.coretechnologies.com\/blog\/wp-json\/wp\/v2\/posts\/4551","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.coretechnologies.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.coretechnologies.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.coretechnologies.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.coretechnologies.com\/blog\/wp-json\/wp\/v2\/comments?post=4551"}],"version-history":[{"count":3,"href":"https:\/\/www.coretechnologies.com\/blog\/wp-json\/wp\/v2\/posts\/4551\/revisions"}],"predecessor-version":[{"id":11236,"href":"https:\/\/www.coretechnologies.com\/blog\/wp-json\/wp\/v2\/posts\/4551\/revisions\/11236"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.coretechnologies.com\/blog\/wp-json\/wp\/v2\/media\/7049"}],"wp:attachment":[{"href":"https:\/\/www.coretechnologies.com\/blog\/wp-json\/wp\/v2\/media?parent=4551"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.coretechnologies.com\/blog\/wp-json\/wp\/v2\/categories?post=4551"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.coretechnologies.com\/blog\/wp-json\/wp\/v2\/tags?post=4551"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}