Context (computing)

In computer science, a task context is the minimal set of data used by a task (which may be a process, thread, or fiber) that must be saved to allow a task to be interrupted, and later continued from the same point. The concept of context assumes significance in the case of interruptible tasks, wherein, upon being interrupted, the processor saves the context and proceeds to serve the interrupt service routine. Thus, the smaller the context is, the smaller the latency is.

The context data may be located in processor registers, memory used by the task, or in control registers used by some operating systems to manage the task.

The storage memory (files used by a task) is not concerned by the "task context" in the case of a context switch, even if this can be stored for some uses (checkpointing).

Context types

In some computer languages like C#, there is also the concept of safe/secure context. For instance, if an array is needed inside a structure, it can be added to it since version 2.0, but only in an unsafe/unsecure context.[1] Here is an example code:

struct ParameterRepresentation
{
    char target;
    char taskStart;
    char taskType;
    fixed byte traceValues[m_MAX_BYTES];
};

The fixed keyword prevents the garbage collector from relocating this variable. The access to an array is like in C++, i.e. using pointer arithmetic, where individual elements of the array can be accessed over its indices.

gollark: The gradient descent thing is basically moving down hills by going in whichever direction is slightly lower, except it's not hills it's higher-up regions in several million-dimensional abstract spaces of some kind.
gollark: (Apparently you can maybe get somewhat better performance from image recognition neural networks by feeding them "DCT" things which also conveniently happen to be what JPEG images contain, but almost nobody does this?)
gollark: Also that.
gollark: The image is just 3 matrices of R/G/B values.
gollark: There are 129057189471894718247141491807401825701892912 random details and things but that's the gist of it.

See also

References

This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.