Embedded C,RTOS interview questions with answers

1) What is RTOS and why do we go for it?
     RTOS sheludes execution in a timely manner,manages system resources and provides a consistent          foundation for developing application code.
     Application code designed for RTOS could be ranging from simple digital stopwatch to complex            aircraft navigation systems.

RTOS differs from the GPOS by
  Task scheduling : RTOS like vxWorks,neclueos, uC/OSII uses a strict scheduling algorithms (like pre-     emptive scheduling) that makes the tasks meet their deadline to get the job done.
  
The sheduler decides which task run when by knowing its priorities.Whereas In a GPOS, the scheduler typically uses a "fairness" policy that offers no assurances that high-priority, time-critical tasks will execute in preference to lower-priority tasks.This policy is maintained to obtain the overall output by the desktop pc or server pc.

2) What are the different types of semaphores in vxworks RTOS? Which is the fastest?
     VxWorks supports three types of semaphores.
     1) Binary 2) mutual exclusion, and 3)counting semaphores.
     Fastest : Binary semaphore.

 3. What is priority inversion ? why priority inversion occurs?
     Tasks in RTOS's communucates between them via IPC source semphores for synchornization.
     The situation priority inversion occurs when a higher priority taks is ready to run but it is waiting for       a shared resource that is to be released by a lower priority task currently running .Now higher-                 priority task is pending on the resource and it has to wait until the lower priority task to finish.

4. What are the solutions for priority inversion ?

    1) Priority inheritance
    2) Priority ceiling

How can I install a .bin file

Go into a terminal and issue the following command in the directory
where the bin file is,
                $ chmod a+x name_of_file.bin
Then run it by writing
                $sudo ./name_of_file.bin

Create your own Executables in Linux

we can create our own executables  :

Ex: need to run a command every time : adb shell -vthreadtime

Steps : 

- vi yourfile  [ or any editor .. like vim ,gedit ..]
- insert and write your line of script here .,..
     - adb shell -vthreadtime [ your own code or scrip to run ]
- save and close : wq!
- chmod +x yourfile

that's it.. just run  $ ./yourfile

or want to run everywhere .. put the same in your local bin Like: /usr/local/bin

$ yourfile   .. 


Its a thought Changing and Life Changing Story

Believe In yourself (Self-Confidence is More Powerful than God)

A Businessman was deep in debt and could not see any way out.
Creditors and Suppliers were demanding payments. He sat in the
park, deep in thought, wondering if anything could save his company from bankruptcy.

Suddenly an old man appeared before him and asked, “I can see that something is troubling you seriously”.

After listening patiently the old man said, “I believe I can help you”.

He asked the man his name, wrote out a cheque and put it into his hands saying, “Take this money, meet me here exactly one year from today… and you can pay me back at that time”.

Then he turned and disappeared as quickly as he had come.

The businessman saw in his hands a cheque for $ 500,000… signed by Warren Buffet, one of the richest men in the world.

“I can erase my worries instantly” he realized. But instead, the man decided to put the uncashed cheque in his safe, knowing that it might give him the strength to work out to save his
business and to use this only in case of dire emergency.

With changed thinking he negotiated better deals, restructured his business and worked rigorously with full zeal and enthusiasm and got several big deals. Within few months, he was out of debt
and started making money once again.

Exactly one year later he returned to the park with the un cashed cheque.

As agreed, the old man appeared.

But just as the businessman was about to hand him back the cheque and share his success story, a nurse came running up and grabbed the old man.

“I’m so glad I caught him” she cried. “I hope he hasn’t been bothering you much. He always escapes from the mental hospital and tells people that he is Warren Buffet”, saying this she took the old man away.

The surprised man just stood there, stunned!

All year long he had been dealing thinking that he had half a million dollars behind him… Its not the money, real or imagined
that turns our life around.

It is our Self-confidence that gives us the power to achieve anything & everything that we want

If you liked this Story and If it made an impact on your thinking, then Plz Don't forget to Share it with Others

Setting Up a TFTP Server

Purpose

The purpose of this page is to contain information on how to setup a TFTP server on Linux. This is useful for downloading Linux kernel images to the target board during development.

Using Ubuntu

There are multiple options for TFTP servers in Ubuntu, below are two possibilities atftp and tftpd-hpa.

Using atftp in Ubuntu 8.04 LTS

To setup atftp on Ubuntu 8.04 LTS, you can follow these steps:

Install atftp Server in Ubuntu

host $ sudo aptitude install atftpd
This will complete the installation

why memset in C

memset
function
void * memset ( void * ptr, int value, size_t num );
Fill block of memory
Sets the first num bytes of the block of memory pointed by ptr to the specified value (interpreted as an unsigned char).

Parameters

ptr
Pointer to the block of memory to fill.

Beautiful HR Interview Questions !!

Here are some of the typical HR Interview questions asked to find out if the candidates have extraordinary thinking capability 


Question 2: Interviewer (to a student girl candidate) - What if one morning you woke up & found that you were pregnant ?

I will be very excited and take a day off, to celebrate with my husband. (Normally an unmarried girl will be shocked to hear this, but she managed it well. Why should I think it in the wrong way, she said later when asked.)

Question 3: Interviewer: He ordered a cup of coffee for the candidate. Coffee arrived and was kept before the candidate, then he asked "What is before you?"

Candidate: Instantly replied "Tea" and got selected.



Linux basic

How to Extract tar file in:


Open terminal And got the present dir where tar/tar.bz2 is present.

and in terminal >>


tar xvjf filename.tar.bz2


$ tar zxf file.tar.gz
$ tar zxf file.tgz

VirtualBox Shared Folders in Ubuntu 10.10 Guest with Windows 7 Host


Yes, it’s important to transfer data between Linux ubuntu guest and any host OS. As of today, VirtualBox does not support latest Ubuntu 10.10 as guest officially, so installing guest additions is not straight forward. Our earlier post on installing guest additions worked for all users to get more screen resolutions, seamless and full screen mode with mouse integration. Let me show how to use the same packages to setup shared folders and easily transfer data between virtual machine and physical computer.

Follow the Steps to Configure VirtualBox Shared Folders in Ubuntu 10.10 Guest with Windows 7

1)  install VB guest additions.
2) Go to ‘Shared Folders’ option under virtual machine’s settings. Browse the Windows 7 folder or partition you want to share with Ubuntu 10.10.
Note: Any network between both Operating Systems not required.
VirtualBox Shared Folders in Ubuntu 10.10 Guest

Dennis Ritchie | End of a life well lived, beginning of a legend


Dennis Ritchie, the father of the 'C' programming language and the co-designer of the venerable UNIX operating system, passed away on 8 Oct '11.
His death has not generated nearly the amount and rhetoric that Job's has... that's just sad, it should have.


 A snippet: 
  ...

IndianOil requires 225 engineers in 2012

Indian Oil Corporation Limited (IndianOil), the transnational energy major, is the highest ranked Indian Company at 98th position in the prestigious ‘Fortune Global 500’ list. For over five decades, IndianOil has remained a leader due to the patronage of over a billion Indians. With one of Asia’s largest network of refineries, pipelines, retail outlets and the most trusted range of brands, IndianOil us also redefining its role as a Maharatna company with a group of dedicated and ever evolving work force.


Pursuing its journey to realize its new Vision, IndianOil is transforming itself to emerge as The Energy of India and to become a globally admired company. Recognized as one of the ‘Best Employers in India’ by the Great Place to Work Institute (GPW), India, IndianOil is offering excellent career opportunities as Engineers/ Graduate Apprentice Engineers (GAEs) in the following engineering disciplines:


Civil Engineering (excluding Construction/ Transportation Engineering)
Chemical Engineering (including Petrochemicals Engineering)
 Computer Science & Information Technology
 Electrical Engineering ( including Electrical & Electronics engineering but excluding Electrical & Communication/ Telecommunication engineering)
 Instrumentation Engineering (Including Electronics & Instrumentation engineering but excluding Electronics & Communication engineering/ Telecommunication engineering)
 Mechanical Engineering (excluding Production/ Manufacturing/ Industrial Engineering)
 Metallurgical Engineering

INPUT DEVICES – SENSORS AND OUTPUT DEVICES – INDICATORS


INPUT DEVICES – SENSORS


Every electronic circuit must have some kind of input device so that we (the outside world) can "communicate" with it.





THE SWITCH

When the switch is closed it allows current to flow through it.

TYPES OF SWITCH


There are various types of switches that can do slightly different jobs in a circuit

SPST - sinqle pole, single throw

SPDT - single pole, double throw

DPST - double pole, double throw

DPDT - double pole, double throw


The diagrams show you examples of each type.

STUDENT INVESTIGATION
Which switch would you use to:
(a) change the direction of an electric motor
(b) switch on a light
(c) switch off a green light and switch on a red light
(d) switch on two motors at once


THE LIGHT DEPENDENT RESISTOR

This is a resistor which has a resistance that changes with the amount of LIGHT that falls on It. In the DARK its resistance is LARGE (millions of ohms), in the LIGHT its resistance is SMALL (tens of ohms). Very little current will flow through It In the dark.

THE THERMISTOR

This is a type resistor which has a resistance that changes with TEMPERATURE. In the COLD its resistance is LARGE (thousands of ohms), in the HEAT its resistance is SMALL (tens of ohms). Very little current will flow through it when it is cold.

Virtual functions in C++


 C++ virtual function is a member function of a class, whose functionality can be over-ridden in its derived classes. The whole function body can be replaced with a new set of implementation in the derived class. The concept of c++ virtual functions is different from C++ Function overloading.

C++ Virtual Function - Properties:

   C++ virtual function is,
  • A member function of a class
  • Declared with virtual keyword
  • Usually has a different functionality in the derived class
  • A function call is resolved at run-time
   The difference between a non-virtual c++ member function and a virtual member function is, the non-virtual member functions are resolved at compile time. This mechanism is called static binding. Where as the c++ virtual member functions are resolved during run-time. This mechanism is known as dynamic binding.

C++ Virtual Function - Reasons:

   The most prominent reason why a C++ virtual function will be used is to have a different functionality in the derived class.
   For example a Create function in a class Window may have to create a window with white background. But a class calledCommandButton derived or inherited from Window, may have to use a gray background and write a caption on the center. The Create function for CommandButton now should have a functionality different from the one at the class called Window.

C++ Virtual function - Example:

   This article assumes a base class named Window with a virtual member function named Create. The derived class name will be CommandButton, with our over ridden function Create.
     class Window // Base class for C++ virtual function example
     {
       public:
          virtual void Create() // virtual function for C++ virtual function example
          {
               cout <<"Base class Window"<

     class CommandButton : public Window
     {
       public:
          void Create()
          {
              cout<<"Derived class Command Button - Overridden C++ virtual function"<create();="" x="new" y->create();="" y="new" {="" };="" }<="" }="">

Vivid Technologies Interview Questions


1. What is the diff. between pointer variable and reference variable
2. What is static library and dynamic library
3. What is soft link
4. What is virtual function in C++
5. What is polymorphism in C++
6. What is the diff between Inline and Macro
7. What is the output of $WC | ls –l > file

Where does global static local register variables free memory and C Program instructions get stored?


Local Variables    are stored in Stack.
 Register variables are stored in Register. 
Global & static variables are stored in data segment. 
The memory created dynamically are stored in Heap  And 
The C program instructions get stored in code segment.
  

To be a good programmer is very necessary to understand the memory structure.


Memory organization


(1) What is memory cell?
Answer:

Entire RAM has divided in number of equal part, which is known as memory cell.Capacity of each cell is to store one-byte data.
i.e char a reserve one memory cell while float a reserve four memory cell.
Each memory cell has unique address.Address are always in whole number an increasing order.

(2) What is residence memory?


Answer:


RAM has divided into two parts:
(1) Extended memory (useless)
(2) Residence memory :
When any program is executed it is stored in the residence memory .For turbo c, it has 1MB residence memory i.e when we open turbo c it store 1MB in the RAM.

(3) What is physical address ?



Answer: 





20 bit address of the memory cell is known as physical address or real address.In 20 bit we can represent address from 0x00000 to 0xFFFFF.

(4) What is segmentation?

Ans:



Residential memory of RAM of size 1MB has divided into 16 equal part.These part is called segment.Each segment has size is 64KB.
1MB=16*64KB
This process of division is known as segmentation.

(5) What is necessity of segmentation?

Ans:

Physical address are 20 bit.But we have no pointer of 20 bit.So pointer can not access whole residential address .So to solve this problem we have three different pointer and segmentation has done.

Difference between .com program and .exe program. AND Warning code in c programming


Difference between .com program and .exe program.
Answer:
Both .com and .exe program are executable program but .com program execute faster than .exe program. All drivers are .com program.


Warning code in c programming

S.N.
Warning message
Code
ANSI Violations
1
Assigning 'type' to 'enumeration'
eas
2
Bit fields must be signed or unsigned int
bbf
3
Both return and return with a value used
ret
4
Declare type 'type' prior to use in prototype
dpu
5
Division by zero
zdi
6
Hexadecimal value contains more than 3 digits
big
7
Initializing 'enumeration' with 'type'
bei
8
'identifier' is declared as both external and static
ext
9
Ill-formed pragma
ill
10
Initialization is only partially bracketed
pin
11
Redefinition of 'macro' is not identical
dup
12
Suspicious pointer conversion
sus
13
Undefined structure 'structure'
stu
14
Void functions may not return a value
voi
Frequent Errors
1
Code has no effect
eff
2
Function should return a value
rvl
3
Parameter 'parameter' is never used
par
4
Possible use of 'identifier' before definition
def
5
Possibly incorrect assignment
pia
6
Unreachable code
rch
Less Frequent Errors
1
Ambiguous operators need parentheses
amb
2
Array variable 'identifier' is near
ias
3
Call to function with no prototype
pro
4
Call to function 'function' with no prototype
pro
5
Condition is always false
wccc
6
Condition is always true
wccc
7
'identifier' declared but never used
use
8
'identifier' is assigned a value that is never used
aus
9
No declaration for function 'function'
nod
10
Structure passed by value
stv
11
Superfluous & with function
amp
Portability Warnings
1
Constant is long
cln
2
Constant out of range in comparison
rng
3
Conversion may lose significant digits
sig
4
Non portable pointer comparison
cpt
5
Non portable pointer conversion
rpt
6
Mixing pointers to signed and unsigned char
ucp