Scheduler pattern
Encyclopedia
In computer programming
, the scheduler pattern is a software design pattern. It is a concurrency
pattern used to explicitly control when threads may execute
single-threaded code
, like write operation to a file.
The scheduler pattern uses an object that explicitly sequences waiting threads. It provides a mechanism to implement a scheduling policy, but is independent of any specific scheduling policy — the policy is encapsulated in its own class and is reusable.
The read/write lock pattern is usually implemented using the scheduler pattern to ensure fairness in scheduling.
Note that the scheduler pattern adds significant overhead beyond that required to call a synchronized method
.
The scheduler pattern is not quite the same as the scheduled-task pattern
used for real-time systems.
Computer programming
Computer programming is the process of designing, writing, testing, debugging, and maintaining the source code of computer programs. This source code is written in one or more programming languages. The purpose of programming is to create a program that performs specific operations or exhibits a...
, the scheduler pattern is a software design pattern. It is a concurrency
Concurrency (computer science)
In computer science, concurrency is a property of systems in which several computations are executing simultaneously, and potentially interacting with each other...
pattern used to explicitly control when threads may execute
Execution (computers)
Execution in computer and software engineering is the process by which a computer or a virtual machine carries out the instructions of a computer program. The instructions in the program trigger sequences of simple actions on the executing machine...
single-threaded code
Source code
In computer science, source code is text written using the format and syntax of the programming language that it is being written in. Such a language is specially designed to facilitate the work of computer programmers, who specify the actions to be performed by a computer mostly by writing source...
, like write operation to a file.
The scheduler pattern uses an object that explicitly sequences waiting threads. It provides a mechanism to implement a scheduling policy, but is independent of any specific scheduling policy — the policy is encapsulated in its own class and is reusable.
The read/write lock pattern is usually implemented using the scheduler pattern to ensure fairness in scheduling.
Note that the scheduler pattern adds significant overhead beyond that required to call a synchronized method
Method (computer science)
In object-oriented programming, a method is a subroutine associated with a class. Methods define the behavior to be exhibited by instances of the associated class at program run time...
.
The scheduler pattern is not quite the same as the scheduled-task pattern
Scheduled-task pattern
A scheduled-task pattern is a type of software design pattern used with real-time systems. It is not to be confused with the "scheduler pattern"....
used for real-time systems.