Sunday, October 9, 2011

How to install Linux kernel source code

This is example of how to download linux kernel source code for study.
I downloaded on fedora 10. same should work in other versions of fedora.

1.  use the command

   yumdownloader --source kernel

this will download src.rpm for linux kernel. it will download something
similiar to kernel-2.6.27.41-170.2.117.fc10.src.rpm file.


2.  use

rpm -Uvh kernel-2.6.27.41-170.2.117.fc10.src.rpm

then

cd ~/rpmbuild/SPECS/

then

rpmbuild -bp --target=$(uname -m) kernel.spec

after this

u can see source code in the directory ~/rpmbuild/BUILD


this is a way to download source code for study,
but u cannot compile it because we have not download
depencies and relevant patches.





Wednesday, December 29, 2010

Tech Discussion

Streaming and Progressive Download difference 

Many times we encounter the word progressive download and streaming. when we see a progressive downloaded video or a streaming video both looks same, then what is the difference. when we want to implement a streaming we need to allocate a playback buffer , in that buffer we used to copy video data coming from the network and  that buffer should be large enough to hold sufficient video data to avoid jitter. jitter the problem that data coming form the network, is not coming at constant speed, sometime a large chunk (say 1 MB) comes in 200 ms and sometime very small chunk in the same time, so we cannot play smooth, but if we have large enough buffer then even if bandwidth goes low, we can still play form the playback buffer, but large buffer again creates a problem of latency. suppose video at the server is started at 10:00 am and in the client it started playing at 10:04 am. because it was waiting for the playback buffer to full. this scenario become worst in case of live video conferencing, when camera moved to a different person and client still show the previous person talking, here comes the difference between progressive download and streaming. progressive download is just a download of file, store in a buffer and  play. file can be downloaded via HTTP or FTP protocol and played in client but there is no feedback from the client.
but if we take example of streaming there are different protocols like (RTP/RTSP/RTCP) . all these three protcol together makes streaming possible. Here RTCP protocol continuous gives the feedback about the playback and reception of data to the server. one example suppose  during streaming bandwidth goes low, and client is not able to steam, then client can tell server to transmit at low bitrate. then server transmit the same video at say low bitrate (it can achieve by reducing the resolution  or by dropping some frames), so the real time (live) behavior of video is still maintained. Above example of video conferencing can be better achieved by steaming not by progressive download. youtube is example of progressive download, there video is downloaded by HTTP and played. most video conferencing software use RTP/RTSP protocol, which is example of real time streaming.



Real Time Operating System

 

what is a Real Time Operation System, A RTOS is an operating system which can finish a service(or say task) in predefined time limit. or if say in difficult technical term RTOS is a OS which is deterministic in task execution.
 Now Question is what is Hard Real Time OS and what is Soft Real Time OS.  A RTOS is hard or soft it dependent on probability of failure to meet the deadline.  A HARD real time OS is which almost never fails to meet deadline, and SOFT real time OS is one which can sometime fail to meet the deadline. If say in technical terms hard real time system is strictly deterministic.  The term deterministic itself is difficult to understand. So lets understand what is the meaning of deterministic. suppose we have to search a element in a link list, then  it can take any time depending on element is at the beginning of list or at the end of list. so we say search in a link list is not a deterministic operation.  Now if say that we want to search a element in a Hashtable, then search operation in a hash table is a DETERMINISTIC, we can calculate the constant time that it will take to search any element, before actual execution. generally RTOS means it should be deterministic, but when we give a task to RTOS for execution, a complete task is divided into many small small operations like receiving interrupt, servicing interrupt, then some memory operations, ALU operations etc, but  if one or two small operations are not deterministic among all.  we can say  such a system is SOFT real time OS. but if we design a system in which all these small small operations are deterministic, so over all we can say task execution is also deterministic , so such a system is HARD real time OS. One Example of a HARD Real time system is a "Pacemaker" which is a device fitted into heart patients. it regulates the heart beat, This is a HARD Real time system. If it fails once, patient can loose his life and Example of SOFT Real time system is a mobile phone's operating system, all mobile phones have REAL time OS. but if cannot meet the deadline maximum a call drop can happen, or in worst case watchdog can expire and mobile can reboot, but no task is so critical like a life threatening . So a mobile phones OS ( or at least kernel ) is a SOFT Real time system.
                            One of the main difference between a RTOS and a general purpose OS is its scheduler. a RTOS scheduler is essentially pre-emtive. It means whenever a new higher priority task comes, it preempt the current running task and schedule the next.