Hi,
You need to create a batch job for this task. As this involves extending runbase framework.
Please have a look at Tutorial_runbasebatch. Follow http://msdn.microsoft.com/en-us/library/cc636647.aspx
You need to create a class which extends runbase and write your logic to print hello 10 times. Then use that class and set up a batch job at sysadmin/Inquirires/Batch Jobs.
You can also initiate a batch job through code. Look at the createbatchjob method in AifChangeTrackingVersionUpdateJob class.
Regards,
Varun