Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Replacing the task scheduler in C# with a custom-built one

I was wondering if I can change the task scheduler that maps tasks to the real OS threads in .NET using C#, or if I need to recompile, say, the Mono runtime to do this. Thanks.

like image 429
Dervin Thunk Avatar asked Jun 26 '13 12:06

Dervin Thunk


People also ask

How do I change Task Scheduler?

Double-click My Computer, then double-click Scheduled Tasks. Right-click the name of the scheduled task you want to modify, select Properties, and select the Task tab.

What is C :\ Windows System32 tasks?

C:\Windows\System32\Tasks contains XML files that contain the definitions of scheduled tasks. The directory structure under %SYSTEMROOT%\System32\Tasks seems to correspond to the registry key structure under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree .

How do I fix a corrupted Task Scheduler?

Method 1: Use a System Restore Image Here are steps to fix the corrupt Task Scheduler on Windows. Step 1: Type restore in the Search menu and choose Create a restore point. Step 2: Click System Restore within the System Protection tab. Step 3: Click Next to get the list of all available restore points.


1 Answers

I don't know about Mono, but with the Microsoft CLR you need to basically host the CLR yourself and implement the relevant interfaces.

See this blog entry for more information.

Note that anyway that this is a very involved topic. The feature was initially only integrated in .NET 2.0 so that Microsoft SQL Server (which has a fiber-mode) could map CLR threads to fibers instead to operating system threads. AFAIK that "experiment" is considered larged failed however.

Also note that a lot of .NET (managed) code implicitly (or explicitly via P/Invoke calls to Windows API) assumes that the mapping between CLR and OS threads is actually 1:1.

like image 132
Christian.K Avatar answered Sep 18 '22 11:09

Christian.K