dr. m. munlin real-time and multimedia systems 1 nete0516 operating systems instructor: ผ. ศ....

38
Real-Time and Multimedia Syst ems Dr. M. Munlin 1 NETE0516 Operating Systems Instructor: ผ.ผ. ผผ. ผผผผ ผผผผผ ผผผผผผผผ Faculty of Information Science and Technology Mahanakorn University of Technology Email: [email protected] Real-Time and Multimedia Real-Time and Multimedia Systems Systems Lecture#15

Upload: gwendolyn-robinson

Post on 12-Jan-2016

214 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Dr. M. Munlin Real-Time and Multimedia Systems 1 NETE0516 Operating Systems Instructor: ผ. ศ. ดร. หมัดอามีน หมัน หลิน Faculty of Information

Real-Time and Multimedia SystemsDr. M. Munlin 1

NETE0516 Operating Systems

Instructor: ผ.ศ . ดร . หมั�ดอามั�น หมั�นหลิ�น

Faculty of Information Science and TechnologyMahanakorn University of Technology

Email: [email protected]

Real-Time and Multimedia SystemsReal-Time and Multimedia Systems

Lecture#15

Page 2: Dr. M. Munlin Real-Time and Multimedia Systems 1 NETE0516 Operating Systems Instructor: ผ. ศ. ดร. หมัดอามีน หมัน หลิน Faculty of Information

Real-Time and Multimedia SystemsDr. M. Munlin 2

ObjectivesObjectives

To explain the timing requirements of real-time systems

To discuss the defining characteristics of real-time systems

To describe scheduling algorithms for hard real-time systems

To identify the characteristics of multimedia data

To examine several algorithms used to compress multimedia data

To explore the operating system requirements of multimedia data, including CPU and disk scheduling and network management

Page 3: Dr. M. Munlin Real-Time and Multimedia Systems 1 NETE0516 Operating Systems Instructor: ผ. ศ. ดร. หมัดอามีน หมัน หลิน Faculty of Information

Real-Time and Multimedia SystemsDr. M. Munlin 3

TopicsTopics

Features of Real-Time Systems Implementing Real-Time Operating Systems Real-Time CPU Scheduling VxWorks 5.x Multimedia Streaming Compression Techniques QoS An Example: Tiger Video Server

Page 4: Dr. M. Munlin Real-Time and Multimedia Systems 1 NETE0516 Operating Systems Instructor: ผ. ศ. ดร. หมัดอามีน หมัน หลิน Faculty of Information

Real-Time and Multimedia SystemsDr. M. Munlin 4

Overview of Real-Time SystemsOverview of Real-Time Systems

A real-time system requires that results be produced within a specified deadline period.

An embedded system is a computing device that is part of a larger system (I.e. automobile, airliner.)

A safety-critical system is a real-time system with catastrophic results in case of failure.

A hard real-time system guarantees that real-time tasks be completed within their required deadlines.

A soft real-time system provides priority of real-time tasks over non real-time tasks.

Page 5: Dr. M. Munlin Real-Time and Multimedia Systems 1 NETE0516 Operating Systems Instructor: ผ. ศ. ดร. หมัดอามีน หมัน หลิน Faculty of Information

Real-Time and Multimedia SystemsDr. M. Munlin 5

Features of Real-Time KernelsFeatures of Real-Time Kernels

Most real-time systems do not provide the features found in a standard desktop system.

Reasons include

Real-time systems are typically single-purpose.

Real-time systems often do not require interfacing with a user.

Features found in a desktop PC require more substantial hardware that what is typically available in a real-time system.

Page 6: Dr. M. Munlin Real-Time and Multimedia Systems 1 NETE0516 Operating Systems Instructor: ผ. ศ. ดร. หมัดอามีน หมัน หลิน Faculty of Information

Real-Time and Multimedia SystemsDr. M. Munlin 6

Implementing Real-Time Implementing Real-Time Operating SystemsOperating Systems

In general, real-time operating systems must provide:

(1) Preemptive, priority-based scheduling

Higher priority process can preempt.

Soft real-time

(2) Preemptive kernels

Allow a process running in kernel to be preempted

Hard real-time

Insert preemption point in a long system call, context switch to the high priority process, interrupt and return to system call

Windows XP are non-preemptive kernel

(3) Latency must be minimized

Page 7: Dr. M. Munlin Real-Time and Multimedia Systems 1 NETE0516 Operating Systems Instructor: ผ. ศ. ดร. หมัดอามีน หมัน หลิน Faculty of Information

Real-Time and Multimedia SystemsDr. M. Munlin 7

Minimizing LatencyMinimizing Latency

Event latency is the amount of time from when an event occurs to when it is serviced.

Page 8: Dr. M. Munlin Real-Time and Multimedia Systems 1 NETE0516 Operating Systems Instructor: ผ. ศ. ดร. หมัดอามีน หมัน หลิน Faculty of Information

Real-Time and Multimedia SystemsDr. M. Munlin 8

Interrupt LatencyInterrupt Latency

Interrupt latency is the period of time from when an interrupt arrives at the CPU to when it is serviced.

Page 9: Dr. M. Munlin Real-Time and Multimedia Systems 1 NETE0516 Operating Systems Instructor: ผ. ศ. ดร. หมัดอามีน หมัน หลิน Faculty of Information

Real-Time and Multimedia SystemsDr. M. Munlin 9

Dispatch LatencyDispatch Latency

Dispatch latency is the amount of time required for the scheduler to stop one process and start another.

Page 10: Dr. M. Munlin Real-Time and Multimedia Systems 1 NETE0516 Operating Systems Instructor: ผ. ศ. ดร. หมัดอามีน หมัน หลิน Faculty of Information

Real-Time and Multimedia SystemsDr. M. Munlin 10

Real-Time CPU SchedulingReal-Time CPU Scheduling

Periodic processes require the CPU at specified intervals (periods)

p is the duration of the period

d is the deadline by when the process must be serviced

t is the processing time

Page 11: Dr. M. Munlin Real-Time and Multimedia Systems 1 NETE0516 Operating Systems Instructor: ผ. ศ. ดร. หมัดอามีน หมัน หลิน Faculty of Information

Real-Time and Multimedia SystemsDr. M. Munlin 11

Scheduling of tasks when PScheduling of tasks when P22 has a has a

higher priority than Phigher priority than P11

Page 12: Dr. M. Munlin Real-Time and Multimedia Systems 1 NETE0516 Operating Systems Instructor: ผ. ศ. ดร. หมัดอามีน หมัน หลิน Faculty of Information

Real-Time and Multimedia SystemsDr. M. Munlin 12

Rate Monotonic SchedulingRate Monotonic Scheduling

A priority is assigned based on the inverse of its period

Shorter periods = higher priority;

Longer periods = lower priority

P1 is assigned a higher priority than P2.

Page 13: Dr. M. Munlin Real-Time and Multimedia Systems 1 NETE0516 Operating Systems Instructor: ผ. ศ. ดร. หมัดอามีน หมัน หลิน Faculty of Information

Real-Time and Multimedia SystemsDr. M. Munlin 13

Missed Deadlines with Missed Deadlines with Rate Monotonic SchedulingRate Monotonic Scheduling

Page 14: Dr. M. Munlin Real-Time and Multimedia Systems 1 NETE0516 Operating Systems Instructor: ผ. ศ. ดร. หมัดอามีน หมัน หลิน Faculty of Information

Real-Time and Multimedia SystemsDr. M. Munlin 14

Earliest Deadline First (EDF) SchedulingEarliest Deadline First (EDF) Scheduling

Priorities are assigned according to deadlines:

the earlier the deadline, the higher the priority;

the later the deadline, the lower the priority.

Page 15: Dr. M. Munlin Real-Time and Multimedia Systems 1 NETE0516 Operating Systems Instructor: ผ. ศ. ดร. หมัดอามีน หมัน หลิน Faculty of Information

Real-Time and Multimedia SystemsDr. M. Munlin 15

Proportional Share SchedulingProportional Share Scheduling

T shares are allocated among all processes in the system.

An application receives N shares where N < T.

This ensures each application will receive N / T of the total processor time.

Page 16: Dr. M. Munlin Real-Time and Multimedia Systems 1 NETE0516 Operating Systems Instructor: ผ. ศ. ดร. หมัดอามีน หมัน หลิน Faculty of Information

Real-Time and Multimedia SystemsDr. M. Munlin 16

VxWorks 5.0VxWorks 5.0

Page 17: Dr. M. Munlin Real-Time and Multimedia Systems 1 NETE0516 Operating Systems Instructor: ผ. ศ. ดร. หมัดอามีน หมัน หลิน Faculty of Information

Real-Time and Multimedia SystemsDr. M. Munlin 17

Wind MicrokernelWind Microkernel

The Wind microkernel provides support for the following:

(1) Processes and threads;

(2) preemptive and non-preemptive round-robin scheduling;

(3) manages interrupts (with bounded interrupt and dispatch latency times);

(4) shared memory and message passing interprocess communication facilities.

Page 18: Dr. M. Munlin Real-Time and Multimedia Systems 1 NETE0516 Operating Systems Instructor: ผ. ศ. ดร. หมัดอามีน หมัน หลิน Faculty of Information

Real-Time and Multimedia SystemsDr. M. Munlin 18

MultimediaMultimedia

Multimedia data includes

- audio and video clips (i.e. MP3 and MPEG files)

- live webcasts

Multimedia data may be delivered to

- desktop PC’s

- handheld devices (PDAs, smart phones, etc.)

Page 19: Dr. M. Munlin Real-Time and Multimedia Systems 1 NETE0516 Operating Systems Instructor: ผ. ศ. ดร. หมัดอามีน หมัน หลิน Faculty of Information

Real-Time and Multimedia SystemsDr. M. Munlin 19

Media DeliveryMedia Delivery

Multimedia data is stored in the file system like othe ordinary data.

However, multimedia data must be accessed with specific timing requirements.

For example, video must be displayed at 24-30 frames per second. Multimedia video data must be delivered at a rate which guarantees 24-30 frames/second.

Continuous-media data is data with specific rate requirements.

Page 20: Dr. M. Munlin Real-Time and Multimedia Systems 1 NETE0516 Operating Systems Instructor: ผ. ศ. ดร. หมัดอามีน หมัน หลิน Faculty of Information

Real-Time and Multimedia SystemsDr. M. Munlin 20

StreamingStreaming

Streaming is delivering a multimedia file from a server to a client - typically the deliver occurs over a network connection.

There are two different types of streaming:

1. Progressive download - the client begins playback of the multimedia file as it is delivered. The file is ultimately stored on the client computer.

2. Real-time streaming - the multimedia file is delivered to - but not stored on - the client’s computer.

Page 21: Dr. M. Munlin Real-Time and Multimedia Systems 1 NETE0516 Operating Systems Instructor: ผ. ศ. ดร. หมัดอามีน หมัน หลิน Faculty of Information

Real-Time and Multimedia SystemsDr. M. Munlin 21

Real-time StreamingReal-time Streaming

There are two types of real-time streaming:

(1) Live streaming - used to deliver a live event while it is occurring.

(2) On-demand streaming - used to deliver media streams such as movies, archived lectures, etc. The events are not delivered in real-time.

Page 22: Dr. M. Munlin Real-Time and Multimedia Systems 1 NETE0516 Operating Systems Instructor: ผ. ศ. ดร. หมัดอามีน หมัน หลิน Faculty of Information

Real-Time and Multimedia SystemsDr. M. Munlin 22

Multimedia Systems CharacteristicsMultimedia Systems Characteristics

Multimedia files can be quite large.

Continuous media data may require very high data rates.

Multimedia applications may be sensitive to timing delays during playback of the media.

Page 23: Dr. M. Munlin Real-Time and Multimedia Systems 1 NETE0516 Operating Systems Instructor: ผ. ศ. ดร. หมัดอามีน หมัน หลิน Faculty of Information

Real-Time and Multimedia SystemsDr. M. Munlin 23

CompressionCompression

Because of the size and rate requirements of multimedia systems, multimedia files are often compressed into a smaller form.

MPEG Compression:

(1) MPEG-1 - 352 X 240 @ 30 frames/second

(2) MPEG-2 - Used for compressing DVD and high-definition television (HDTV)

(3) MPEG-4 - Used to transmit audio, video, and graphics. Can be delivered over very slow connections (56 Kbps)

Page 24: Dr. M. Munlin Real-Time and Multimedia Systems 1 NETE0516 Operating Systems Instructor: ผ. ศ. ดร. หมัดอามีน หมัน หลิน Faculty of Information

Real-Time and Multimedia SystemsDr. M. Munlin 24

Operating Systems IssuesOperating Systems Issues

The operating system must guarantee the specific data rate and timing requirements of continuous media.

Such requirements are known as Quality-of-Service (QoS) guarantees.

Guaranteeing QoS has the following effects in a computer system:

(1) CPU processing

(2) Scheduling

(3) File systems

(4) Network protocols

Page 25: Dr. M. Munlin Real-Time and Multimedia Systems 1 NETE0516 Operating Systems Instructor: ผ. ศ. ดร. หมัดอามีน หมัน หลิน Faculty of Information

Real-Time and Multimedia SystemsDr. M. Munlin 25

Quality-of-Service (QoS)Quality-of-Service (QoS) There are three levels of QoS

(1) Best-effort service - the system makes a best effort with no QoS guarantees.

(2) Soft QoS - allows different traffic streams to be prioritized, however no QoS guarantees are made.

(3) Hard QoS - the QoS rquirements are guaranteed.

Page 26: Dr. M. Munlin Real-Time and Multimedia Systems 1 NETE0516 Operating Systems Instructor: ผ. ศ. ดร. หมัดอามีน หมัน หลิน Faculty of Information

Real-Time and Multimedia SystemsDr. M. Munlin 26

Parameters Defining QoSParameters Defining QoS

Throughput - the total amount of work completed during a specific time interval.

Delay - the elapsed time from when a request is first submitted to when the desired result is produced.

Jitter - the delays that occur during playback of a stream.

Reliability - how errors are handled during transmission and processing of continuous media.

Page 27: Dr. M. Munlin Real-Time and Multimedia Systems 1 NETE0516 Operating Systems Instructor: ผ. ศ. ดร. หมัดอามีน หมัน หลิน Faculty of Information

Real-Time and Multimedia SystemsDr. M. Munlin 27

Resources on a file serverResources on a file server

Page 28: Dr. M. Munlin Real-Time and Multimedia Systems 1 NETE0516 Operating Systems Instructor: ผ. ศ. ดร. หมัดอามีน หมัน หลิน Faculty of Information

Real-Time and Multimedia SystemsDr. M. Munlin 28

CPU SchedulingCPU Scheduling

Multimedia systems require hard realtime scheduling to ensure critical tasks will be serviced within timing deadlines.

Most hard realtime CPU scheduling algorithms assign realtime processes static priorities that do not change over time.

Page 29: Dr. M. Munlin Real-Time and Multimedia Systems 1 NETE0516 Operating Systems Instructor: ผ. ศ. ดร. หมัดอามีน หมัน หลิน Faculty of Information

Real-Time and Multimedia SystemsDr. M. Munlin 29

Disk SchedulingDisk Scheduling

Disk scheduling algorithms must be optimized to meet the timing deadlines and rate requirements of continuous media.

Earliest-Deadline-First (EDF) Scheduling

SCAN-EDF Scheduling

The EDF scheduler uses a queue to order requests according to the time it must be completed (its deadline.)

SCAN-EDF scheduling is similar to EDF except that requests with the same deadline are ordered according to a SCAN policy.

Page 30: Dr. M. Munlin Real-Time and Multimedia Systems 1 NETE0516 Operating Systems Instructor: ผ. ศ. ดร. หมัดอามีน หมัน หลิน Faculty of Information

Real-Time and Multimedia SystemsDr. M. Munlin 30

Deadline and cylinder requests for Deadline and cylinder requests for SCAN-EDF schedulingSCAN-EDF scheduling

Page 31: Dr. M. Munlin Real-Time and Multimedia Systems 1 NETE0516 Operating Systems Instructor: ผ. ศ. ดร. หมัดอามีน หมัน หลิน Faculty of Information

Real-Time and Multimedia SystemsDr. M. Munlin 31

Network ManagementNetwork Management

Three general methods for delivering content from a server to a client across a network:

(1) Unicasting - the server delivers the content to a single client.

(2) Broadcasting - the server delivers the content to all clients, regardless whether they want the content or not.

(3) Multicasting - the server delivers the content to a group of receivers who indicate they wish to receive the content.

Page 32: Dr. M. Munlin Real-Time and Multimedia Systems 1 NETE0516 Operating Systems Instructor: ผ. ศ. ดร. หมัดอามีน หมัน หลิน Faculty of Information

Real-Time and Multimedia SystemsDr. M. Munlin 32

Standard HTTP Streaming ProtocolStandard HTTP Streaming Protocol

Standard HTTP is stateless whereby the server does not maintain the status of its connection with the client.

Page 33: Dr. M. Munlin Real-Time and Multimedia Systems 1 NETE0516 Operating Systems Instructor: ผ. ศ. ดร. หมัดอามีน หมัน หลิน Faculty of Information

Real-Time and Multimedia SystemsDr. M. Munlin 33

Real-time Streaming ProtocolReal-time Streaming Protocol

Page 34: Dr. M. Munlin Real-Time and Multimedia Systems 1 NETE0516 Operating Systems Instructor: ผ. ศ. ดร. หมัดอามีน หมัน หลิน Faculty of Information

Real-Time and Multimedia SystemsDr. M. Munlin 34

RTSP StatesRTSP States

SETUP - the server allocates resources for a client session.

PLAY - the server delivers a stream to a client session.

PAUSE - the server suspends delivery of a stream.

TEARDOWN - the server breaks down the connection and releases the resources allocated for the session.

Page 35: Dr. M. Munlin Real-Time and Multimedia Systems 1 NETE0516 Operating Systems Instructor: ผ. ศ. ดร. หมัดอามีน หมัน หลิน Faculty of Information

Real-Time and Multimedia SystemsDr. M. Munlin 35

Tiger video serverTiger video server

Video on demand for a large number of users

Quality of service

Scalable and distributed

Low cost hardware

Fault tolerant

Tiger

Network

Clients

Page 36: Dr. M. Munlin Real-Time and Multimedia Systems 1 NETE0516 Operating Systems Instructor: ผ. ศ. ดร. หมัดอามีน หมัน หลิน Faculty of Information

Real-Time and Multimedia SystemsDr. M. Munlin 36

Tiger architectureTiger architecture

Storage organization

Striping

Mirroring

Distributed schedule

Tolerate failure of any single computer or disk

Network support

Other functions

pause, stop, start

Page 37: Dr. M. Munlin Real-Time and Multimedia Systems 1 NETE0516 Operating Systems Instructor: ผ. ศ. ดร. หมัดอามีน หมัน หลิน Faculty of Information

Real-Time and Multimedia SystemsDr. M. Munlin 37

Tiger video file server hardware configurationTiger video file server hardware configuration

n+10 n+21 n+32 n+43 2n+1n

Controller

Cub 0 Cub 1 Cub 2 Cub 3 Cub n

ATM switching network

video distribution to clientsStart/Stop

requests from clients

low-bandwidth network

high-bandwidth

Cubs and controllersare standard PCs

Each movie is stored in 0.5 MB blocks (~7000) across all disks in the order of the disk numbers, wrapping around after n+1 blocks.

Block i is mirrored in smaller blocks on disks i+1 to i+d where d is the decluster factor

Page 38: Dr. M. Munlin Real-Time and Multimedia Systems 1 NETE0516 Operating Systems Instructor: ผ. ศ. ดร. หมัดอามีน หมัน หลิน Faculty of Information

Real-Time and Multimedia SystemsDr. M. Munlin 38

Tiger scheduleTiger schedule

block play time T block service

time t

slot 0

viewer 4 state

viewer client viewer state: slot 1

free

slot 2

free

slot 3

viewer 0 state

slot 4

viewer 3 state

slot 5

viewer 2 state

slot 6

free

slot 7

viewer 1 state

012

Network address of client

FileID for current movie

Number of next block

Viewer's next play slot

Viewer state:

slot 0

viewer 4 state

viewer client viewer state: slot 1

free

slot 2

free

slot 3

viewer 0 state

slot 4

viewer 3 state

slot 5

viewer 2 state

slot 6

free

slot 7

viewer 1 state

Cub algorithm:

Read the next block into buffer storage at the Cub.

Packetize the block and deliver it to the Cub’s ATM network controller with the address of the client computer.

Update viewer state in the schedule to show the new next block and play sequence number and pass the updated slot to the next Cub.

Clients buffer blocks and schedule their display on screen.

Stream capacity of a disk = T/t (typically ~ 5)Stream capacity of a cub with n disks = n x T/t