Click here to Skip to main content
15,886,110 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I am a .net developer working in web applications and from past few months I started working on windows applications and one application need to run every day at 12 noon so I wrote a web service with the help of google and it is working fine.

But I am just wondering how windows services work.
I read lot of posts and not one have answered my question.So coming forward in my own words.

According to my understanding in web service I create a scheduler using timer that runs all 24 hours and will execute the necessary code when the timer condition is met.

In scheduler I configure a scheduler that runs an application(which is a service in previous case) when the time condition is met.

Now my questions:

1. Regarding RAM usage?

I know services utilizes RAM. But considering if my code is heavy like lets consider 10mb. Ther fore .exe file will be around 10mb or more. So when service starts does it utilizes 10mb of RAM all 24 hours or it will just create just scheduler in service which will be pretty small and then loads service code when the time is met?

Considering scheduler how does it work. I think there will be a trigger that is fired when time is met and fired trigger will execute .exe file generically let me call it a service(but it is a application). So here the service code is separated from scheduler so only scheduler runs and loads service code into RAM.

Am I right?
Does scheduler also runs all 24 hours checking time?

2. If in case I have 2 services with one installer. Now there will be 2 servises installed. But I would like to know if both services is of 10mb each which makes 20 mb .exe size and when both services starts running does there sizes be of 10 mb each(considering it will lode relative service code) or 20 mb each(considering it will lode both service codes because they are in same exe).

Hoping for some valuable answered.

Thanks in advance.

What I have tried:

I just implemented windows service in c sharp and it works fine.
Posted
Updated 24-Nov-16 2:31am
v4

1 solution

A service is just an application that is constantly running, even if no-one is logged on. So if the EXE is 10mb then it'll be in memory always, even when "idle". A scheduled app starts your process at a given time, so it would launch your exe (I assume your exe will then abort when finished its work) at the given time loading all 10MB into memory and when the EXE finishes it will release that 10 MB.

As for the duel services, if you have two distinct service exe files running and both at 10MB then together they'll take 20MB (10 each), but in a circumstance like that I'd see if I could get a single service doing both functions, ie you could change the parameters via a config file and have the service do its work for each configuration instance.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900