7.6 Multi-media file system generics
Multimedia systems differ greatly from traditional file systems in that they use a pull server similar to the way a VCR works:
The user process issues a start system call, specifies the files to read and various other parameters, and the user process processes them at the rate at which the frames come in. Stop the data from returning to the user until the user issues a stop Stop command.
7.6.1 VCR control function
Video services often also need to implement VCR control functions, including pause, fast forward, and rewind.
Pause: The user sends a message to the video server, tells him to stop, and then the video server remembers the current frame on it.
However, one problem is that in order to ensure the quality of the service, the server should keep resources such as disk bandwidth and memory buffers for each outgoing data. How to judge the proper need to discard resources appropriate to reserve resources is a problem
Fast Forward and Rewind:
In general, if there is no compression, it is possible to achieve fast forward or backward as long as one frame is displayed per 10 frames. However, due to the problem of compression, the size of each frame is not different and cannot be accessed randomly. Usually only indexes can be built.
However, it is generally possible to save another file on the server side with another scenario. It samples the image at a frame of 10 frames, so that as long as the file is playing it looks as if it is moving at a 10 frame rate.
Such a scheme is a more general approach. However, there are several issues to note:
1. Additional disk blocks are required to store additional files.
2. Fast forward and backward only at a fixed rate
3. Additional algorithms are required between the regular file and the fast forward rewind file.
7.6.2 Approximate on Demand
The problem with video-on-demand is that users may demand movies at any time, so even if a lot of users are watching a movie at the same time, it may be necessary to provide a dedicated process service for each user due to different starting times, which greatly increases the pressure on the server.
A common method is to divert the film. For example, a stream is sent every 5 minutes so that the data stream can be reused. The price is a slight adjustment of the user to accept the service time, the principle is similar to the operation of the bus.
7.6.3 approximate video-on-demand with VCR function
Same as on-demand services, but some additions need to be added:
Requires each client to be pre-buffered locally t Time is coming. t The content of the time. Of course before buffering t The content of the time is easy, only the content after the display can be saved, but buffering the coming t The content of the time is more troublesome. But the ability of the client to read two more data streams at a time is also possible (this sentence is not understood)
For example, the current play point is buffered internally within 70-80 minutes. If the fast-forward or rewind content is within this range, only the content within this range is played, and then the new content is buffered based on the play point.
If the new play point is outside the buffered content, you need to open a private process to buffer the data from the new play point, and also to open the new buffer according to the fresh buffer point, in practice, the playback rate can be slightly adjusted so that the playback time gradually migrated to the nearest data stream, in order to reduce the data rate.
7.7 File Storage
Multimedia files are very large, usually written once and read multiple times, and tend to be accessed sequentially. Their return visits must also meet stringent service quality standards.
7.7.1 storing files on a single disk
- Store files in a separate order
- Put the video track and text together on the same frame.
It is necessary to note that there are multiple concurrent video servers. Putting the file together continuously loses its original meaning, because it is necessary to send multiple streams of video at the same time, so you still need to keep switching tracks.
7.7.22 Alternative File Organization strategies
How to weigh:
- Frame index: Movies Use a lot of RAM when playing, disk waste is small
- Block index (remaining space): Low RAM usage, high disk waste
- Block index (padding idle): Low RAM usage, no disk waste, additional pathfinding required
7.7.3 approximate video-on-demand file storage
Depending on how the video-on-demand is played, different disk file storage methods have different effects. The files of each video stream are sorted sequentially and can be read in turn to all the data streams that need to be sent. Such a way is obviously ideal for
A simple buffering strategy is double buffering, and the only thing to rely on is the size of the double buffer.
Require buffer to be larger than the number of streams * The maximum I frame size is obviously excessive, and it can often be more sensible to require a buffer enough to fit the second large track. The more data streams exist, the more statistical meaning is also stronger.
7.7.4 storing multiple files on a single disk
The previous consideration was the case of a single movie. If more than one movie is considered. Generally speaking, there is a certain regularity in the number of movies. Usually for n movies, the hit rate of the nth movie is usually c / n< Span style= "Display:inline-block; Overflow:hidden; height:1px; Width:0.109em; " > where n is N,c is a constant. Meet
C /1+C /2+C /3+...+C /N =1
Such a condition.
In general, file storage on a video server satisfies the organ distribution. This allows the head to remain in the center of the disk in practice to reduce the time of movement.
7.7.5 storing files on multiple disks
Of course, you can use Raidd way. But such a RAID controller can sometimes become a bottleneck for high-speed processing. Additional discussion on how raid is required
- No stripe mode: Each file is placed on a single disk. Sequential storage
- All files are in the same stripe mode: Each movie is striped on multiple blocks. Because each disk starts with the first disk, the load is unbalanced
- Interlaced stripe mode, as shown in C. A random stripe pattern, as shown in D. Balances the load.
Of course the above are for frames are the same size, actually really different. There are two solutions to this problem
- Split bands by frame
- Split strip by block
The last question is how many disks are striped
- Wide strip: If the stripe is striped in a large range, it can be well balanced, but if a disk is broken, it cannot be played.
- Narrow bands: The opposite is the case. It is often possible to encounter hot issues.
Therefore, a certain balance mechanism is needed.
Reading notes-modern operating systems-7 multimedia operating systems-7.6 Multi-media file system generics 7.7 file storage