If You Buy Some Rtos, What Are The Features You Look For In?
•Deterministic operating system having guaranteed worst-case interrupt latency and context-switch times.
•Documentation providing for the minimum, average, and maximum number of clock cycles required by each system call.
•Interrupt response times should be very minute.
•Context switch time should be very low.
•Compatibility with several plugin devices.
•Overall it should be very reliable.
Why Is Java Mostly Used In Embedded Systems?
•Java was mainly designed and conceptualised for code that can work on different platforms without any hassles and also for being secure enough so as to not harm or corrupt other modules of code.
•Features like exception handling, simple syntax and Automatic Garbage collection all work in its favour as the language for use in ES's.
•Also that it is widely used in the form of Java applets makes it very popular confining it to the limits of JVM. It is Dynamic in nature.
•Its use is also being exploited in enterprise systems in the form of J2EE, J2SE, J2ME in case of mobile applications.
What Are The Commonly Found Errors In Embedded Systems?
•Damage of memory devices due to transient current and static discharges.
•Malfunctioning of address lines due to a short in the circuit.
•Malfunctioning of Data lines.
•Some memory locations being inaccessible in storage due to garbage or errors.
•Improper insertion of Memory devices into the memory slots.
•Faulty control signals.
What Is The Need For Having Multibyte Data Input And Output Buffers In Case Of Device Ports?
•It’s normally the case that some devices transfer the output either in a bursty or a sequential manner and also during input entry. If we take the example of keyboards, all the data entered is stored in a buffer and given at a time or one character at a time.
•In case of networking there may be several requests to access the same resource and all these are queued in a buffer and serviced in the order they are received. Hence to avoid the input/output units from getting overloaded with requests, we use multibyte buffers.
What Is Endianness Of A System And How Do Different Systems Communicate With Each Other?
•Endianness basically refers to the ordering of the bytes within words or larger bytes of data treated as a single entity.
•When we consider a several bytes of data say for instance 4 bytes of data,XYZQ the lower byte if stored in a Higher address and others in successively decreasing addresses, then it refers to the Big Endian and the vice versa of this refers to Little Endian architecture.
•Intel 80x86 usually follows Little Endian and others like IBM systems follow Big Endian formats.
•If the data is being transmitted care has to be taken so as to know as to which byte,whether the higher or the lower byte is being transmitted.
•Hence a common format prior to communication has to be agreed upon to avoid wrong interpretation/calculations.
•Usually layer modules are written so as to automate these conversion in Operating systems.
How Are Macros Different From Inline Functions?
•Macros are normally used whenever a set of instructions/tasks have to be repeatedly performed. They are small programs to carryout some predefined actions.
•We normally use the #define directive in case we need to define the values of some constants so in case a change is needed only the value can be changed and is reflected throughout.
#define mul(a,b) (a*b)
•The major disadvantage of macros is that they are not really functions and the usual error checking and stepping through of the code does not occur.
•Inline functions are expanded whenever it is invoked rather than the control going to the place where the function is defined and avoids all the activities such as saving the return address when a jump is performed. Saves time in case of short codes.
inline float add(float a,float b)
{
return a+b;
}
•Inline is just a request to the compiler and it is upto to the compiler whether to substitute the code at the place of invocation or perform a jump based on its performance algorithms.
What Could Be The Reasons For A System To Have Gone Blank And How Would You Debug It?
Possible reasons could be
•PC being overheated.
•Dust having being accumulated all around.
•CPU fans not working properly .
•Faulty power connections.
•Faulty circuit board from where the power is being drawn.
•Support Drivers not having being installed.
•Debugging steps which can be taken are
•Cleaning the system thoroughly and maintaining it in a dust-free environment. Environment that is cool enough and facilitates for easy passage of air should be ideal enough.
•By locating the appropriate support drivers for the system in consideration and having them installed.
Explain What Is Semaphore?
A semaphore is an abstract datatype or variable that is used for controlling access, by multiple processes to a common resource in a concurrent system such as multiprogramming operating system. Semaphores are commonly used for two purposes
• To share a common memory space
• To share access to files
When One Must Use Recursion Function? Mention What Happens When Recursion Functions Are Declared Inline?
Recursion function can be used when you are aware of the number of recursive calls is not excessive. Inline functions property says whenever it will called, it will copy the complete definition of that function. Recursive function declared as inline creates the burden on the compilers execution.
Explain Whether We Can Use Semaphore Or Mutex Or Spinlock In Interrupt Context In Linux Kernel?
Semaphore or Mutex cannot be used for interrupt context in Linux Kernel. While spinlocks can be used for locking in interrupt context.
What Is The Need For An Infinite Loop In Embedded Systems?
Infinite Loops are those program constructs where in there is no break statement so as to get out of the loop, it just keeps looping over the statements within the block defined.
Example
While(Boolean True) OR for(;;);
{
//Code
}
Embedded systems need infinite loops for repeatedly processing/monitoring the state of the program. One example could be the case of a program state continuously being checked for any exceptional errors that might just occur during run time such as memory outage or divide by zero etc.,
A Vast Majority Of High Performance Embedded Systems Today Use Risc Architecture Why?
•According to the instruction sets used, computers are normally classified into RISC and CISC. RISC stands for 'Reduced Instruction Set Computing' . The design philosophy of RISC architecture is such that only one instruction is performed on each machine cycle thus taking very less time and speeding up when compared to their CISC counterparts.
•Here the use of registers is optimised as most of the memory access operations are limited to store and load operations.
•Fewer and simple addressing modes, and simple instruction formats leads to greater efficiency, optimisation of compilers, re-organisation of code for better throughput in terms of space and time complexities. All these features make it the choice of architecture in majority of the Embedded systems.
•CISC again have their own advantages and they are preferred whenever the performance and compiler simplification are the issues to be taken care of.
Why Do We Need Virtual Device Drivers When We Have Physical Device Drivers?
Device drivers are basically a set of modules/routines so as to handle a device for which a direct way of communication is not possible through the user's application program and these can be thought of as an interface thus keeping the system small providing for minimalistic of additions of code, if any.
Physical device drivers can’t perform all the logical operations needed in a system in cases like IPC, Signals and so on...
The main reason for having virtual device drivers is to mimic the behaviour of certain hardware devices without it actually being present and these could be attributed to the high cost of the devices or the unavailability of such devices.
These basically create an illusion for the users as if they are using the actual hardware and enable them to carryout their simulation results.
Examples could be the use of virtual drivers in case of Network simulators,also the support of virtual device drivers in case a user runs an additional OS in a virtual box kind of a software.
What Does Nslookup Do? Explain Its Two Modes.
Nslookup is used to find details related to a Domain name server. Details like IP addresses of a machine, MX records, servers etc. It sends a domain name query packet to the corresponding DNS.
Nslookup has two modes. Interactive and non interactive. Interactive mode allows the user to interact by querying information about different hosts and domains.
Non interactive mode is used to fetch information about the specified host or domain.
Interactive mode
Nslookup [options] [server]
What Is Bash Shell?
Bash is a free shell for UNIX. It is the default shell for most UNIX systems. It has a combination of the C and Korn shell features. Bash shell is not portable. any Bash-specific feature will not function on a system using the Bourne shell or one of its replacements, unless bash is installed as a secondary shell and the script begins with #!/bin/bash. It supports regular and expressions. When bash script starts, it executes commands of different scripts.
What Are Two Functions The Move Mv Command Can Carry Out?
The mv command moves files and can also be used to rename a file or directory.
What Does The Top Command Display?
Top provides an ongoing look at processor activity in real time.It displays a listing of the most CPU-intensive tasks on the system, and can provide an interactive inter¬ face for manipulating processes. (q is to quit)
How To Find Difference In Two Configuration Files On The Same Server?
Use diff command that is compare files line by line
diff -u /usr/home/my_project1/etc/ABC.conf /usr/home/my_project2/etc/ABC.conf
What Is The Best Way To See The End Of A Logfile.log File?
Use tail command - output the last part of files
tail -n file_name ( the last N lines, instead of the last 10 as default)
Please Write A Loop For Removing All Files In The Current Directory That Contains A Word 'log'?
for i in *log*; do rm $i; done
How To Switch To A Previously Used Directory?
cd -
What Are The Process States In Linux?
Process states in Linux
Running: Process is either running or ready to run.
Interruptible: a Blocked state of a process and waiting for an event or signal from another process.
Uninterruptible:- a blocked state. Process waits for a hardware condition and cannot handle any signal.
Stopped: Process is stopped or halted and can be restarted by some other process.
Zombie: process terminated, but information is still there in the process table.
What Is A Zombie?
Zombie is a process state when the child dies before the parent process. In this case the structural information of the process is still in the process table. Since this process is not alive, it cannot react to signals. Zombie state can finish when the parent dies. All resources of the zombie state process are cleared by the kernel.
Explain Each System Calls Used For Process Management In Linux.
System calls used for Process management
Fork () :- Used to create a new process
Exec() :- Execute a new program
Wait():- wait until the process finishes execution
Exit():- Exit from the process
Getpid():- get the unique process id of the process
Getppid():- get the parent process unique id
Nice():- to bias the existing property of process
How Do You List Files In A Directory?
ls - list directory contents
ls -l (-l use a long listing format)
How Do You List All Files In A Directory, Including The Hidden Files?
ls -a (-a, do not hide entries starting with .)
How Do You Find Out All Processes That Are Currently Running?
ps -f (-f does full-format listing.)
How Do You Find Out The Processes That Are Currently Running Or A Particular User?
ps -au Myname (-u by effective user ID (supports names)) (a - all users)
How Do You Kill A Process?
kill -9 8 (process_id 8) or kill -9 %7 (job number 7)
kill -9 -1 (Kill all processes you can kill.)
killall - kill processes by name most (useful - killall java)
What Would You Use To Edit Contents Of The File?
vi screen editor or jedit, nedit or ex line editor
What Would You Use To View Contents Of A Large Error Log File?
tail -10 file_name ( last 10 rows)
How Do You Log In To A Remote Unix Box?
Using telnet server_name or ssh -l ( ssh - OpenSSH SSH client (remote login program))
How Do You Get Help On A Unix Terminal?
man command_name
info command_name (more information)
How Do You List Contents Of A Directory Including All Of Its Subdirectories, Providing Full Details And Sorted By Modification Time?
ls -lac
-a all entries
-c by time
What Is A Filesystem?
Sum of all directories called file system.
A file system is the primary means of file storage in UNIX. File systems are made of inodes and superblocks.
How Do You Get Its Usage (a Filesystem)?
By storing and manipulate files.
How Do You Check For Processes Started By User 'pat'?
ps -fu pat (-f -full_format u -user_name )
How Do You Start A Job On Background?
bg %4 (job 4)
What Utility Would You Use To Replace A String '2001' For '2002' In A Text File?
Grep, Kde( works on Linux and Unix)
What Utility Would You Use To Cut Off The First Column In A Text File?
awk, kde
How To Copy File Into Directory?
cp /tmp/file_name . (dot mean in the current directory)
How To Remove Directory With Files?
rm -rf directory_name
What Is Linux Shell?
Linux shell is a user interface used for executing the commands. Shell is a program the user uses for executing the commands. In UNIX, any program can be the users shell. Shell categories in Linux are
Bourne shell compatible, C shell compatible, nontraditional, and historical.
What Is Shell Script?
A shell script, as the name suggests, is a script written for the shell. Script here means a programming language used to control the application. The shell script allows different commands entered in the shell to be executed. Shell script is easy to debug, quicker as compared to writing big programs. However the execution speed is slow because it launches a new process for every shell command executed. Examples of commands are cp, cn, cd.
•Deterministic operating system having guaranteed worst-case interrupt latency and context-switch times.
•Documentation providing for the minimum, average, and maximum number of clock cycles required by each system call.
•Interrupt response times should be very minute.
•Context switch time should be very low.
•Compatibility with several plugin devices.
•Overall it should be very reliable.
Why Is Java Mostly Used In Embedded Systems?
•Java was mainly designed and conceptualised for code that can work on different platforms without any hassles and also for being secure enough so as to not harm or corrupt other modules of code.
•Features like exception handling, simple syntax and Automatic Garbage collection all work in its favour as the language for use in ES's.
•Also that it is widely used in the form of Java applets makes it very popular confining it to the limits of JVM. It is Dynamic in nature.
•Its use is also being exploited in enterprise systems in the form of J2EE, J2SE, J2ME in case of mobile applications.
What Are The Commonly Found Errors In Embedded Systems?
•Damage of memory devices due to transient current and static discharges.
•Malfunctioning of address lines due to a short in the circuit.
•Malfunctioning of Data lines.
•Some memory locations being inaccessible in storage due to garbage or errors.
•Improper insertion of Memory devices into the memory slots.
•Faulty control signals.
What Is The Need For Having Multibyte Data Input And Output Buffers In Case Of Device Ports?
•It’s normally the case that some devices transfer the output either in a bursty or a sequential manner and also during input entry. If we take the example of keyboards, all the data entered is stored in a buffer and given at a time or one character at a time.
•In case of networking there may be several requests to access the same resource and all these are queued in a buffer and serviced in the order they are received. Hence to avoid the input/output units from getting overloaded with requests, we use multibyte buffers.
What Is Endianness Of A System And How Do Different Systems Communicate With Each Other?
•Endianness basically refers to the ordering of the bytes within words or larger bytes of data treated as a single entity.
•When we consider a several bytes of data say for instance 4 bytes of data,XYZQ the lower byte if stored in a Higher address and others in successively decreasing addresses, then it refers to the Big Endian and the vice versa of this refers to Little Endian architecture.
•Intel 80x86 usually follows Little Endian and others like IBM systems follow Big Endian formats.
•If the data is being transmitted care has to be taken so as to know as to which byte,whether the higher or the lower byte is being transmitted.
•Hence a common format prior to communication has to be agreed upon to avoid wrong interpretation/calculations.
•Usually layer modules are written so as to automate these conversion in Operating systems.
Oracle Frequently Asked Linux Interview Questions Answers |
How Are Macros Different From Inline Functions?
•Macros are normally used whenever a set of instructions/tasks have to be repeatedly performed. They are small programs to carryout some predefined actions.
•We normally use the #define directive in case we need to define the values of some constants so in case a change is needed only the value can be changed and is reflected throughout.
#define mul(a,b) (a*b)
•The major disadvantage of macros is that they are not really functions and the usual error checking and stepping through of the code does not occur.
•Inline functions are expanded whenever it is invoked rather than the control going to the place where the function is defined and avoids all the activities such as saving the return address when a jump is performed. Saves time in case of short codes.
inline float add(float a,float b)
{
return a+b;
}
•Inline is just a request to the compiler and it is upto to the compiler whether to substitute the code at the place of invocation or perform a jump based on its performance algorithms.
What Could Be The Reasons For A System To Have Gone Blank And How Would You Debug It?
Possible reasons could be
•PC being overheated.
•Dust having being accumulated all around.
•CPU fans not working properly .
•Faulty power connections.
•Faulty circuit board from where the power is being drawn.
•Support Drivers not having being installed.
•Debugging steps which can be taken are
•Cleaning the system thoroughly and maintaining it in a dust-free environment. Environment that is cool enough and facilitates for easy passage of air should be ideal enough.
•By locating the appropriate support drivers for the system in consideration and having them installed.
Explain What Is Semaphore?
A semaphore is an abstract datatype or variable that is used for controlling access, by multiple processes to a common resource in a concurrent system such as multiprogramming operating system. Semaphores are commonly used for two purposes
• To share a common memory space
• To share access to files
When One Must Use Recursion Function? Mention What Happens When Recursion Functions Are Declared Inline?
Recursion function can be used when you are aware of the number of recursive calls is not excessive. Inline functions property says whenever it will called, it will copy the complete definition of that function. Recursive function declared as inline creates the burden on the compilers execution.
Explain Whether We Can Use Semaphore Or Mutex Or Spinlock In Interrupt Context In Linux Kernel?
Semaphore or Mutex cannot be used for interrupt context in Linux Kernel. While spinlocks can be used for locking in interrupt context.
What Is The Need For An Infinite Loop In Embedded Systems?
Infinite Loops are those program constructs where in there is no break statement so as to get out of the loop, it just keeps looping over the statements within the block defined.
Example
While(Boolean True) OR for(;;);
{
//Code
}
Embedded systems need infinite loops for repeatedly processing/monitoring the state of the program. One example could be the case of a program state continuously being checked for any exceptional errors that might just occur during run time such as memory outage or divide by zero etc.,
A Vast Majority Of High Performance Embedded Systems Today Use Risc Architecture Why?
•According to the instruction sets used, computers are normally classified into RISC and CISC. RISC stands for 'Reduced Instruction Set Computing' . The design philosophy of RISC architecture is such that only one instruction is performed on each machine cycle thus taking very less time and speeding up when compared to their CISC counterparts.
•Here the use of registers is optimised as most of the memory access operations are limited to store and load operations.
•Fewer and simple addressing modes, and simple instruction formats leads to greater efficiency, optimisation of compilers, re-organisation of code for better throughput in terms of space and time complexities. All these features make it the choice of architecture in majority of the Embedded systems.
•CISC again have their own advantages and they are preferred whenever the performance and compiler simplification are the issues to be taken care of.
Why Do We Need Virtual Device Drivers When We Have Physical Device Drivers?
Device drivers are basically a set of modules/routines so as to handle a device for which a direct way of communication is not possible through the user's application program and these can be thought of as an interface thus keeping the system small providing for minimalistic of additions of code, if any.
Physical device drivers can’t perform all the logical operations needed in a system in cases like IPC, Signals and so on...
The main reason for having virtual device drivers is to mimic the behaviour of certain hardware devices without it actually being present and these could be attributed to the high cost of the devices or the unavailability of such devices.
These basically create an illusion for the users as if they are using the actual hardware and enable them to carryout their simulation results.
Examples could be the use of virtual drivers in case of Network simulators,also the support of virtual device drivers in case a user runs an additional OS in a virtual box kind of a software.
What Does Nslookup Do? Explain Its Two Modes.
Nslookup is used to find details related to a Domain name server. Details like IP addresses of a machine, MX records, servers etc. It sends a domain name query packet to the corresponding DNS.
Nslookup has two modes. Interactive and non interactive. Interactive mode allows the user to interact by querying information about different hosts and domains.
Non interactive mode is used to fetch information about the specified host or domain.
Interactive mode
Nslookup [options] [server]
What Is Bash Shell?
Bash is a free shell for UNIX. It is the default shell for most UNIX systems. It has a combination of the C and Korn shell features. Bash shell is not portable. any Bash-specific feature will not function on a system using the Bourne shell or one of its replacements, unless bash is installed as a secondary shell and the script begins with #!/bin/bash. It supports regular and expressions. When bash script starts, it executes commands of different scripts.
What Are Two Functions The Move Mv Command Can Carry Out?
The mv command moves files and can also be used to rename a file or directory.
What Does The Top Command Display?
Top provides an ongoing look at processor activity in real time.It displays a listing of the most CPU-intensive tasks on the system, and can provide an interactive inter¬ face for manipulating processes. (q is to quit)
How To Find Difference In Two Configuration Files On The Same Server?
Use diff command that is compare files line by line
diff -u /usr/home/my_project1/etc/ABC.conf /usr/home/my_project2/etc/ABC.conf
What Is The Best Way To See The End Of A Logfile.log File?
Use tail command - output the last part of files
tail -n file_name ( the last N lines, instead of the last 10 as default)
Please Write A Loop For Removing All Files In The Current Directory That Contains A Word 'log'?
for i in *log*; do rm $i; done
How To Switch To A Previously Used Directory?
cd -
What Are The Process States In Linux?
Process states in Linux
Running: Process is either running or ready to run.
Interruptible: a Blocked state of a process and waiting for an event or signal from another process.
Uninterruptible:- a blocked state. Process waits for a hardware condition and cannot handle any signal.
Stopped: Process is stopped or halted and can be restarted by some other process.
Zombie: process terminated, but information is still there in the process table.
What Is A Zombie?
Zombie is a process state when the child dies before the parent process. In this case the structural information of the process is still in the process table. Since this process is not alive, it cannot react to signals. Zombie state can finish when the parent dies. All resources of the zombie state process are cleared by the kernel.
Explain Each System Calls Used For Process Management In Linux.
System calls used for Process management
Fork () :- Used to create a new process
Exec() :- Execute a new program
Wait():- wait until the process finishes execution
Exit():- Exit from the process
Getpid():- get the unique process id of the process
Getppid():- get the parent process unique id
Nice():- to bias the existing property of process
How Do You List Files In A Directory?
ls - list directory contents
ls -l (-l use a long listing format)
How Do You List All Files In A Directory, Including The Hidden Files?
ls -a (-a, do not hide entries starting with .)
How Do You Find Out All Processes That Are Currently Running?
ps -f (-f does full-format listing.)
How Do You Find Out The Processes That Are Currently Running Or A Particular User?
ps -au Myname (-u by effective user ID (supports names)) (a - all users)
How Do You Kill A Process?
kill -9 8 (process_id 8) or kill -9 %7 (job number 7)
kill -9 -1 (Kill all processes you can kill.)
killall - kill processes by name most (useful - killall java)
What Would You Use To Edit Contents Of The File?
vi screen editor or jedit, nedit or ex line editor
What Would You Use To View Contents Of A Large Error Log File?
tail -10 file_name ( last 10 rows)
How Do You Log In To A Remote Unix Box?
Using telnet server_name or ssh -l ( ssh - OpenSSH SSH client (remote login program))
How Do You Get Help On A Unix Terminal?
man command_name
info command_name (more information)
How Do You List Contents Of A Directory Including All Of Its Subdirectories, Providing Full Details And Sorted By Modification Time?
ls -lac
-a all entries
-c by time
What Is A Filesystem?
Sum of all directories called file system.
A file system is the primary means of file storage in UNIX. File systems are made of inodes and superblocks.
How Do You Get Its Usage (a Filesystem)?
By storing and manipulate files.
How Do You Check For Processes Started By User 'pat'?
ps -fu pat (-f -full_format u -user_name )
How Do You Start A Job On Background?
bg %4 (job 4)
What Utility Would You Use To Replace A String '2001' For '2002' In A Text File?
Grep, Kde( works on Linux and Unix)
What Utility Would You Use To Cut Off The First Column In A Text File?
awk, kde
How To Copy File Into Directory?
cp /tmp/file_name . (dot mean in the current directory)
How To Remove Directory With Files?
rm -rf directory_name
What Is Linux Shell?
Linux shell is a user interface used for executing the commands. Shell is a program the user uses for executing the commands. In UNIX, any program can be the users shell. Shell categories in Linux are
Bourne shell compatible, C shell compatible, nontraditional, and historical.
What Is Shell Script?
A shell script, as the name suggests, is a script written for the shell. Script here means a programming language used to control the application. The shell script allows different commands entered in the shell to be executed. Shell script is easy to debug, quicker as compared to writing big programs. However the execution speed is slow because it launches a new process for every shell command executed. Examples of commands are cp, cn, cd.
Linux Training in Gurgaon
ReplyDeletePost a Comment