Method and system for executing a task and medium storing a program therefor
Abstract
A method of executing a task includes executing, by using a processor, a first task including a low-frequency task in which garbage is collected using a garbage collector, initializing a second task including a high-frequency task by constructing an instance of a class that implements a standard runnable thread interface, and creating a data structure for supporting communication between the second task and lower priority threads, the data structure being accessible by a thread running in a garbage-collected heap in the first task to communicate data between the high-frequency task and the low-frequency task, validating the second task to ensure that the second task is executable without synchronizing with the first task, instantiating the second task to create a class for executing the second task; and after the instantiating the second task, executing the second task, the garbage collector being preemptable by the second task.
Claims
exact text as granted — not AI-modified1 . A method of executing a task, comprising:
executing, by using a processor, a first task comprising a low-frequency task in which garbage is collected using a garbage collector; initializing a second task comprising a high-frequency task by:
constructing an instance of a class that implements a standard runnable thread interface; and
creating a data structure for supporting communication between said second task and lower priority threads, said data structure being accessible by a thread running in a garbage-collected heap in said first task to communicate data between said high-frequency task and said low-frequency task;
validating said second task to ensure that said second task is executable without synchronizing with said first task; instantiating said second task to create a class for executing said second task; and after said instantiating said second task, executing said second task, said garbage collector being preemptable by said second task.
2 . The method of claim 1 , wherein said validating said second task comprises determining a set of objects (O), a set of field signatures (F), a set of methods (M), and a set of virtual method signatures (V) which are accessible by said second task.
3 . The method of claim 2 , wherein said determining said set of objects comprises a data-sensitive analysis.
4 . The method of claim 1 , wherein said instantiating said second task comprises:
creating an executable thread that will repeatedly invoke said second task; tracking said set of objects which are accessible by said second task; pinning said objects such that said objects are immovable by said first task; extending an interface to a run-time system with second task run-time support code for supporting said pinning of said objects; performing another pinning of said objects to determine if any pointers in said objects are stale and, if stale pointers are determined, updating said stale pointers; forwarding pointers for objects associated with said second task; and installing a set of objects which are accessible by said second task into run-time data structures such that said set of objects is external to said second task.
5 . The method of claim 4 , wherein only said second task run-time support code has access to said pinning said objects and unpinning said pinned objects.
6 . The method of claim 1 , wherein said executing said second task comprises:
performing an allocation while handling an exceptional condition during said executing said second task.
7 . The method of claim 1 , wherein said executing said second task further comprises:
adding a set of pinned objects to a global table for a duration of executing said second task to ensure that any object accessible to said second task is accessible from another root.
8 . The method of claim 1 , wherein said second task is implemented using standard programming language constructs and wherein objects associated with said second task are automatically discovered by the run-time system.
9 . The method of claim 1 , wherein objects associated with said second task reside in a garbage-collected heap, are referenceable by other objects in said garbage-collected heap, are pinned during a life of said second task, and are subject to garbage collection upon termination of said second task.
10 . The method of claim 1 , wherein said executing said second task is performed without executing a run-time memory access check.
11 . The method of claim 1 , wherein said validating said second task comprises adding an identifier to a header of an object.
12 . The method of claim 1 , wherein in said executing said second task, a priority of said second task is higher than a thread that schedules said first task.
13 . The method of claim 1 , wherein a thread for said executing said second task is distinguished from a thread for executing said first task by using a flag in a thread-specific data structure, said flag being used by a run-time scheduler to determine which threads should reach a safe point before a collection quantum begins.
14 . The method of claim 1 , wherein said second task is terminatable at any instruction without negatively effecting a remainder of a system in which said second task is executed.
15 . The method of claim 1 , wherein said frequency of said second task comprises a sampling frequency.
16 . The method of claim 1 , wherein said low-frequency task comprises a first frequency and said high-frequency comprises a second frequency greater than said first frequency.
17 . The method of claim 1 , wherein said low-frequency and high-frequency tasks are instantiated and initialized with a shared channel queue, and the high-frequency task is validated before being passed to a scheduler,
wherein said scheduler periodically invokes the high-frequency task, and wherein said validating said second task is performed while an application is running and before said second task is invoked.
18 . The method of claim 1 , wherein said validating said second task comprises creating a data-specific call graph for the data structure, and performing a set of checks on bytecodes of resulting methods.
19 . A system for executing a task, comprising:
a first executing module for executing a first task comprising a low-frequency task in which garbage is collected using a garbage collector; an initializing module for initializing a second task comprising a high-frequency task by:
constructing an instance of a class that implements a standard runnable thread interface; and
creating a data structure for supporting communication between said second task and lower priority threads, said data structure being accessible by a thread running in a garbage-collected heap in said first task to communicate data between said high-frequency task and said low-frequency task;
a validating module for validating said second task to ensure that said second task is executable without synchronizing with said first task; an instantiating module for instantiating said second task to create a class for executing said second task; and a second executing module for, after said instantiating said second task, executing said second task, said garbage collector being preemptable by said second task.
20 . A programmable storage medium tangibly embodying a program of machine-readable instructions executable by a digital processing apparatus to perform a method of executing a task, the method comprising:
executing, by using a processor, a first task comprising a low-frequency task in which garbage is collected using a garbage collector; initializing a second task comprising a high-frequency task by:
constructing an instance of a class that implements a standard runnable thread interface; and
creating a data structure for supporting communication between said second task and lower priority threads, said data structure being accessible by a thread running in a garbage-collected heap in said first task to communicate data between said high-frequency task and said low-frequency task;
validating said second task to ensure that said second task is executable without synchronizing with said first task; instantiating said second task to create a class for executing said second task; and after said instantiating said second task, executing said second task, said garbage collector being preemptable by said second task.Join the waitlist — get patent alerts
Track US2010198885A1 — get alerts on status changes and closely related new filings.
We store only your email — no account needed. See our privacy policy.