Spooling and Buffering: Difference between revisions
![]() ![]() ![]() m (1 revision imported) |
![]() ![]() ![]() m (1 revision imported) |
||
(One intermediate revision by one other user not shown) | |||
Line 3: | Line 3: | ||
== Spooling == | == Spooling == | ||
Spooling is a form of buffering typified by <strong>printer spooling</strong>. A | Spooling is a form of buffering typified by <strong>printer spooling</strong>. A printer is a slow device which is usually also a shared resource. Rather than provide a printer for every machine, ‘the printer’ can be a [[Virtualisation|virtual]] process. | ||
printer is a slow device which is usually also a shared resource. | |||
Rather than provide a printer for every machine, ‘the | |||
printer’ can be a [[Virtualisation|virtual]] process. | |||
The spooler accepts print jobs, ensuring the integrity of each. These | The spooler accepts print jobs, ensuring the integrity of each. These are [[Queues|queued]] – possibly including some priority ordering – and output, probably using a printer [[Daemons|Daemon]] or similar strategy. (This is an everyday example of a <strong>batch</strong> scheduling job.) | ||
are [[Queues|queued]] – possibly including some priority ordering – | |||
and output, probably using a printer [[Daemons|Daemon]] or similar | |||
strategy. (This is an everyday example of a <strong>batch</strong> scheduling | |||
job.) | |||
[[Image:print_spooler.png|link=|alt=Print spooler]] | [[Image:print_spooler.png|link=|alt=Print spooler]] | ||
A spooler can be used to add information, such as a header page | A spooler can be used to add information, such as a header page identifying who sent the job on printing, if desired. | ||
identifying who sent the job on printing, if desired. | |||
== Buffering == | == Buffering == | ||
General buffering strategies are covered [[Queues|here]]. In I/O | General buffering strategies are covered [[Queues|here]]. In I/O buffering there are sometimes other requirements: one example is <strong>double buffering</strong>. | ||
buffering there are sometimes other requirements: one example is | |||
<strong>double buffering</strong>. | |||
Imagine sending translating a serial I/O [[Streams|stream]] into a disk | Imagine sending translating a serial I/O [[Streams|stream]] into a disk output (which consists, necessarily, of <em>blocks</em>. A block write can be initiated when a block buffer is full; that then takes some time, during which more characters may arrive … and have to go somewhere. | ||
output (which consists, necessarily, of <em>blocks</em>. A block write can | |||
be initiated when a block buffer is full; that then takes some time, | |||
during which more characters may arrive … and have to go somewhere. | |||
A typical approach is to have a <em>double</em> buffer: fill one buffer then | A typical approach is to have a <em>double</em> buffer: fill one buffer then schedule that for writing whilst beginning to fill the other one. As long as the block write is complete before the <em>second</em> buffer is full, nothing needs to stall. When the second buffer is full the buffers can be swapped again and the process continue. | ||
schedule that for writing whilst beginning to fill the other one. As | |||
long as the block write is complete before the <em>second</em> buffer is | |||
full, nothing needs to stall. When the second buffer is full the | |||
buffers can be swapped again and the process continue. | |||
[[Image:double_buffering.png|link=|alt=Double buffering]] | [[Image:double_buffering.png|link=|alt=Double buffering]] | ||
Another example of double buffering occurs in animated video games. | Another example of double buffering occurs in animated video games. The screen being viewed is one buffer and needs to remain stable; another buffer will be being drawn concurrently (this is the time-consuming bit!). When the second buffer is ready the two can be swapped and the ‘spare’ one cleared and recycled. | ||
The screen being viewed is one buffer and needs to remain stable; | |||
another buffer will be being drawn concurrently (this is the | |||
time-consuming bit!). When the second buffer is ready the two can be | |||
swapped and the ‘spare’ one cleared and recycled. | |||
<blockquote> | <blockquote> | ||
In practice it is important in a video game that the frame buffer | In practice it is important in a video game that the frame buffer swaps happen at a constant rate and these are synchronised with the output which is maintaining the screen. Thus the output rate will be an integer division of the output frame rate. The buffer swap process will be triggered by an [[Interrupts|interrupt]] from the video driver and the drawing process has a [[Real_Time|hard real-time]] constraint to meet this. We thought you’d like to know. | ||
swaps happen at a constant rate and these are synchronised with the | |||
output which is maintaining the screen. Thus the output rate will | |||
be an integer division of the output frame rate. The buffer swap | |||
process will be triggered by an [[Interrupts|interrupt]] from the | |||
video driver and the drawing process has a [[Real_Time|hard real-time]] constraint to meet this. | |||
We thought you’d like to know. | |||
</blockquote> | </blockquote> | ||
---- | ---- | ||
{{BookChapter|12.4.1-12.4.4|508-511}} | |||
{{PageGraph}} | {{PageGraph}} | ||
{{Category|Concepts}} | {{Category|Concepts}} | ||
{{Category|IO}} | {{Category|IO}} | ||
{{Category|User}} | {{Category|User}} |
Latest revision as of 10:03, 5 August 2019
Depends on | Queues |
---|
Spooling
Spooling is a form of buffering typified by printer spooling. A printer is a slow device which is usually also a shared resource. Rather than provide a printer for every machine, ‘the printer’ can be a virtual process.
The spooler accepts print jobs, ensuring the integrity of each. These are queued – possibly including some priority ordering – and output, probably using a printer Daemon or similar strategy. (This is an everyday example of a batch scheduling job.)
A spooler can be used to add information, such as a header page identifying who sent the job on printing, if desired.
Buffering
General buffering strategies are covered here. In I/O buffering there are sometimes other requirements: one example is double buffering.
Imagine sending translating a serial I/O stream into a disk output (which consists, necessarily, of blocks. A block write can be initiated when a block buffer is full; that then takes some time, during which more characters may arrive … and have to go somewhere.
A typical approach is to have a double buffer: fill one buffer then schedule that for writing whilst beginning to fill the other one. As long as the block write is complete before the second buffer is full, nothing needs to stall. When the second buffer is full the buffers can be swapped again and the process continue.
Another example of double buffering occurs in animated video games. The screen being viewed is one buffer and needs to remain stable; another buffer will be being drawn concurrently (this is the time-consuming bit!). When the second buffer is ready the two can be swapped and the ‘spare’ one cleared and recycled.
In practice it is important in a video game that the frame buffer swaps happen at a constant rate and these are synchronised with the output which is maintaining the screen. Thus the output rate will be an integer division of the output frame rate. The buffer swap process will be triggered by an interrupt from the video driver and the drawing process has a hard real-time constraint to meet this. We thought you’d like to know.
Also refer to: | Operating System Concepts, 10th Edition: Chapter 12.4.1-12.4.4, pages 508-511 |
---|