Title: MET TC670 B1 Computer Science Concepts in Telecommunication Systems
 1MET TC670 B1Computer Science Concepts in 
Telecommunication Systems
  2Lecture 6, October 28, 
- Midterm Recap 
- Multimedia Operating Systems Concepts
3Midterm Statistics
  4Problem 1 Processes
0xFFFFFFFF
stack (dynamic allocated mem)
3 points
i
SP
address space
heap (dynamic allocated mem)
static data (data segment)
4 points
hello
code (text segment)
ilt100
3 points
PC
0x00000000
- main() 
-  
-  int i 
-  for(i  0 i lt 100 i) printf(hello) 
-  
5Problem 2 CPU Scheduling
- First part easy (5 points) 
- Second part 2 possibilities 
- New job is put in the ready queue first 
- New job immediately runs
6Problem 3 Synchronization
- Solution 
-  Spin-locks is a low-level locking mechanism to 
 synchronize processes. In spin-locks, the caller
 busy-waits or spins for a lock to be released
 (2 points). Spin-locks is not appropriate for
 uniprocessor systems, mainly because it is
 implemented in a less efficient way. One process
 will run at any time. However in a multiprocessor
 system, efficiency is less critical since often
 there are idle processors. On the other hand, the
 simplicity of spin-locks is very desirable (3
 points).
-   
-  Monitor is software module that encapsulates 
 thread data structure and procedures in an
 exclusive fashion. Monitor protects the data from
 unstructured access (2 points). With Hoare
 monitor, the waiter runs immediately and its
 condition is guarantee. Hence, it is efficient
 since the waiter does not have to re-check the
 condition. However, the signaler must do extra
 work to restore monitor invariant before
 signaling. With Mesa monitor, the signaler
 continues. Therefore it is possible that when the
 waiter runs again, the condition is changed again
 (so it needs to re-check the condition). Mesa
 monitor is easy for the signaler since it does
 not have to restore invariant. The signaler may
 simply run until out of the monitor session (3
 points).
7Problem 4 Deadlocks
- Solution 
-  Four conditions of deadlocks are (1) Mutual 
 exclusion, (2) hold-and-wait, (3) no preemption,
 and (4) circular wait (5 points). In this
 example, condition (1) holds as two vehicles
 cannot take the same slot. Condition (2) holds as
 every vehicle holds a slot and is waiting for the
 slot ahead to be released. Condition (3) holds as
 no vehicle can be removed. Condition (4) hold as
 there is a circular wait (5 points). Note you may
 also argue that the circle can be broken and
 there is no deadlock.
-  There are many examples of deadlocks in 
 telecommunication applications. One example is
 teleconferencing  you should pick a reasonable
 one (5 points).
8Problem 5 Memory hierachy
- Solution On average access to main memory takes 
 110ns  0.1ns (3 points). On average access to
 disk takes 10.25ms  0.1ns (3 points). The
 expected time to get a word is 0.30.10.1
 0.5us (2 points). On average the CPU can access
 1sec/0.5us  2M words (2 points).
9Problem 6 Memory Addressing
- Please see the homework 2 (problem 1) for a 
 simple draw of the addressing mechanisms (5
 points). The virtual address space has 32 bits,
 but really only 30 bits are useful. See the
 follows
-   
-  For the virtual address 0x83A4C234, binary 1000 
 0011 1010 0100 1100 0010 0011 0100, its segment
 is 2, its page  is 0x3A4C, its offset is 0x234.
 Let us assume in the page table of segment 2,
 page 0x3A4C contains 0xDDDD. Then the physical
 address is 0xDDDD234 (5 points).
-   
-  For the virtual address 0x94A4D234, binary 1001 
 0100 1010 0100 1101 0010 0011 0100, it is invalid
 since two useless bits are set (5 points).
 Therefore it causes overflow. Note if you ignore
 this you may still get an answer.
10Problem 7 Replacement Algorithms
- Part one easy 5 points 
- Part two new algorithms, table (5 points) 
- The new algorithm is better. This example shows 
 the new algorithm tries to keep the hot items
 (items 1 and 2) in the cache, and it pays off
 eventually. It does so by remembering the number
 of accessed to the items (using a count for each
 item). This algorithm is a more complicated than
 the LRU algorithm. You may also argue that the
 new algorithm may not work well for other access
 patterns. (5 points)
11Problem 8 File Access
- Solution First the root directory / is open, 
 and checked for its sub-directory ssh. Then
 ssh is open, and checked for the file
 ssh_config. Finally, ssh_config is open (5
 points). There are at least 2 disk read
 operations, one to read / and one to read ssh
 (2 points). It is possible that the system needs
 more disk reads, for example if either the
 directory / or ssh is very large and needs
 several disk pages (3 points).
12Problem 9 File Organization
File pointer
-  (1) There are 4 record pages and an index page. 
 The index page contains many pairs of (phone,
 page). Each pair shows that the records with
 phone in a specific range are stored in that
 page. (5 points)
-  (2) To search a record with key 617-353-8924, we 
 first compare this  with those in the index
 page. Then we know which record page potentially
 contains the record. Then we can read that record
 page to find the record. (4 points). Two disk I/O
 are required to get the record, one for the index
 and one for the record page. (1 point)
-  (3) If there are 256000 records in the file, 
 then a single index page will not work, instead
 we need more index pages (probably need up to
 dozens). One simple solution is to link these
 index pages together (5 points). But then if we
 have two many index pages, possibly we need to go
 through all of them to find a record! A better
 solution is to create a higher-level index page
 for the index pages. (It is ok if you do not
 answer in this way).
Index
64 records
64 records
64 records
64 records 
 13Problem 10 Disk Scheduling
- The Elevator algorithm is better in term of 
 efficiency (it finishes all jobs in 23 units of
 time while FCFS needs 29 units. FCFS is better in
 terms of fairness in that it finishes the jobs in
 order, while with Elevator, some earlier jobs may
 wait for a longer time. (5 points)
14Introduction to Multimedia (1)
- Video On Demand (a) ADSL vs. (b) cable 
15Introduction to Multimedia (2)
- Some data rates 
- multimedia, high performance I/O devices
16Multimedia Files
- A movie may consist of several files
17Audio Encoding (1)
- Audio Waves Converted to Digital 
- electrical voltage input 
- binary number as output
18Audio Encoding (2)
- Error induced by finite sampling 
- called quantization noise 
- Examples of sampled sound 
- telephone  pulse code modulation 
- audio compact disks
19Video Encoding
- Scanning Pattern for NTSC Video and Television
20Multimedia Operating Systems
- Multimedia job scheduling 
- Disk scheduling 
- Multimedia file placement and caching 
- Admission control
21The Notion of Real-Time
- A real-time process is a process which delivers 
 the results of the processing in given time-span.
- The system must enforce externally-defined time 
 constraints.
- Speed and efficiency are not the main 
 characteristics of a real-time system.
- The playback of a video sequence is only 
 acceptable when it is presented neither too
 quickly nor too slowly.
- Timing and logical dependencies among different 
 related tasks, processed at the same time, also
 must be considered.
- Audio data sometimes must be synchronized with 
 video data.
22Real-time Scheduling
- To fulfill the timing requirements of continuous 
 media, the operating system must use real-time
 scheduling technique.
- The scheduler must consider the entire end-to-end 
 data path.
- The CPU is just one of the resources. 
- Other components include main memory, storage, 
 I/O devices and networks.
23Multimedia Process Scheduling
- Periodic processes displaying a movie 
- Frame rates and processing requirements may be 
 different for each movie
24Rate Monotonic Scheduling
- The users are assigned priorities such that a 
 shorter fixed period between deadlines is
 associated with a higher priority.
- Used for processes which meet these conditions 
- Each periodic process must complete within its 
 period
- No process dependent on any other process 
- Each process needs same CPU time each burst 
- Any nonperiodic processes have no deadlines 
- Process preemption occurs instantaneously, no 
 overhead
25Earliest Deadline First Scheduling (1)
- Real Time Scheduling algorithms 
- RMS 
- EDF
26Earliest Deadline First Scheduling (2)
Another example of real-time scheduling with RMS 
and EDF 
 27Multimedia File System Paradigms
  28Disk Scheduling for Multimedia
Stream
Order in which disk requests are processed ?
- Static Disk Scheduling 
- In one round, each movie asks for one frame
29Dynamic Disk Scheduling
- Scan-EDF algorithm 
- uses deadlines  cylinder numbers for scheduling
30Multimedia Operating Systems
- Multimedia job scheduling 
- Disk scheduling 
- Multimedia file placement and caching 
- Admission control
31Multimedia File Placement
- How to organize a file on disks? 
- How to store multiple files? 
- How to store a file across multiple disks?
32Two Alternative File Organization Strategies (1)
- Noncontiguous Movie Storage 
- (a) small disk blocks (b) large disk blocks
33Two Alternative File Organization Strategies (2)
- Trade-offs between small, large blocks 
- Frame index 
- heavier RAM usage during movie play 
- little disk wastage 
- Block index (no splitting frames over blocks) 
- low RAM usage 
- major disk wastage 
- Block index (splitting frames over blocks 
 allowed)
- low RAM usage 
- no disk wastage 
- extra seeks
34Placing Multiple files on a Single Disk (1)
- Zipf's law for N20 
- Squares for 20 largest cities in US 
-  sorted on rank order
35Placing Multiple files on a Single Disk (2)
- Organ-pipe distribution of files on server 
- most popular movie in middle of disk 
- next most popular either on either side, etc.
36Placing Files on Multiple Disks
- (a) No striping 
- (b) Same striping pattern for all files 
- (c) Staggered striping 
- (d) Random striping
37Multimedia File Caching
- Block Caching 
- (a) Two users, same movie 10 sec out of sync (b) 
 Merging two streams into one
38Multimedia File Caching
- Most movies stored on DVD or tape 
- copy to disk when needed 
- results in large startup time 
- keep most popular movies on disk 
- Can keep first few min. of all movies on disk 
- start movie from this while remainder is fetched
39Multimedia Operating Systems
- Multimedia job scheduling 
- Disk scheduling 
- Multimedia file placement and caching 
- Admission control
40Admission Control
- An admission controller determines whether a new 
 client can be admitted for service without
 disturbing the clients being served.
- Once the client is admitted, its requirements 
 must be satisfied during the course of service.
- After a new client is admitted, the scheduler 
 schedules the client of when and how it is served.
41Admission Control
Video files 
 42Admission Control Goals
- To service as many clients as possible per unit 
 time (high throughput).
- To maintain a high utilization of the resources. 
- To offer minimum latency for the clients. 
43Admission Criterion
- Service time is the total time spent retrieving 
 media blocks of currently served clients for one
 round.
- Round duration is the minimum playback duration 
 among the currently served clients for a round.
- The admission criterion is 
-  Service_time ? Round_duration 
44Deterministic Admission Control
- Different admission control techniques compute 
 the service time differently.
- Deterministic approach assumes the worst-case 
 scenarios in computing the service time.
- Service_time ? Round_duration 
45Deterministic Admission Control
- Advantages 
- The continuity requirements of each client are 
 not violated during the entire course of their
 playback.
- The admission control algorithm is easy to 
 implement.
- Disadvantages 
- The media server is underutilized since the 
 average time for retrieving a block is usually
 much lower than the worst case value.
- The throughput of the system is much less than 
 the peak one.
46Statistical Admission Control
- It extrapolates the average block retrieval time 
 in future rounds based upon the history of the
 average retrieval times of the most W recent
 rounds.
- It admits the client if the following criterion 
 is satisfied
- Service_time ? Round_duration 
47Statistical Admission Control
- Advantages 
- The server resources are better utilized. As a 
 result, throughput is significantly increased.
- Disadvantages 
- It does not provide absolute guarantee to the 
 clients since the algorithm employs prediction.
-  There are overflow rounds. 
- Several techniques can be applied to distribute 
 the media loss among clients.
- The algorithm is more complicated to implement.
48Reading
- Chapter 7 
- Section 7.1, 7.2, 7.4, 7.6, 7.8
49Next Week
- Multimedia communication protocols 
- Homework assignment 3