Reading notes-modern operating systems-7 multimedia operating systems-7.6 Multi-media file system generics 7.7 file storage

Source: Internet
Author: User
Tags rewind

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
    1. Store files in a separate order
    2. 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
    • Small Block model

      1. The size of the disk block is much smaller than the size of the frame. Each movie gives an index, which is a data structure, each frame has a frame index entry, which points to the beginning of the frame. Each frame is itself a string of contiguous blocks that contain all the video, audio, and text of that frame.
      2. Each time the operation reads a frame, it works well with simple double buffering.
      3. For disk performance, it is very inefficient to read small frames individually, and it is difficult to store separate frame decomposition on multiple drives.
      4. Also known as constant duration (constant time length)
      5. Fast forward can be achieved by displaying only I frames. Even with the additional file implementation 10 is sampled after a quick sampling, the small block is also easier to map 1 time times the frame and 10 times times the frame of the file.
    • Chunk model (remaining idle)

      1. The size of the disk block is much larger than the block, and in each piece into a plurality of frames, the next frame filled with the block of time, reserved. This creates a lot of free space, but achieves the maximum performance. Then create a block index. There may be additional information to include, such as which frame belongs to which piece.
      2. All blocks are much smaller than the frame index
      3. Each buffer must be large enough to fit the maximum possible I frame. Although a double buffer can also be used for large chunks, it is not usually done by using a cyclic transfer buffer that reads a new frame when the buffer content is less than a certain threshold.
      4. For disk performance, it is important to have large chunks of disk running at full speed, and block decomposition can be mounted on multiple drives.
      5. Also known as very fixed data length (constant)
    • Bulk model (padding idle)

      1. The size of the disk block is much larger than the block, and in each piece into a plurality of frames, the next frame fills the block, the frame is still filled with blocks and then split the frame to cross the disk block. This reduces performance but increases the usage space rate. Then create a block index. There may be additional information to include, such as which frame belongs to which piece.
      2. Remaining ibid.

How to weigh:

    1. Frame index: Movies Use a lot of RAM when playing, disk waste is small
    2. Block index (remaining space): Low RAM usage, high disk waste
    3. 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

    1. No stripe mode: Each file is placed on a single disk. Sequential storage
    2. 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
    3. 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

    1. Split bands by frame
    2. Split strip by block

The last question is how many disks are striped

    1. 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.
    2. 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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.