embedded software questions
Mutexes
A mutex object enables one thread into a controlled section, forcing other threads which tries to gain access to that section to wait until the first thread has moved out from that section, Mutex can only be released by thread which had acquired it, Mutex will always have a known owner, Mutex is also a tool that is used to provide deadlock-free mutual exclusion (either consumer or producer can have the key and proceed with their work), Mutexes by definition are binary semaphores, so there are two states locked or unlocked
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
What Does an Embedded Software Engineer Do?
An embedded software engineer might touch any part of the embedded software. They might actually write the code or affect any other part of the design and development. They might also assist with testing and maintenance of the system once it has been deployed. After the design and implementation phases, embedded software upgrades are a huge part of an embedded software engineer's role. While most embedded software engineers deal with the software (rather than the hardware), they need to understand the interaction between the hardware and the software to be successful. An embedded software engineer is sometimes used interchangeably with an embedded systems engineer, but the roles are slightly different. The software engineer will focus on the software, while the systems engineer's position is a bit more comprehensive. This role might oversee the construction of the entire system, which often includes both software programming and hardware development.
Compare compile time and runtime polymorphism.
Compile-time Polymorphism: The method to be executed is known at compile time. And the call is resolved by the compiler, Provides quicker execution because it is known at the compile time, Achieved by operation or function overloading Runtime Polymorphism: The method to be executed is known at run time. The compiler does not resolve the call, Provides slower execution because it is known at the run time, Achieved by function overriding
What is an Embedded Software Engineer?
Embedded software is any first layer of code that runs on a device. Working on embedded software requires not only an understanding of code but also requires a deeper level of understanding of the actual hardware on which the code operates. Embedded software engineers must also understand how chip datasheets relate to the code. In general, embedded software is self-contained and only runs a single program. As a result, an embedded software engineer's major role is often to determine the smallest number of drivers that the hardware needs to run the software. Embedded software is everywhere; it is on far more devices than computers or phones. Even a toaster can have embedded software. Anything that has underlying software to function likely has embedded software. The embedded software engineer creates this code. Their roles often overlap with software engineering and electrical engineering. This unique interaction makes embedded software engineers more focused on how the code interacts with the device than the code or the device itself. Embedded software engineers' roles are becoming even more important as companies work toward "smarter" devices—from wearable technologies to advanced healthcare technology to smart cars and rocket ships. Any "smart" device requires embedded software to function properly.
Mention what are buses used for communication in embedded system?
For embedded system, the buses used for communication includes I2C: It is used for communication between multiple ICs CAN: It is used in automobiles with centrally controlled network USB: It is used for communication between CPU and devices like mouse, etc. While ISA, EISA, PCI are standard buses for parallel communication used in PCs, computer network devices, etc.
Mention what are the essential components of embedded system?
Hardware Processor Memory Timers I/O circuits System application specific circuits Software It ensures the availability of System Memory It checks the Processor Speed availability The need to limit power lost when running the system continuously Real Time Operating System It runs a process as per scheduling and do the switching from one process to another
How is struct different from class?
Structure: Its members are public by default, The default access specifiers are public when deriving a struct from a class/struct Class: Its members are private by default., The default access specifiers are private when deriving a class
CAN
The CAN communication protocol is a carrier-sense, multiple-access protocol with collision detection and arbitration on message priority (CSMA/CD+AMP). CSMA means that each node on a bus must wait for a prescribed period of inactivity before attempting to send a message. The Controller Area Network - CAN bus is a message-based protocol designed to allow the Electronic Control Units (ECUs) found in today's automobiles, as well as other devices, to communicate with each other in a reliable, priority-driven fashion.
Difference between equal to (==) and assignment operator(=)?
The equal to operator == checks whether two values are equal or not. If equal, then it's true; otherwise, it will return false. The assignment operator = allots the value of the right-side expression to the left operand.
Explain what is microcontroller?
The microcontroller is a self-contained system with peripherals, memory and a processor that can be used as embedded system.
What do you understand about polymorphism in C++?
The term polymorphism refers to the presence of multiple forms. Polymorphism usually occurs when there is a hierarchy of classes that are linked by inheritance. C++ polymorphism means that depending on the type of object that invokes the function, a different function will be executed.
List out various uses of timers in embedded system?
Timers in embedded system are used in multiple ways Real Time Clock (RTC) for the system Initiating an event after a preset time delay Initiating an even after a comparison of preset times Capturing the count value in timer on an event Between two events finding the time interval Time slicing for various tasks Time division multiplexing Scheduling of various tasks in RTOS
UART
UART stands for universal asynchronous receiver / transmitter and defines a protocol, or set of rules, for exchanging serial data between two devices. UART is very simple and only uses two wires between transmitter and receiver to transmit and receive in both directions. Both ends also have a ground connection.
What among these is used to return the number of characters in the string?
Both size and length are used to return the number of characters in the string.
What is the size of the int data type?
4 bytes, the integer data type is 4 bytes
Which among the following operators cannot be overloaded?
?: operator cannot be overloaded because it is not syntactically possible. -,+,% can be overloaded
Explain what is embedded system in a computer system?
An embedded system is a computer system that is part of a larger system or machine. It is a system with a dedicated function within a larger electrical or mechanical system.
Asynchronous vs. Synchronous
Asynchronous is a non-blocking architecture, so the execution of one task isn't dependent on another. Tasks can run simultaneously. Synchronous is a blocking architecture, so the execution of each operation is dependent on the completion of the one before it.
What does DMA address will deal with?
DMA address deals with physical addresses. It is a device which directly drives the data and address bus during data transfer. So, it is purely physical address.
Explain what is the need for an infinite loop in embedded systems?
Embedded systems require infinite loops for repeatedly processing or monitoring the state of the program. For instance, the case of a program state continuously being verified for any exceptional errors that might just happen during run-time such as memory outage or divide by zero, etc.
I2C
I2C stands for Inter-Integrated Circuit. It is a bus interface connection protocol incorporated into devices for serial communication. It was originally designed by Philips Semiconductor in 1982. Recently, it is a widely used protocol for short-distance communication. It is also known as Two Wired Interface(TWI).
What are the four different data types in C++?
Primitive/Basic: Char, int, short, float, double, long, bool, etc. Derived: Array, pointer, etc. Enumeration: Enum User-defined: Structure, class, etc.
When one must use recursion function?
Recursion function can be used when you are aware of the number of recursive calls is not excessive.
Can you compile a program without the main function?
Yes, you can compile a program without the main function, but you cannot run or execute the program because the main() function is the entry point, from where all the execution begins. And without the entry point, then you can execute the program.
What are access modifiers?
You use access modifiers to define accessibility for the class members. It defines how to access the members of the class outside the class scope. There are three types of access modifiers: Private Public Protected
microprocessor
any type of miniature electronic device that contains the arithmetic, logic, and control circuitry necessary to perform the functions of a digital computer's central processing unit.
central processing unit (CPU)
central processing unit (CPU) is the portion of a computer that retrieves and executes instructions. The CPU is essentially the brain of a CAD system. It consists of an arithmetic and logic unit (ALU), a control unit, and various registers.
What is std in C++?
std is a standard namespace in C++
What are classes and objects in C++?
A class is like a blueprint of an object. It is a user-defined data type with data members and member functions and is defined with the keyword class. You define objects as an instance of a class. Once it creates the object, then it can operate on both data members and member functions. class class_name { Access specifier; (public, private, protected) data members; member functions(); }
microcontroller
A microcontroller is a compact integrated circuit designed to govern a specific operation in an embedded system. A typical microcontroller includes a processor, memory and input/output (I/O) peripherals on a single chip
Explain what is a Watchdog Timer?
A watchdog timer is an electronic device or electronic card that execute specific operation after certain time period if something goes wrong with an electronic system.
What is the difference between C and C++?
C: C is a procedure-oriented programming language, It follows a top-down approach, C doesn't support function or operator overloading, C language doesn't support virtual and friend function, C language has 32 keywords C++: C++ is a partially object-oriented programming language, It follows a bottom-up approach, C++ supports function as well as function overloading, C++ language supports both virtual and friend functions, C++ language contains 52 keywords
SPI
In a computer, a serial peripheral interface (SPI) is an interface that enables the serial (one bit at a time) exchange of data between two devices, one called a master and the other called a slave . An SPI operates in full duplex mode. This means that data can be transferred in both directions at the same time.
Discuss the difference between prefix and postfix?
In prefix (++i), first, it increments the value, and then it assigns the value to the expression. In postfix (i++), it assigns the value to the expression, and then it increments the variable's value.
Explain what is interrupt latency? How can you reduce it?
Interrupt latency is a time taken to return from the interrupt service routine post handling a specific interrupt. By writing minor ISR routines, interrupt latency can be reduced.
Explain what are real-time embedded systems?
Real-time embedded systems are computer systems that monitor, respond or control an external environment. This environment is connected to the computer system through actuators, sensors, and other input-output interfaces.
Semaphores
Semaphore allows multiple access to shared resources, A semaphore can be signaled from any other thread or process, While for semaphore you won't know which thread we are blocking on, Semaphore is a synchronization tool to overcome the critical section problem, Semaphores are usually referred to counted locks
Mention how I/O devices are classified for embedded system?
Serial and parallel have Input and Output Synchronous: Audio/Video signal (input), Audio/Video (output) Asynchronous: Keypad, Mouse, Modem (input), Printer, Modem (output)
Serial vs parallel processing
Serial memory processing is the act of attending to and processing one item at a time, while parallel memory processing is the act of attending to and processing all items simultaneously.
SCM tools
Software configuration management
List out some of the commonly found errors in Embedded Systems?
Some of the commonly found errors in embedded systems are: Damage of memory devices static discharges and transient current Address line malfunctioning due to a short in circuit Data lines malfunctioning Due to garbage or errors some memory locations being inaccessible in storage Inappropriate insertion of memory devices into the memory slots Wrong control signals
do-while
The do-while loop first iterates the loop body once, then it checks for the condition Syntax: do{ statements } while(condition); If the condition in a do-while loop is false, then the body will also execute once.
while loop
While: The while loop verifies the condition; if it's true, then it iterates the loop till the condition becomes false. Syntax: while (condition) { statements } If the condition is false in a while loop, then not a single statement will execute inside the loop.
Why embedded system is useful?
With embedded system, it is possible to replace dozens or even more of hardware logic gates, input buffers, timing circuits, output drivers, etc. with a relatively cheap microprocessor.