English 中文(简体)
任务 图书馆翻新
原标题:Task Parallel Library thread abort / interrupt

Consider a large scale application that uses a table in a sql server database to schedule jobs Each row in the table is tagged with a queueID, a methodName and other meta data. The methodName may be a native dot net interface, a legacy com local interface, a 3rd party com interface or URI to a 3rd party web service.

Currently there is a family of 32bit background exe s that process each queueID. There is a set max time limit on how long each job can run set by the queueID, a watchdog will kill the process if the time limit is exceeded.

We want to move this to a 64 bit environment & consolidate the multiple background exe process into a single multi-threaded windows service.

The issue is how do we handle the kill of a job that exceeds the set time limit. If we assign a task for each queueID from a Task Parallel Library from a single appDomain primary thread Clearly net4.0 cancellation tokens cant be used since the thread may run a com interface or a 3rd party web service. If the appDomain watchdog task calls Thread.abort() it may corrupt the entire appDomain & tear down all task threads I am unclear if Thread.Interrupt() would reliably cancel a thread without appDomain corruption.

因此,建议采用什么方法杀死超过时限的read子?

页: 1

Do we just have the service create an AppDomain for each queueID then do myAppDomain1.ExecuteAssembly("queueProcess.exe arg1") myAppDomain2.ExecuteAssembly("queueProcess.exe arg2") ... almost the same arch that exists now but its a win service that controls the appDomains and each queueProcess.exe & then use a the tpl thread pool do run the jobs in a set of smaller pools in each queueProcess.exe & the watch dog just does AppDomain?.Unload when a process has exceeded its time limit

问题回答

你们不能说是任意的本地法典,并导致它被干净地关闭。 如果你杀死其read子(如果你开始使用制造线),你一般会泄露记忆、腐败数据,而不是释放锁,使档案能够公开处理,而且还要多。 这并非没有合作。 这一过程是解决这一问题的正确方式,因为无论何时,他们都可以被清除。

就只有管理的任务而言,你可以安全地卸下遗体(ASP)。 互联网确实如此。 不要read,因为它可能使全球结构陷入一个不一致的国家。 或者,你可能放弃一个固定的轨道,使整个类别永远无法使用(无法重新启用固定轨道)。

You could have a generic host process which takes its input over a named pipe and runs your task. Such a process can be light-weight. You can kill it at any time.





相关问题
OutOfMemoryException on MemoryStream writing

I have a little sample application I was working on trying to get some of the new .Net 4.0 Parallel Extensions going (they are very nice). I m running into a (probably really stupid) problem with an ...

Master-Slave Pattern for Distributed Environment

Currently we have a batch driven process at work which runs every 15 mins and everytime it runs it repeats this cycle several times: Calls a sproc and get some data back from the DB Process the data ...

How to use database server for distributed job scheduling?

I have around 100 computers and few workers on each of them. The already connect to a central database to query for job parameters. Now I have to do job scheduling for them. One job for one worker ...

minimum work size of a goroutine [closed]

Does anyone know approximately what the minimum work size is needed in order for a goroutine to be beneficial (assuming that there are free cores for the work to be offloaded to)?

Optimal number of threads per core

Let s say I have a 4-core CPU, and I want to run some process in the minimum amount of time. The process is ideally parallelizable, so I can run chunks of it on an infinite number of threads and each ...

What s the quickest way to parallelize code?

I have an image processing routine that I believe could be made very parallel very quickly. Each pixel needs to have roughly 2k operations done on it in a way that doesn t depend on the operations ...

how to efficiently apply a medium-weight function in parallel

I m looking to map a modestly-expensive function onto a large lazy seq in parallel. pmap is great but i m loosing to much to context switching. I think I need to increase the size of the chunk of work ...

热门标签