Professional Documents
Culture Documents
Memory management
Database management
Device management
Process management must take into account the timing
requirement imposed by the handling of multimedia
data.
Concerns in process management (Scheduling):
Traditional OS MM OS
Timing requirement
No
Yes
Fairness
Yes
Yes
Single components are conceived as resources that are
reserved prior to execution to obey timing requirements
and this resource reservation has to cover all resources
on a data path.
The communication & synchronization between single
processes must meet the restrictions of real-time
requirements and timing relations among different
media.
Memory management has to provide access to data with
a guaranteed timing delay and efficient data
manipulation functions. (e.g. should minimize physical
data copy operations.)
Database management should rely on file management
services
CYH/MMT/OS/p.2
9.2 Real-time
A real-time process is a process which delivers the
results of the processing in a given time-span.
The main characteristic of real-time systems is the
correctness of the computation.
Errorless computation
The time in which the result is presented
Speed and efficiency are not the main characteristic of
real-time systems.
(e.g. the video data should be presented at the right time,
neither too quickly nor too slowly)
Timing and logical dependencies among different related
tasks, processed at the same time, must also be
considered.
Deadlines:
A deadline represents the latest acceptable time for the
presentation of a processing result.
Soft deadline:
a deadline which cannot be exactly determined and
which failing to meet does not produce an
unacceptable result.
CYH/MMT/OS/p.3
CYH/MMT/OS/p.4
Requirements
Interactive
video
Insufficient
resources
Sufficient but
scarce
resources
Highquality
audio
Abundant
resources
Network
file access
1980
1990
2000
Hardware
resources
in Year X
CYH/MMT/OS/p.5
CYH/MMT/OS/p.6
9.3.1 Resources
A resource is a system entity required by tasks for
manipulating data.
A resource can be active or passive.
Active resource:
e.g. the CPU or a network adapter for protocol
processing;
it provides a service.
Passive resource:
e.g. main memory, communication bandwidth or
file systems;
It denotes some system capability required by
active resources.
CYH/MMT/OS/p.7
9.3.2 Requirements
The requirements of multimedia applications and data
streams must be served.
The transmission/processing requirements of local and
distributed multimedia applications can be specified
according to the following characteristics:
CYH/MMT/OS/p.8
2. QoS calculation
The resource manager calculates the best
possible performance (e.g. delay) the resource
can guarantee for the new request.
3. Resource reservation
Allocates the required capacity to meet the QoS
guarantees for each request.
CYH/MMT/OS/p.9
4.
Resource scheduling
Incoming messages (i.e. LDUs) from
connections are scheduled according to the
given QoS guarantees.
CYH/MMT/OS/p.10
Pessimistic Optimistic
approach
approach
Worst case Average case
Account
for
QoS
Guaranteed Best effort
Utilization Low
High
Remarks
May need a
monitor to detect
overload
situation and act
CYH/MMT/OS/p.11
CYH/MMT/OS/p.12
Burst:
Bursts are generated
When data is transferred from disk in a bulk transfer
mode
When messages are assembled into larger packets
When traffic congestion is experienced
In the model, it is assumed that, during a time interval of
length t, the maximum number of messages arriving at a
resource must not exceed M = B + R t (message)
CYH/MMT/OS/p.13
Logical backlog
Logical backlog is the number of messages which have
already arrived "ahead of schedule" at the arrival of
message m.
Let ai be the actual arrival time of message mi for
0 i n . Then b(i) is defined by
0
b(m0 ) =
CYH/MMT/OS/p.14
Example:
Example:
a5
t
M1 should arrive
at this point
Assume we've
had M2 and M3
on hand.
Hence, now we
have b(M4)=3
M4 arrives
at this point
M5 arrives
at this point
3/R
Actual arrival
time of M4
M4 should not be
handled before this
point as there are 3
messages waiting
in the buffer to go.
M4 should arrive
at this point
a4
b(mi )
R
Workahead messages
If a message arrives "ahead of schedule" and the
resource is in an idle state, the message can be processed
immediately and it's called a workahead message.
If a message is processed 'ahead of schedule' the logical
backlog is greater than the actual backlog.
or
a0
l (m ) =
0
1
+
max
,
(
)
a
l
m
(
)
l
m
=
i
i 1
i
CYH/MMT/OS/p.15
CYH/MMT/OS/p.16
d
periodic
task T
0
d
e
t
Characterization of periodic tasks
CYH/MMT/OS/p.19
CYH/MMT/OS/p.20
CYH/MMT/OS/p.21
CYH/MMT/OS/p.22
CYH/MMT/OS/p.23
CYH/MMT/OS/p.24
High
rate
dA
d2
d1
Low
rate
dB
d4
d3
dC
d6
d5
process
A
EDF
process
B
Rate
Monotonic
critical instant of B
process
C
priority: A>B>C
CYH/MMT/OS/p.25
CYH/MMT/OS/p.26
High
rate
d1
Low
rate
EDF
d2
d3
dB
d5
d4
dC
d6
d7
d8
deadline violations
Rate
Monotonic
A B
CYH/MMT/OS/p.28
Potential problems:
Problems emerge with data streams which have no
constant processing time per message
The simplest solution is to schedule these tasks
according to their maximum data rate, but this
decreases processor utilization.
CYH/MMT/OS/p.29
deadline
d
processing time
required
laxity
CYH/MMT/OS/p.30
Problems of laxity-dependence:
The determination of the laxity is inexact as the
processing time can't be exactly specified in advance.
The laxity of waiting processes dynamically changes
over time.
CYH/MMT/OS/p.31
CYH/MMT/OS/p.32
d i ei + max e j + mj = i +1 e j F (d i e j , p j )
1 j m
x
where F ( x, y ) = ceil + 1
y
request
deadline
Task i
deadlines
d1
d2
dA
d3
d4
d5
dB
d6
d7
t ei + ek + em
d8
High
rate
Low
rate
Nonpreemptive
Preemptive
2 3
3 A
5 6
8 9
deadline violations
A
6 B
9 C
CYH/MMT/OS/p.34
CYH/MMT/OS/p.36
File structure
Disadvantages:
Files cannot be extended without copying the whole
files into a larger space.
Second storage is split and fragmented after a number
of creation and deletion operations.
Contiguous placement
2nd file
1st file
3rd file
Non-contiguous placement
1st
file
2nd
file
Non-sequential storage:
3rd
file
Sequential storage:
Each file is organized as a simple sequence of bytes of
records.
Files are stored consecutively on the secondary storage
media.
A file descriptor is usually placed at the beginning of the
file.
Main advantages:
It's efficient for sequential access and direct access.
Disk access time for reading and writing is minimized.
Performance can be further improved with caching.
CYH/MMT/OS/p.37
Two approaches:
To use linked blocks:
Physical blocks containing consecutive logical
locations are linked using pointers.
The file descriptor must contain the number of
blocks occupied by the file, the pointer to the 1st and
the last blocks.
Disadvantage: The cost for random access is high as
all prior data must be read.
Example: In MS-DOS, a file allocation Table (FAT)
is associated with each disk.
To store block information in mapping tables:
Each file is associated with a table where
information like owner, file size, creation time, last
access time, etc., are stored.
CYH/MMT/OS/p.38
Disk management
Disk access is a slow and costly transaction.
Common techniques used in traditional systems to
reduce disk access:
pointers
to data
blocks
Directory structure
Files are usually organized in directories (especially,
tree-structured directories).
CYH/MMT/OS/p.39
CYH/MMT/OS/p.40
Disk scheduling
For random access storage devices, every file operation
may require movements of the read/write head (seek
operation).
The actual time to read or write a disk block is
determined by
The seek time (the time required for the movement of
the read/write head).
The latency time or rotational delay (the time during
which the transfer cannot proceed until the right block
or sector rotates under the read/write head).
The actual data transfer time needed for the data to
copy from disk to main memory.
24
30
16
50
42
45
12
...
Usually, seek time is the largest factor of the actual
transfer time.
...
12
40
22
45
12
40
20
orde
24
30
16
r of
satis
fie
45
42
40
Requests with:
blocknumber
12
20
22
42
qu
d re
30
50
16
50
45
12
40
22
16
50
42
50
42
45
42
45
12
30
16
50
42
45
40
16
50
45
24
30
16
First-Come-First-Served (FCFS)
24
30
16
50
42
45
12
12
40
22
45
12
40
50
42
45
30
16
50
ests
Requests with:
blocknumber
CYH/MMT/OS/p.42
SCAN
C-SCAN
24
30
16
50
42
45
12
...
12
40
22
45
12
40
40
22
20
42
45
12
50
45
12
16
50
12
50
45
42 s
ove
dm
hea ards
w
up
30
16
12
24
16
12
24
s
30
ove
m
d
hea nwards
dow
24
30
16
50
42
45
12
...
Requests with:
blocknumber
12
40
22
45
12
40
40
20
22
42
45
12
50
45
12
16
50
12
50
45
42 s
ove
dm
hea ards
w
up
30
16
12
24
30
16
16
s
12
ove
m
d
hea ards
upw
flyback to 12 here
Requests with:
blocknumber
Like SSTF.
It takes the direction of the current disk movement into
account.
It serves all requests in one direction until it does not
have any requests in this direction anymore.
It provides a very good average seek time.
The service for edge tracks is improved as c.w. SSTF.
CYH/MMT/OS/p.43
CYH/MMT/OS/p.44
Seek
Rotation
time
speed
optical
~200ms
CLV
magnetic ~10ms
CAV
Different algorithms for magnetic and optical disks
are necessary.
File systems on CD-ROMs are defined in ISO 9660.
File Structure and placement on disk
Main goal of the file organization in conventional file
systems:
To make efficient use of the storage capacity (i.e. to
reduce internal and external fragmentation)
To allow arbitrary deletion and extension of files
Main goal of the file organization in multimedia file
systems:
To provide a constant and timely retrieval of data.
Internal fragmentation occurs when blocks of data are
not entirely filled.
External fragmentation occurs when files are stored in a
contiguous way in where the gap cannot be filled after
deleting a file.
CYH/MMT/OS/p.46
CYH/MMT/OS/p.47
CYH/MMT/OS/p.48
CYH/MMT/OS/p.49
3
3
2
3
2
1
1
2
1
...
24
30
16
50
42
45
12
40
22
1
2
1
12
40
22
1
1
2
45
12
40
2
1
2
42
45
40
3
2
2
50
42
40
2
3
2
16
50
42
3
2
3
30
16
50
3
3
3
24
30
50
50
16
42
40
45
12
Requests with:
deadline blocknumber
22
20
CYH/MMT/OS/p.50
3.24
3.30
2.16
3.50
2.42
1.45
1.12
2.40
1.22
...
24
30
16
50
42
45
12
40
22
Modified version 2:
A more accurate perturbation of the deadline is
proposed to enhanced the previous mechanism.
The original goal can be achieved by doing so.
Let N be the actual position of the head.
Case 1: If the head moves upward (toward N max )
Ni
1.12 1 2
2.40 4 0
1.22 2 2
1.45 4 5
2.40 4 0
1.22 2 2
2.42 4 2
2.40 4 0
1.45 4 5
3.50 5 0
2.42 4 2
2.40 4 0
2.16 1 6
3.50 5 0
2.42 4 2
40
45
line
dead
head moves
upward
N max
42
16
dead
22
12
3.30 3 0
3.50 5 0
2.42 4 2
line 2
Requests with:
deadline blocknumber
Ni
, where N max is the
N max
maximum track number on disk, such that
Di + f ( N i ) D j + f ( N j ) holds for all Di D j .
It is selected to be f ( N i ) =
Ni N
for all N i N
N
max
f ( Ni ) =
N max N i
for all N i < N
N
max
Example
Direction
current position, N
0
1
2 3 4 5
6 7
Ni
1/8 2/8 3/8 4/8
f ( N i ) 8/8 7/8 6/8
CYH/MMT/OS/p.52
Ni
0
head moves
downward
f (Ni ) =
Ni
N max
N Ni
N max
N max
for all N i N
Example:
Direction
3.4
3.3
2.0
3.3
2.2
1.2
1.4
2.4
1.1
current position, N
0
1
2 3 4
5
6
7
Ni
4/8 5/8 6/8 7/8
f ( N i ) 3/8 2/8 1/8
deadline
1.1
24
30
16
50
42
45
12
40
22
deadline
2.0
1.4 12
1.2 45
1.1 22
2.0 16
2.2 42
2.4 40
22
45
3.4 24
3.3 30
3.3 50
Gp. 2
Gp. 1
12
deadline
3.3
42
40
16
Requests with:
deadline blocknumber
Gp. 3
24
30
50
CYH/MMT/OS/p.53
CYH/MMT/OS/p.54
Mixed Strategy
It's a mixed strategy based on the shortest seek and the
balanced strategy.
The goal is
To maximize transfer efficiency by minimizing seek
time and latency
To serve process requirements with a limited buffer
space.
With shortest seek, the process of which data block is
closest is served first.
The balanced strategy chooses the process which has
the least amount of buffered data for service because
this process is likely to run out of data.
status of
buffers
Balanced
buffers
SSTF
O
O
O
buffers
O
O
O
continuous
media
streams
CYH/MMT/OS/p.55
CYH/MMT/OS/p.56