Friday, August 23, 2013

sync folders over remote placeT

http://www.finiteloops.com/weblog/?p=111

rsync -avze ssh /localpath(source)/ user@remoteaddress:/remotepath/(destination)

Tuesday, August 20, 2013

Static Library .a and Dynamic Library .so

http://www.ilkda.com/compile/Static_Versus_Dynamic.htm


Creating .so and .a in Unix
http://stackoverflow.com/questions/1648215/creating-so-and-a-in-unix

Sunday, August 18, 2013

gcc warning: function used but not defined

static

internal linkage

http://stackoverflow.com/questions/5526461/gcc-warning-function-used-but-not-defined

warning: format not a string literal and no format arguments

This warning is gcc's way of telling you that it cannot verify the format string argument to the printf style function (printf, fprintf... etc). This warning is generated when the compiler can't manually peek into the string and ensure that everything will go as you intend during runtime. Lets look at a couple of examples.
Case 1. This string can be verified at compile time and the compiler will allow it without warning:
printf("This string has no format");
Case 2: For this case, the compiler can detect that you have a format specifier and will raise a different warning. On my machine it said "warning: too few arguments for format".
// This will most probably crash your machine
printf("Not a safe string to %s"); 
Case 3. Now this is somewhat your case. You are taking a string generated at runtime and trying to print it. The warning you are getting is the compiler warning you that there could be a format specifier in the string. Say for eg "bad%sdata". In this case, the runtime will try to access a non-existent argument to match the %s. Even worse, this could be a user trying to exploit your program (causing it to read data that is not safe to read).
char str[200];
scanf("%s", str)
printf(str)
 http://stackoverflow.com/questions/4419293/warning-format-not-a-string-literal-and-no-format-arguments

Friday, August 9, 2013

Anatomy of real-time Linux architecture

http://www.ibm.com/developerworks/library/l-real-time-linux/

An operating system that can support the desired deadlines of the real-time tasks (even under worst-case processing loads) is called a hard real-time system. But hard real-time support isn't necessary in all cases. If an operating system can support the deadlines on average, it's called a soft real-time system. Hard real-time systems are those in which missing a deadline can have a catastrophic result (such as deploying an airbag too late or allowing brake pressure to slip for too long). Soft real-time systems can miss deadlines without the overall system failing (such as losing a frame of video).
Although the thin kernel approach has its advantages (hard real-time support coexisting with a standard Linux kernel), the approach does have drawbacks. The real-time and non-real-time tasks are independent, which can make debugging more difficult. Also, non-real-time tasks do not have full Linux platform support (the thin kernel execution is called thin for a reason).
Examples of this approach include RTLinux (now proprietary and owned by Wind River Systems), Real-Time Application Interface (RTAI), and Xenomai.








The new configuration option CONFIG_PREEMPT changes this behavior of the kernel by allowing processes to be preempted if high-priority work is available to do (even if the process is in the middle of a system call).

Trade-off
Although the option enables soft real-time performance and even under load makes the operating system execute more smoothly,


it does so at a cost. That cost is slightly lower throughput and a small reduction in kernel performance because of the added overhead of the CONFIG_PREEMPT option. This option is useful for desktop and embedded systems, but it may not be right in all scenarios (for example, servers).

Kernel 2.6 for high resolution timers

1us resolution (if supported by underlying hardware)

Timer management (implemented with Red-black tree) for efficiency.

O(1) scheduler 

Preempt_RT Patch 

The PREEMPT_RT patch provides several modifications to yield hard real-time support. 

Reimplementing some of the kernel locking primitives to be fully preemptable,

Priority Inheritance

in kernel mutexes, and converting interrupt handlers into kernel threads so that they are fully preemptable

This article gave a brief overview of some of the techniques used to bring real-time computing to the Linux kernel. Numerous early attempts used a thin-kernel approach to segregate the real-time tasks from the standard kernel. Later, nano-kernel approaches came on the scene that appear very much like the hypervisors used in virtualization solutions today. Finally, the Linux kernel provides its own means for real time, both soft and hard.




Which operating system book do you recommend?

http://programmers.stackexchange.com/questions/7340/which-operating-system-book-do-you-recommend