1.
|
Thread 1 : Network Thread
This thread is meant for the purpose of monitoring a particular network port
for incoming data.
|
2.
|
Thread 2 : Decompressor Thread
This thread is meant for the purpose of decompressing the incoming data and
generating the video frames in sequence.
|
3.
|
Thread 3 : Renderer Thread
This thread is meant for the purpose of displaying the generated video frames at predefined intervals
|
4.
|
The above 3 threads must communicate using shared buffers
- An in-buffer between Network and the decompressor threads
- An out-buffer between the decompressor and renderer threads
|
5.
|
The Network thread calls the listen_to_port() to gather network from the data
( which internally uses socket , bind and listen calls to listen for incoming data on
a particular port ). For the sake of this assignment let the incoming data be a
set of randomly generated strings coming to the port from a seperate server program.
|
6.
|
The incoming data recieved by the Network thread is placed in the In-buffer (in the sequence of arrival).
|
7.
|
The Decompressor thread calls the decompress() which takes in data from the In-buffer and returns
a frame of predefined size.For the sake of this assignment take data of predefined size from the In-buffer, and use it to
fill in a struct frame and write the structure to the Out-buffer.
|
8.
|
The Renderer thread pick data frames from the Out-buffer and calls the display() which prints the data contained
within the frames on to the screen.
|
9.
|
The thread framework described above is to be implemented by means of condition variables.
|
10.
|
Function Calls to be incorporated :
pthread calls :
pthread_create, pthread_mutex_init, pthread_mutex_destroy, pthread_cond_init, pthread_cond_destroy,
pthread_mutex_lock , pthread_mutex_lock, pthread_cond_wait, pthread_cond_signal.
socket calls : socket, bind, listen, connect,accept , send, recv.
shared memory calls: shmget, shmat, shmdt
|