# Homework 2 - Solutions

Document Sample

```					                              Homework 2

CS 414, Spring 2010
Instructor: Klara Nahrstedt

Note: Homework is an individual effort, i.e., no working in groups. Consider the homework as a
preparation for your final. The deadline for HW2 is Wednesday, May 5, at 11AM, right before the
class starts. You should print out your homework solution and bring it to the class.

Problem 1: Multimedia CPU Scheduling (25 Points)
1.1 (10 Points) Consider 2 MPEG compressed video streams with the Group of Picture (GOP)
pattern IPBBPIPBBPI….. and one audio stream (stored on a single multimedia disk) with the
following characteristics:
 Video v1 (Playing Video): 20 frames per second, with
o each ‘I’ compressed frame on average is of size 20 Kbytes, CPU processing time
for reading the frame from a disk is estimated at 6 milliseconds (ms) and the
CPU processing time for decoding/displaying the frame is estimated at 6 ms.
o each ‘P’ frame on average is of size 15 Kbytes, CPU processing time for reading
the frame from disk is 4 ms, and decoding/displaying the frame is 6 ms.
o each ‘B’ frame on average is of size 5 Kbytes, CPU processing time for reading
the frame 2 ms, and decoding/displaying frame is 4 ms.
 Video v2 (Recording Video): 25 frames per second,
o each ‘I’ compressed frame on average is of size 30 Kbytes (after compression),
CPU processing time for reading the frame from video/compression card is
estimated at 10 ms, processing time for storing the frame to the disk is estimated
at 10 ms.
o each ‘P’ frame is on average 25 Kbytes (after compression), CPU processing time
for reading frame from video card and compressing it is 8 ms, and for writing
frame to disk is 8 ms.
o each ‘B’ frame is on average 10 Kbytes (after compression), CPU processing time
for reading frame from video card and compressing it is 8 ms, and writing frame
to disk is 4 ms.
 Audio a1 (Playing Audio): 5 samples per second, each sample is 8 Kbytes, processing
time for reading a sample from the disk is 5 ms, and processing time for writing it to the
CD-quality audio speaker device is 4 ms.

Determine which preemptive multimedia scheduling algorithms are suitable for scheduling the
tasks on these three streams (compare at least two multimedia suitable scheduling algorithms).
Points will be given for
(1) (4 Points) specification of admission tests for these two algorithms,

(2) (8 Points) specification of exact schedules for 400 ms (when what task and how long
is scheduled) for these specific scheduling algorithms (if they exist).
(3) (3 Points) determining the number of context switches in this example within the
common hyper-period, i.e., the first 200 ms).

1.2. (10 Points) Let us assume that we are profiling execution times for reading and writing tasks
of audio/video frames from/to the disk. Let us consider that the video streams and audio stream
from Part 1.1. are stored using continuous placement. Let us assume that the disk head is
positioned at the beginning of each stream and each stream is profiled separately. Let us assume
that the disk transfer rate is 2,000,000 bytes per second and the disk block is 5 Kbytes. Note that
based on the assumptions, the block access time in this example is dominated by the disk transfer
time (disk rotation and seek time are negligible). Verify if the estimation of the processing times
used in the Part 1.1. is realistic for
 Reading video frames of video v1 (estimated value are 6, 4, 2 ms) from the disk
 Reading audio frames of audio a1 (estimated value is 5 ms) from the disk, and
 Writing video frames of video v2 (estimated value is 10, 8, 4 ms) to the disk.
Note that realistic value means in this case if your computed disk access time value using the
given disk characteristics is less or equal to the estimated processing time value.
Problem 2: Disk Scheduling (15 Points)
Let us consider a single multimedia disk with a number of tracks from 1 to 100. Let us consider
the following set of requests in a request queue for a multimedia disk. Note that each request is
represented at the disk management level as a pair of values (deadline, track number). Let us
assume that request queue is separate from the scheduling queue where the disk scheduling
policy operates (makes a decision). Let us assume that the scheduling queue can store 5 items.

The Request Queue and its Order of Requests 
(1, 20), (1, 1), (2, 89), (3, 13), (2, 70), (1, 10), (2, 60), (3, 40), (3, 20), (2, 85),
(3, 35), (2, 76), (3, 96), (3, 36), (3, 95), (4, 48), (4, 1), (4, 50), (3, 5), (3, 45), (4,20).

(a) (3 Points) Derive the EDF schedule for these requests (disk head starts at the track 20).
(b) (7 Points) Derive the SCAN-EDF schedule for these requests using the simple (Ni/Nmax)
perturbation function. Assume that the disk head starts at the track 20.

(c) (5 Points) Compare all two schedules in terms of number of tracks the disk head needs to
make (e.g., if a head must jump from track 23 to 57, it needs to traverse 57-23=34 tracks)
Problem 3: Disk Management (10 Points)

Consider five videos (V1, V2, V3, V4, V5) stored on one disk, where (a) 50% of users liked V1,
(b) 20% of users liked V2, (c) 15% of users liked V3, (d) 10% likes movie V4 and (e) 5% liked
movie V5. Assume that V1 is takes 4MB storage, V2, takes 3 MB, V3 takes 100 MB, V4 takes
50 MB, and V5 takes 20 MB.
(1) (5 Points) Is the users’ popularity of the videos distributed according to the Zipf’s
law? Justify clearly (do not specify just yes or no).

(2) (5 Points) What is the best file placement strategy for the above five files on the disk
based on their users’ popularity? Explain the strategy and show how you would place
the files and why. Assume that the disk has the traditional disk layout.
Problem 4: Multimedia Networking (25 Points)
Design a transmission system between a single VOD (video-on-demand) server and many
clients. Assume that you have available all the standard protocols such as RSVP, RTP, RTCP,
RSVP, SIP, SDP, UDP, TCP, IP. Assume that the VOD server hosts video files and audio files.

4.1. (10 Points) Propose algorithms, protocols and architectural constructs for the control plane
for your VOD system, i.e., explain how you will setup audio/video connections (what functions,
protocols, capabilities must be in place to allow for VOD service, in what order the
function(s)/protocol(s) need to be used, and why did you decide to use particular function(s),
protocol(s)) and how you will control/manage connections (what happens in control plane once
the video/audio files are being streamed). Differentiate in your description how you deal with
audio and video and what needs to be done in the control plane to have the audio and video
delivered in synchronized manner.
4.2. (15 Points) Propose algorithms/functions, protocols, and architectural constructs for the data
plane for your VOD system, i.e., explain how you will stream video to multiple clients, what
needs to be considered to provide guaranteed delivery (what functions, protocols, capabilities
must be in place to deliver guaranteed VOD service to clients, in what order the
functions/protocols need to be used, and why did you decide to use the particular functions,
protocols, capabilities). Again, make it clear how you deal with audio and video and how you
deliver synchronized audio and video.
Problem 5. (10 Points)
Consider the following Time-Axis Specification in Figure 1, where A1, A2 are Audio 1 and
Audio 2 segments, V1, V2, V3 are tree video chunks, S1, S2 are slides, RI is recorded user
interaction, ‘Anim’ means animation and UI means real-time user interaction.

Figure 1: Time-Axis Specification of Synchronized Presentation

Transform the time axis specification into (1) interval-based specification and (2) hierarchical
specification. Argue clearly what synchronization information you could capture with the
following (interval-based and hierarchical) specifications and which synchronization information
got lost.
Problem 6: Synchronization and Peer-to-Peer Streaming (15 Points)

Consider your MP4, where you have one VOD server and three peers (P1, P2, P3) that share
playback of the same video clip M1 of the duration 10 minutes, i.e., each peer can start to play
the same 10-minute video clip M1 at certain times. Assume that the video stream M1 is divided
into chunks where one chunk is equal to 600 frames. Assume that the video clip M1 is recorded
with the frame rate 20 frames per second, and is compressed with Motion JPEG (MJPEG).

Consider three different time cases: (1) all peers want to play video clip M1 at the same time,
(2) peer P1 starts playing M1 at time x, peer P2 requests M1 2 minutes after P1, and peer P3
requests M1 4 minutes after P1, (3) peer P3 starts playing M1 at time x, peer P1 requests M1 5
minutes after P3, and P2 requests M1 6 minutes after P1.

(a) (6 Points) Specify for each time case what kind of OS/network/session-layer
synchronization mechanisms you need at the server and at the clients sides and how do
you distribute the synchronization information.
(b) (9 Points) Specify for each time case what chunks will be retrieved from whom and at
what time.

```
DOCUMENT INFO
Shared By:
Categories:
Tags:
Stats:
 views: 8 posted: 11/16/2011 language: English pages: 11