You are on page 1of 56

Unit-1

1.explain non operational quality attributes of embedded systems

Non-Operational Quality Attributes.

These are attributes not related to operation or functioning of an embedded system. The way
an embedded system operates affects its overall quality.
These are the attributes that are associated with the embedded system before it can be put in
operation.
Response

Response is a measure of quickness of the system.


It gives you an idea about how fast your system is tracking the input variables.
Most of the embedded system demand fast response which should be real-time.

Throughput
Throughput deals with the efficiency of system.
It can be defined as rate of production or process of a defined process over a stated
period of time.
In case of card reader like the ones used in buses, throughput means how much transaction
the reader can perform in a minute or hour or day.

Reliability

Reliability is a measure of how much percentage you rely upon the proper functioning of the
system
Mean Time between failures and Mean Time To Repair are terms used in defining system
reliability.
Mean Time between failures can be defined as the average time the system is functioning
before a failure occurs.
Mean time to repair can be defined as the average time the system has spent in repairs.

Maintainability

Maintainability deals with support and maintenance to the end user or a client in case of
technical issues and product failures or on the basis of a routine system checkup
It can be classified into two types :-

Scheduled or Periodic Maintenance


This is the maintenance that is required regularly after a periodic time interval.
Example :
Periodic Cleaning of Air Conditioners
Refilling of printer cartridges.

2. Maintenance to unexpected failure

This involves the maintenance due to a sudden breakdown in the functioning


of the system.
Example:

Air conditioner not powering on


Printer not taking paper in spite of a full paper stack
Security
• Confidentiality, Integrity and Availability are three corner stones of information security.

Confidentiality deals with protection data from unauthorized disclosure.


Integrity gives protection from unauthorized modification.
Availability gives protection from unauthorized user
Certain Embedded systems have to make sure they conform to the security measures.
Ex. An Electronic Safety Deposit Locker can be used only with a pin number like a password.

Safety

Safety deals with the possible damage that can happen to the operating person and environment
due to the breakdown of an embedded system or due to the emission of hazardous materials
from the embedded products.

A safety analysis is a must in product engineering to evaluate the anticipated damage and
determine the best course of action to bring down the consequence of damages to an acceptable
level.

Non Operational Attributes


Testability and Debug-ability

• It deals with how easily one can test his/her design, application and by which mean he/she can
test it.
• In hardware testing the peripherals and total hardware function in designed manner
• Firmware testing is functioning in expected way
• Debug-ability is means of debugging the product as such for figuring out the probable sources
that create unexpected behavior in the total system

Evolvability
• For embedded system, the qualitative attribute “Evolvability” refer to ease with which the embedded
product can be modified to take advantage of new firmware or hardware technology.

Portability

• Portability is measured of “system Independence”.


• An embedded product can be called portable if it is capable of performing its operation as it is
intended to do in various
environments irrespective of different processor and or controller and embedded operating
systems.

Time to prototype and market

Time to Market is the time elapsed between the conceptualization of a product and time at
which the product is ready for selling or use

Product prototyping help in reducing time to market.


Prototyping is an informal kind of rapid product development in which important feature of the
under consider are develop.
In order to shorten the time to prototype, make use of all possible option like use of reuse, off
the self component etc.

Per unit and total cost

Cost is an important factor which needs to be carefully monitored. Proper market study and
cost benefit analysis should be carried out before taking decision on the per unit cost of the
embedded product.
When the product is introduced in the market, for the initial period the sales and revenue will
be low
There won’t be much competition when the product sales and revenue increase.
During the maturing phase, the growth will be steady and revenue reaches highest point and
at retirement time there will be a drop in sales volume

2. Explain the memory selection for embedded systems

Erase Max Erase


Type Volatile? Writeable? Cost (per Byte) Speed
Size Cycles
SRAM Yes Yes Byte Unlimited Expensive Fast
DRAM Yes Yes Byte Unlimited Moderate Moderate
Masked
No No n/a n/a Inexpensive Fast
ROM
Once, with a
PROM No device n/a n/a Moderate Fast
programmer
Yes, with a Limited
Entire
EPROM No device (consult Moderate Fast
Chip
programmer datasheet)
Limited Fast to read,
EEPROM No Yes Byte (consult Expensive slow to
datasheet) erase/write
Limited Fast to read,
Flash No Yes Sector (consult Moderate slow to
datasheet) erase/write
Expensive
NVRAM No Yes Byte Unlimited (SRAM + Fast
battery)

3 explain important characteristics of embedded systems

1. An embedded system is software embedded into computer hardware that makes a system
dedicated to be used for variety of application.

2. Embedded system generally used for do specific task that provide real-time output on the
basis of various characteristics of an embedded system.
3. Embedded system may contain a smaller part within a larger device that used for serving the
more specific application to perform variety of task using hardware-software intermixing
configuration.

4. It provides high reliability and real-time computation ability

Level-2

1.discuss overview of various interfaces for on board communication

communication interface is essential for communicating with various subsystems of the embedded
system and with the external world.for an embedded product,the communicate interface can be viewed
in to two different perspectives they are:
board level communication interface(on -board communication)
product level communication interface(External communication)
Embedded product is a combination of different of components(chips/devices)arranged on a printed
circuit board .it interconnects the various components with in an embedded product is refereed as
devices (board level )
serial interfaces like I2C, SPI,UART, 1-wire etc and parallel bus interface are example for on -board
communication

some embedded system are self -contained units and they don’t requires and interaction and data transfer
with other sub-system or external world.on the other hand ,certain embedded systems may be part of a
large distributed system and there requires interaction and data transfer for various devices and sub-
modules.
the product level is responsible for data transfer between the embedded system and other devices .in
this level it can be either a wired or wire less media and it can be a serial or a parallel
interface.infrared(IF),Bluetooth(BT),wireless LAN(wi-fi),radio frequency
waves(RF),GPRS/3G/4GLTE,etc. are the examples for wireless communication. RS-232 C/RS-
422/RS-485, USB, Ethernet, IEEE 1394 port, parallel port,CF-II interface, SDIO, example for wired .
it is not mandatory that am embedded systemshould contain an external system

2.discuss the programmable logic devices in embedded systems


PLDs are semiconductor devices that can be programmed to obtain required logic device. Because of
the advantage of re-programmability, they have replaced special purpose logic devices like Logic
gates, flip-flops, counters and multiplexers in many semicustom applications. It reduces design time
and thus reduces time for the product to reach the market. It consists of arrays of AND and OR gates,
which can be programmed to realize required logic function.

Device programmer blows fuses on the PLD to control each gate operation. Inexpensive software
tools are used for quick development, simulation and testing, therefore design cost is comparatively
low. Another important advantage is that customer can modify their design, based on changes in
requirement

3.Classify the embedded systems and explain each classification

Types of Embedded Systems

Embedded systems can be classified into different types based on performance, functional
requirements and performance of the microcontroller.

Types of Embedded systems

Embedded systems are classified into four categories based on their performance and functional
requirements:

• Stand alone embedded systems

• Real time embedded systems

• Networked embedded systems

• Mobile embedded systems

Embedded Systems are classified into three types based on the performance of
the microcontroller such as
• Small scale embedded systems

• Medium scale embedded systems

• Sophisticated embedded systems

Stand Alone Embedded Systems

Real Time Embedded Systems

Networked Embedded Systems

Mobile Embedded Systems

Small Scale Embedded Systems

Medium Scale Embedded Systems

Sophisticated Embedded Systems

Applications of Embedded Systems:

Level-3

1.Explain the classification of embedded systems based on

a)generation b)complexity and performance

Types of Embedded Systems

Embedded systems can be classified into different types based on performance, functional
requirements and performance of the microcontroller.

2.Explain how embedded systems is designed to serve the purpose of

a) Data collection

b) data communication

c)control

1. Data Collection/Storage/Representation:-
Performs acquisition of data from the external world. The collected data can be
either analog or digital Data collection is usually done for storage, analysis, manipulation and
transmission  The collected data may be stored directly in the system or may be transmitted to some
other systems or it may be processed by the system or it may be deleted instantly after giving a
meaningful representation

2. Data Communication:- Embedded Data communication systems are deployed in


applications ranging from complex satellite communication systems to simple home networking
systems Embedded Data communication systems are dedicated for data communication The data
communication can happen through a wired interface (like Ethernet, RS-232C/USB/IEEE1394 etc) or
wireless interface (like Wi-Fi, GSM,/GPRS, Bluetooth, ZigBee etc) Network hubs, Routers, switches,
Modems etc are typical examples for dedicated data transmission embedded systems

3. Data (Signal) Processing:- Embedded systems with Signal processing functionalities


are employed in applications demanding signal processing like Speech coding, synthesis, audio video
codec, transmission applications etc Computational intensive systems Employs Digital Signal
Processors (DSPs)

4. Monitoring:- Embedded systems coming under this category are specifically


designed for monitoring purpose They are used for determining the state of some variables using input
sensors They cannot impose control over variables. Electro Cardiogram (ECG) machine for
monitoring the heart beat of a patient is a typical example for this The sensors used in ECG are the
different Electrodes connected to the patient‟s body Measuring instruments like Digital CRO, Digital
Multi meter, Logic Analyzer etc used in Control & Instrumentation applications are also examples of
embedded systems for monitoring purpose

5. Control:- Embedded systems with control functionalities are used for imposing
control over some variables according to the changes in input variables Embedded system with control
functionality contains both sensors and actuators Sensors are connected to the input port for capturing
the changes in environmental variable or measuring variable The actuators connected to the output
port are controlled according to the changes in input variable to put an impact on the controlling
variable to bring the controlled variable to the specified range Air conditioner for controlling room
temperature is a typical example for embedded system with „Control‟ functionality Air conditioner
contains a room temperature sensing element (sensor) which may be a thermistor and a handheld unit
for setting up (feeding) the desired temperature The air compressor unit acts as the actuator. The
compressor is controlled according to the current room temperature and the desired temperature set
by the end user.

3.Illustrate an application specific embedded systems with suitable example washing machine
Unit-2

Level-1

1.explain the different electronics control units used in automotive systems

2.explain different characteristics of embedded system in details.

Characteristics of an Embedded System


• Single-functioned − An embedded system usually performs a specialized operation and does
the same repeatedly. For example: A pager always functions as a pager.

• Tightly constrained − All computing systems have constraints on design metrics, but those
on an embedded system can be especially tight. Design metrics is a measure of an
implementation's features such as its cost, size, power, and performance. It must be of a size
to fit on a single chip, must perform fast enough to process data in real time and consume
minimum power to extend battery life.

• Reactive and Real time − Many embedded systems must continually react to changes in the
system's environment and must compute certain results in real time without any delay.
Consider an example of a car cruise controller; it continually monitors and reacts to speed and
brake sensors. It must compute acceleration or de-accelerations repeatedly within a limited
time; a delayed computation can result in failure to control of the car.

• Microprocessors based − It must be microprocessor or microcontroller based.

• Memory − It must have a memory, as its software usually embeds in ROM. It does not need
any secondary memories in the computer.

• Connected − It must have connected peripherals to connect input and output devices.

• HW-SW systems − Software is used for more features and flexibility. Hardware is used for
performance and security.
3.explain the role of watchdog timer in embedded systems

Watchdog timers come in many configurations, and many allow their configurations to be
altered. Microcontrollers often include an integrated, on-chip watchdog. In other computers the
watchdog may reside in a nearby chip that connects directly to the CPU, or it may be located on an
external expansion card in the computer's chassis. The watchdog and CPU may share a common clock
signal, as shown in the block diagram below, or they may have independent clock signals.

Level-2

1.explain the merits and limitations of parallel port over serial interface.

Advantages and Disadvantages of Using Parallel Data Transmission

The main advantages of parallel transmission over serial transmission are:

• it is easier to program;
• and data is sent faster.
Although parallel transmission can transfer data faster, it requires more transmission channels than
serial transmission. This means that data bits can be out of sync, depending on transfer distance and
how fast each bit loads. A simple of example of where this can be seen is with a voice over IP (VOIP)
call when distortion or interference is noticeable. It can also be seen when there is skipping or
interference on a video stream.

When is parallel transmission used to send data?

Parallel transmission is used when:

• a large amount of data is being sent;


• the data being sent is time-sensitive;
• and the data needs to be sent quickly.

A scenario where parallel transmission is used to send data is video streaming. When a video is streamed
to a viewer, bits need to be received quickly to prevent a video pausing or buffering. Video streaming
also requires the transmission of large volumes of data. The data being sent is also time-sensitive as
slow data streams result in poor viewer experience.

2.explain about timer and counting devices in embedded hardware

A timer is a specialized type of clock which is used to measure time intervals. A timer that counts
from zero upwards for measuring time elapsed is often called a stopwatch. It is a device that counts
down from a specified time interval and used to generate a time delay, for example, an hourglass is a
timer.

A counter is a device that stores (and sometimes displays) the number of times a particular event or
process occurred, with respect to a clock signal. It is used to count the events happening outside the
microcontroller. In electronics, counters can be implemented quite easily using register-type circuits
such as a flip-flop.

Difference between a Timer and a Counter

Timer Counter

The register incremented for The register is incremented considering 1 to 0


every machine cycle. transition at its corresponding to an external input
pin (T0, T1).

Maximum count rate is 1/12 of Maximum count rate is 1/24 of the oscillator
the oscillator frequency. frequency.

A timer uses the frequency of the A counter uses an external signal to count pulses.
internal clock, and generates
delay.

3.what is sequential circuit?draw a 3-bit binary counter using T-flip flop and explain its functioning
Level-3
1.what is integrated circuit ? explain the different types of integrations for IC s.
Integrated Circuits

Integrated circuit or IC or microchip or chip is a microscopic electronic circuit array formedby the
fabrication of various electrical and electronic components (resistors, capacitors, transistors, and so on)
on a semiconductor material (silicon) wafer, which can perform operations similar to the large discrete
electronic circuits made of discrete electronic components.
Integrated Circuits

As all these arrays of components, microscopic circuits and semiconductor wafer material base are
integrated together to form a single chip, hence, it is called as integrated circuit or integrated chip or
microchip.

Electronic circuits are developed using individual or discrete electronic components with different sizes,
such that the cost and size of these discrete circuits increase with the number of components used in the
circuit. To conquer this negative aspect, the integrated circuit technology was developed – Jack Kilby
of Texas Instruments developed the first IC or integrated circuit in the 1950s and thereafter, Robert
Noyce of Fairchild Semiconductor solved some practical problems of thisintegrated circuit.

Different Types of Integrated Circuits

There are different types of ICs; classification of Integrated Circuits is done based on various criteria.
A few types of ICs in a system are shown in the below figure with their names in a tree format.

Different Types of ICs

Based on the intended application, the IC are classified as analog integrated circuits, digital integrated
circuits and mixed integrated circuits.

Digital Integrated Circuits

The integrated circuits that operate only at a few defined levels instead of operating over all levels of
signal amplitude are called as Digital ICs and these are designed by using multiple number of digital
logic gates, multiplexers, flip flops and other electronic components of circuits.These logic gates work
with binary input data or digital input data, such as 0 (low or false or logic 0) and 1 (high or true or
logic 1).
Digital Integrated Circuits

The above figure shows the steps involved in designing a typical digital integrated circuits.These digital
ICs are frequently used in the computers, microprocessors, digital signal processors, computer networks
and frequency counters. There are different types of digital ICs or types of digital integrated circuits,
such as programmable ICs, memory chips, logic ICs, power management ICs and interface ICs.

Analog Integrated Circuits

The integrated circuits that operate over a continuous range of signal are called as Analog ICs. These
are subdivided as linear Integrated Circuits (Linear ICs) and Radio Frequency Integrated Circuits (RF
ICs). In fact, the relationship between the voltage and current maybe nonlinear in some cases over a
long range of the continuous analog signal.
Analog Integrated Circuits

The frequently used analog IC is an operational amplifier or simply called as an op-amp, similar to the
differential amplifier, but possesses a very high voltage gain. It consists of very less number of
transistors compared to the digital ICs, and, for developing analog application specific integrated
circuits (analog ASICs), computerized simulation tools are used.

Mixed Integrated Circuits

The integrated circuits that are obtained by the combination of analog and digital ICs on a single chip
are called as Mixed ICs. These ICs functions as Digital to Analog converters, Analog to Digital
converters (D/A and A/D converters) and clock/timing ICs. The circuit depicted in the above figure is
an example of mixed integrated circuit which is a photograph of the 8 to 18 GHz self healing radar
receiver.

Mixed Integrated Circuits

This mixed-signal Systems-on-a-chip is a result of advances in the integration technology, which


enabled to integrate digital, multiple analog and RF functions on a single chip.

General types of integrated circuits(ICs) include the following:

Logic Circuits
Logic Circuits

These ICs are designed using logic gates-that work with binary input and output (0 or 1). These are
mostly used as decision makers. Based on the logic or truth table of the logic gates, all the logic gates
connected in the IC give an output based on the circuit connected inside the IC- such that this output is
used for performing a specific intended task. A few logic ICs are shown above.

2.List out the differences between digital combinational and sequential circuits

Difference between combinational and sequential circuit

Prerequisite – Combinational circuits using Decoder, Introduction of Sequential Circuits


Combinational circuits are defined as the time independent circuits which do not depends upon previous
inputs to generate any output are termed as combinational circuits. Sequential circuits are those which
are dependent on clock cycles and depends on present as well as past inputs to generate any output.
Combinational Circuit –
1. In this output depends only upon present input.
2. Speed is fast.
3. It is designed easy.
4. There is no feedback between input and output.
5. This is time independent.
6. Elementary building blocks: Logic gates
7. Used for arithmetic as well as boolean operations.
8. Combinational circuits don’t have capability to store any state.
9. As combinational circuits don’t have clock, they don’t require triggering.
10. These circuits do not have any memory element.
11. It is easy to use and handle.
Examples – Encoder, Decoder, Multiplexer, Demultiplexer
Block Diagram –

Sequential Circuit –
1. In this output depends upon present as well as past input.
2. Speed is slow.
3. It is designed tough as compared to combinational circuits.
4. There exists a feedback path between input and output.
5. This is time dependent.
6. Elementary building blocks: Flip-flops
7. Mainly used for storing data.
8. Sequential circuits have capability to store any state or to retain earlier state.
9. As sequential circuits are clock dependent they need triggering.
10. These circuits have memory element.
11. It is not easy to use and handle.
Examples – Flip-flops, Counters
Block Diagram –

3.Explain the role of real time clock in embedded systems with suitable diagram

RTCs must accurately keep time, even when the device is powered off because, it is often used as a
trigger for turning the device on or triggering events such as alarm clocks. RTC ICs run on an
alternate power source, which allows it to continually operate under low power or even when the
computer is turned off. ICs on older systems utilize lithium batteries, whereas newer systems make
use of auxiliary batteries or supercapacitors. RTC ICs that use supercapacitors are rechargeable and
can be soldered. But in most consumer-grade motherboards, the RTC is powered by a single battery
that, when removed, resets the RTC to its starting point.
RTC ICs regulate time with the use of a crystal oscillator and do not rely on clock signals like most
hardware clocks. Aside from being responsible for the timing function of the system and its clock,
RTC ICs ensure that all processes occurring in the system are appropriately synchronized. Although
some may argue that this is a job for the system clock, the system clock is actually dependent on the
RTC, making the RTC indirectly responsible for synchronization.
An RTC battery should last for three to five years or more. RTCs are essential; if the battery fails, it
must be replaced to ensure continued operation. A dead battery can be diagnosed with an error
message at startup or if the user finds that the clock or the setup configuration has become corrupted,
flaky or odd.
Benefits of RTCs include:

• RTC ICs have proved to be more precise than other methods — like programming the timer
of the controller.
• It frees the main system from time-critical tasks.
• It has low power consumption and improved frequency stability.

UNIT-3

LEVEL-1

1.Explain different embedded firmware design approaches in details


Embedded firmware is the flash memory chip that stores specialized software running in a chip in
an embedded device to control its functions.

Firmware in embedded systems fills the same purpose as a ROM but can be updated more easily for
better adaptability to conditions or interconnecting with additional equipment.

Hardware makers use embedded firmware to control the functions of various hardware devices and
systems much like a computer’s operating system controls the function of software applications.
Embedded firmware exists in everything from appliances so simple you might not imagine they had
computer control, like toasters, to complex tracking systems in missiles. The toaster would likely never
need updating but the tracking system sometimes does. As the complexity of a device increases, it often
makes sense to use firmware in case of design errors that an update might correct.

Embedded firmware is used to control the limited, set functions of hardware devices and systems of
greater complexity but still gives more appliance-like usage instead of a series of terminal commands.
Embedded firmware functions are activated by external controls or external actions of the hardware.
Embedded firmware and ROM-based embedded softwareoften have communication links to other
devices for functionality or to address the need for the device to be adjusted, calibrated or diagnosed or
to output log files. It is also through these connections that someone might attempt embedded device
hacking.

Embedded software varies in complexity as much the devices it is used to control. Although embedded
software and embedded firmware are sometimes used synonymously, they are not exactly the same
thing. For example, embedded software may run on ROM chips. Also, embedded software is often the
only computer code running on a piece of hardware while firmware can also refer to the chip that houses
a computer’s EFI or BIOS, which hands over control to an OS that in turn launches and controls
programs.

2.explain mixing assembly and high level language for embedded firmware development

High Level language and low level language can be mixed in three different ways

• Mixing Assembly Language with High level language like ‘C’


• Mixing High level language like ‘C’ with Assembly Language
• In line Assembly
1. Mixing Assembly Language with High level language like ‘C’ :: Suppose You want to add
some delay which is close to few CPU clock ticks. But it is not possible to implement that
exact delay using High level language like ‘C’. because it’s depends on compiler. so in this
case you have to write a required delay code in assembly, and then mix it with High level
Language. This is known as “ Mixing Assembly Language with High level language”
Where your whole code is in High level language and some part is in Assembly.
2. Mixing High level language like ‘C’ with Assembly Language :: Suppose you are using
Assembly language for embedded firmware development. Here you need to add an
instruction of “Multiplication” (a=b*c). so your instruction is
1. mult $t0, $t1
2. mflo $s0
which is time consuming(for more complex and long calculation like a=b*c/(d-e+(f^g))) , so here you
can mix High level language and write a complex long calculation in one line only. This is Known as
“Mixing High level language like ‘C’ with Assembly Language”. Where your Whole code is in
Assembly language and some lines are in High Level Language.
3.what is ISR?discuss about the different types of ISR.

Stands for "Interrupt Service Routine." An ISR (also called an interrupt handler) is a softwareprocess
invoked by an interrupt request from a hardware device. It handles the request and sends it to the CPU,
interrupting the active process. When the ISR is complete, the process is resumed.

A basic example of an ISR is a routine that handles keyboard events, such as pressing or releasing a
key. Each time a key is pressed, the the ISR processes the input. For example, if you press and hold the
right arrow key in a text file, the ISR will signal to the CPU that the right arrow key is depressed. The
CPU sends this information to the active word processor or text editing program, which will move
the cursor to the right. When you let go of the key, the ISR handles the "key up" event. This interrupts
the previous "key down" state, which signals to the program to stop moving the cursor.

Similar to Newton's law of inertia (an object in motion tends to stay in motion), computer processes
continue to run unless interrupted. Without an interrupt request, a computer will remain in its current
state. Each input signal causes an interrupt, forcing the CPU to process the corresponding event.

Many types of hardware devices, including internal components and external peripherals can sent
interrupts to the CPU. Examples include keyboards, mice, sound cards, and hard drives. A device
driver enables communication between each of these devices and the CPU. ISRs prioritize interrupt
requests based on the IRQ setting of the device (or port). Typically the keyboard is at the top of the IRQ
list, while devices like hard drives are further down.

LEVEL-2

1.Disuss the assembly language based development in embedded firmware design

An assembly language program is a series of statements, which are either assembly language
instructions such as ADD and MOV, or statements called directives.

An instruction tells the CPU what to do, while a directive (also called pseudo-instructions) gives
instruction to the assembler. For example, ADD and MOV instructions are commands which the
CPU runs, while ORG and END are assembler directives. The assembler places the opcode to the
memory location 0 when the ORG directive is used, while END indicates to the end of the source
code. A program language instruction consists of the following four fields −

[ label: ] mnemonics [ operands ] [;comment ]


A square bracket ( [ ] ) indicates that the field is optional.

• The label field allows the program to refer to a line of code by name. The label fields cannot
exceed a certain number of characters.

• The mnemonics and operands fields together perform the real work of the program and
accomplish the tasks. Statements like ADD A , C & MOV C, #68 where ADD and MOV are
the mnemonics, which produce opcodes ; "A, C" and "C, #68" are operands. These two
fields could contain directives. Directives do not generate machine code and are used only
by the assembler, whereas instructions are translated into machine code for the CPU to
execute.

1.0000 ORG 0H ;start (origin) at location 0


2 0000 7D25 MOV R5,#25H ;load 25H into R5
3.0002 7F34 MOV R7,#34H ;load 34H into R7
4.0004 7400 MOV A,#0 ;load 0 into A
5.0006 2D ADD A,R5 ;add contents of R5 to A
6.0007 2F ADD A,R7 ;add contents of R7 to A
7.0008 2412 ADD A,#12H ;add to A value 12 H
8.000A 80FE HERE: SJMP HERE ;stay in this loop
9.000C END ;end of asm source file
• The comment field begins with a semicolon which is a comment indicator.

• Notice the Label "HERE" in the program. Any label which refers to an instruction should be
followed by a colon.

• First, we use an editor to type in a program similar to the above program. Editors like MS-
DOS EDIT program that comes with all Microsoft operating systems can be used to create or
edit a program. The Editor must be able to produce an ASCII file. The "asm" extension for
the source file is used by an assembler in the next step.

• The "asm" source file contains the program code created in Step 1. It is fed to an 8051
assembler. The assembler then converts the assembly language instructions into machine
code instructions and produces an .obj file (object file) and a .lst file (list file). It is also
called as a source file, that's why some assemblers require that this file have the "src"
extensions. The "lst" file is optional. It is very useful to the program because it lists all the
opcodes and addresses as well as errors that the assemblers detected.

• Assemblers require a third step called linking. The link program takes one or more object
files and produces an absolute object file with the extension "abs".

• Next, the "abs" file is fed to a program called "OH" (object to hex converter), which creates a
file with the extension "hex" that is ready to burn in to the ROM.

2.Disuss the ISR concept and multiple interrupts

An interrupt is a signal to the processor emitted by hardware or software indicating an event that
needs immediate attention. Whenever an interrupt occurs, the controller completes the execution of
the current instruction and starts the execution of an Interrupt Service Routine (ISR) or Interrupt
Handler. ISR tells the processor or controller what to do when the interrupt occurs. The interrupts
can be either hardware interrupts or software interrupts.

Hardware Interrupt

A hardware interrupt is an electronic alerting signal sent to the processor from an external device, like
a disk controller or an external peripheral. For example, when we press a key on the keyboard or
move the mouse, they trigger hardware interrupts which cause the processor to read the keystroke or
mouse position.

Software Interrupt

A software interrupt is caused either by an exceptional condition or a special instruction in the


instruction set which causes an interrupt when it is executed by the processor. For example, if the
processor's arithmetic logic unit runs a command to divide a number by zero, to cause a divide-by-
zero exception, thus causing the computer to abandon the calculation or display an error message.
Software interrupt instructions work similar to subroutine calls.

What is Polling?

The state of continuous monitoring is known as polling. The microcontroller keeps checking the
status of other devices; and while doing so, it does no other operation and consumes all its processing
time for monitoring. This problem can be addressed by using interrupts.

In the interrupt method, the controller responds only when an interruption occurs. Thus, the controller
is not required to regularly monitor the status (flags, signals etc.) of interfaced and inbuilt devices.

Interrupts v/s Polling

Here is an analogy that differentiates an interrupt from polling −

Interrupt Polling

An interrupt is like a shopkeeper. If The polling method is like a salesperson.


one needs a service or product, he The salesman goes from door to door while
goes to him and apprises him of his requesting to buy a product or service.
needs. In case of interrupts, when the Similarly, the controller keeps monitoring
flags or signals are received, they the flags or signals one by one for all
notify the controller that they need to devices and provides service to whichever
be serviced. component that needs its service.

Interrupt Service Routine

For every interrupt, there must be an interrupt service routine (ISR), or interrupt handler. When an
interrupt occurs, the microcontroller runs the interrupt service routine. For every interrupt, there is a
fixed location in memory that holds the address of its interrupt service routine, ISR. The table of
memory locations set aside to hold the addresses of ISRs is called as the Interrupt Vector Table.

LEVEL-3

1.What are pseudo-ops?what is the use of it in assembly language programming

assembly language (or assembler language), often abbreviated asm, is any low-level programming
language in which there is a very strong correspondence between the program's statements and
the architecture's machine code instructions.

Assembly code is converted into executable machine code by a utility program referred to as
an assembler. The conversion process is referred to as assembly, or assembling the source code.
Assembly language usually has one statement per machine instruction, but comments and statements
that are assembler directives, macros, and symbolic labels of program and memory locations are often
also supported.

Each assembly language is specific to a particular computer architecture and sometimes to an operating
system. However, some assembly languages do not provide specific syntax for operating system calls,
and most assembly languages can be used universally with any operating system, as the language
provides access to all the real capabilities of the processor, upon which all system call mechanisms
ultimately rest. In contrast to assembly languages, most high-level programming languages are
generally portable across multiple architectures but require interpreting or compiling.
2.Tabulate the concept of compiler and cross compiler relevant to an embedded firmware

3.Explain the advantages and disadvantages of assembly language based embedded firmware
development

Advantages And Disadvantages Of Assembly Language

Let’s discuss few advantages and disadvantages of a level 3 i.e. assembly language.

Advantages Of Assembly Language

1. Programs written in machine language are replaceable by mnemonics which are easier to
remember.
2. Memory Efficient.
3. It is not required to keep track of memory locations.
4. Faster in speed.
5. Easy to make insertions and deletions.
6. Hardware Oriented.
7. Requires fewer instructions to accomplish the same result.

Disadvantages Of Assembly Language

1. Long programs written in such languages cannot be executed on small sized computers.
2. It takes lot of time to code or write the program, as it is more complex in nature.
3. Difficult to remember the syntax.
4. Lack of portability of program between computers of different makes.
5. No SDKs (System Development Kit).

UNIT-4

Level-1

1.what are the functional and non functional requirements to choose an RTOS

Functional: Describes the explicit operations to be performed by the RTOS.

If you consider the climate control system in an automobile:

 Sense temperature: T1

 Compare with user set temperature: Tset

 If T1 > Tset, start cold air fan

Else if T1 < Tset,

start hot air fan Non-functional: describes the quality of the operations

 Example: Need to control temperature within 0.5 degree error

 Accuracy

 Precision

 Reliability

 Safety

 Response time

 Responsiveness

 Predictability

 Deadlines

1.b)What is multitasking? Explain types of multitasking

Two Types of Multitasking OS


1) Pre-Emptive Multitasking OS: In this OS, the process gets preempted after time quantum.
2) Co-operative Multitasking OS: It is also known as Non-Preemptive OS. In this OS, processes are
preemptive after a fixed interval of time. The process can voluntarily control CPU or when CPU idle
enables multiple applications to be run concurrently. In Cooperative Multitasking OS, all programs
cooperate for the entire scheduling scheme to work. In this OS Process Scheduler of an operating system
is known as a cooperative scheduler.
Memory Protection: To protect the memory, so that process’s memory location can’t be modified by
another process Memory Management Unit hardware device used. MMU helps the kernel to take the
appropriate action regarding memory allocation and de-allocation request.
Difference between Multitasking and Multiprogramming Operating System

Multitasking OS Multiprogramming OS
The program divided into the fixed size of pages. The whole program loaded into memory.
Context switching takes place after a fixed interval of
Not fixed time of interval consider.
time.

The concept used in an old computer


The concept used in modern computing.
system.

2.Explain task scheduling including its scheduling algorithm

Scheduling Algorithms: 1. First come First Serve: FCFS is the simplest non-preemptive algorithm.
Processes are assigned the CPU in the order they request it. That is the process that requests the CPU
first is allocated the CPU first. The implementation of FCFS is policy is managed with a FIFO(First in
first out) queue. When the first job enters the system from the outside in the morning, it is started
immediately and allowed to run as long as it wants to. As other jobs come in, they are put onto the end
of the queue. When the running process blocks, the first process on the queue is run next. When a
blocked process becomes ready, like a newly arrived job, it is put on the end of the queue. Advantages:
1.Easy to understand and program. With this algorithm a single linked list keeps track of all ready
processes.

2.Equally fair.,

3.Suitable specially for Batch Operating system.

Disadvantages: 1.FCFS is not suitable for time-sharing systems where it is important that each user
should get the CPU for an equal amount of arrival time. Consider the following set of processes having
their burst time mentioned in milliseconds

. CPU burst time indicates that for how much time, the process needs the cpu. Process Burst Time P1
24 P2 3 P3 3 Calculate the average waiting time if the processes arrive in the order of: a). P1, P2, P3
b). P2, P3, P1 a. The processes arrive the order P1, P2, P3. Let us assume they arrive in the same time
at 0 ms in the system. We get the following gantt chart. Waiting time for P1= 0ms , for P2 = 24 ms for
P3 = 27ms Avg waiting time: (0+24+27)/3= 17 b. ) If the process arrive in the order P2,P3, P1 Average
waiting time: (0+3+6)/3=3. Average waiting time vary substantially if the process CPU burst time vary
greatly. 2. Shortest Job First: When several equally important jobs are sitting in the i/p queue waiting
to be started, the scheduler picks the shortest jobs first. A B C D Original order: (Turn Around time)
Here we have four jobs A,B,C ,D with run times of 8 , 4, 4 and 4 minutes respectively. By running them
in that order the turnaround time for A is 8 minutes, for B 12 minutes, for C 16 minutes and for D 20
minutes for an average of 14 minutes. Now let us consider running these jobs in the shortest Job First.
B C D and then A. the turnaround times are now , 4, 8, 12 and 20 minutes giving the average of 11.
Shortest job first is probably optimal. P1 P2 P3 0 24 27 30 0 3 P2 P3 P1 6 30 8 4 4 4 Consider the four
jobs with run times of a, b,c,d. The first job finished at a, the second at a+b and so on. So the mean
turnaround time is (4a+3b+2c+d)/4. It is clear that the a contributes more to the average than any other.
So it should be the shortest one. The disadvantages of this algorithm is the problem to know the length
of time for which CPU is needed by a process. The SJF is optimal when all the jobs are available
simultaneously. The SJF is either preemptive or non preemptive. Preemptive SJF scheduling is
sometimes called Shortest Remaining Time First scheduling. With this scheduling algorithms the
scheduler always chooses the process whose remaining run time is shortest. When a new job arrives its
total time is compared to the current process remaining time. If the new job needs less time to finish
than the current process, the current process is suspended and the new job is started. This scheme allows
new short jobs to get good service. Q). Calculate the average waiting time in 1). Preemptive SJF and
2). Non Preemptive SJF Note: SJF Default: (Non Preemptive) Process Arrival Time Burst Time P1 0 8
P2 1 4 P3 2 9 P4 3 5 a. Preemptive SJF ( Shortest Remaining Time First): At t=0ms only one process
P1 is in the system, whose burst time is 8ms; starts its execution. After 1ms i.e., at t=1, new process P2
(Burst time= 4ms) arrives in the ready queue. Since its burst time is less than the remaining burst time
of P1 (7ms) P1 is preempted and execution of P2 is started. Again at t=2, a new process P3 arrive in the
ready queue but its burst time (9ms) is larger than remaining burst time of currently running process
(P2 3ms). So P2 is not preempted and continues its execution. Again at t=3 , new process P4 (burst time
5ms ) arrives . Again for same reason P2 is not preempted until its execution is completed. Page:73
Compiled by: daya Waiting time of P1: 0ms + (10 – 1)ms = 9ms Waiting time of P2: 1ms – 1ms = 0ms
Waiting time of P3: 17ms – 2ms = 15ms Waiting time of P4: 5ms – 3ms = 2ms Avg waiting time:
(9+0+15+2)/4 = 6.5ms Non-preemptive SJF: Since its non-preemptive process is not preempted until it
finish its execution. Waiting time for P1: 0ms Waiting time for P2: (8-1)ms = 7ms Waiting time for P3:
(17 – 2) ms = 15ms Waiting time for P4: (12 – 3)ms = 9ms Average waiting time: (0+7+15+9)/4 =
7.75ms 3. Round-Robin Scheduling Algorithms: •One of the oldest, simplest, fairest and most widely
used algorithm is round robin (RR). •In the round robin scheduling, processes are dispatched in a FIFO
manner but are given a limited amount of CPU time called a time-slice or a quantum. •If a process does
not complete before its CPU-time expires, the CPU is preempted and given to the next process waiting
in a queue. The preempted process is then placed at the back of the ready list. •If the the process has
blocked or finished before the quantum has elapsed the CPU switching is done. •Round Robin
Scheduling is preemptive (at the end of time-slice) therefore it is effective in timesharing environments
in which the system needs to guarantee reasonable response times for interactive users. •The only
interesting issue with round robin scheme is the length of the quantum. Setting the quantum too short
causes too many context switches and lower the CPU efficiency. On the other hand, setting the quantum
too long may cause poor response time and approximates FCFS. •In any event, the average waiting time
under round robin scheduling is on quite long. Consider the following set of processes that arrives at
time 0 ms. Process Burst Time P1 20 P2 3 P3 4 If we use time quantum of 4ms then calculate the
average waiting time using R-R scheduling. According to R-R scheduling processes are executed in
FCFS order. So, firstly P1(burst time=20ms) is executed but after 4ms it is preempted and new process
P2 (Burst time = 3ms) starts its execution whose execution is completed before the time quantum. Then
next process P3 (Burst time=4ms) starts its execution and finally remaining part of P1 gets executed
with time quantum of 4ms. Waiting time of Process P1: 0ms + (11 – 4)ms = 7ms Waiting time of
Process P2: 4ms Waiting time of Process P3: 7ms Average Waiting time: (7+4+7)/3=6ms 4. Priority
Scheduling:

3.what is device driver?explan its role in the OS context


A device driver is a software program that controls a particular type of hardware device that is attached
to a computer. When buying an operating system, many device drivers are built into the product.
However, if a user later buys a new type of device that the operating system did not anticipate, the new
device driver will have to be installed. A device driver essentially allows smooth communication
between a connected hardware device and the operating system (OS).

Hardware that uses a device driver to connect to a computer include printers, displays, CD-
ROMreaders, network or sound cards, computer mice or hard disks. Device drivers will instruct a
computer on how to communicate with each input/output (I/O) device through translating the operating
system's I/O instructions to a software language the hardware device understands.

Types of device drivers

Device drivers can generally be categorized as kernel device drivers or user device drivers. Kernel
device drivers load with the OS as part of the system's memory. This is done so the device driver can
be activated as soon as it is needed. However, kernel device drivers are loaded into the systems RAM,
meaning there can only be a limited amount of device drivers running at one time before system
performance begins to be impacted.

User mode device drivers provide a dedicated API at a user level to interrupt memory management,
avoiding the problems found in kernel device drivers. User mode device drivers are triggered by the
end-user. If there is an error, this type of driver can restart without affecting the rest of the system and
is useful for USB devices.

Some Windows programs are virtual device drivers that interface with the Windows Virtual Machine
Manager. There is a virtual device driver for each main hardware device in the system, including the
serial and parallel ports, hard disk drive controller and keyboard. They are used to maintain the status
of a hardware device that has changeable settings and to emulate a hardware device in virtualization
environments. Virtual device drivers handle software interrupts from the system rather than hardware
interrupts.

In Windows operating systems, a device driver file usually has a file name suffix of DLL or EXE. A
virtual device driver usually has the suffix of VXD

LEVEL-2
1.Explain about multiprocessing and multitasking of real time operating systems

Operating System | Difference between multitasking, multithreading and multiprocessing

1. Multiprogramming – A computer running more than one program at a time (like running
Excel and Firefox simultaneously).
2. Multiprocessing – A computer using more than one CPU at a time.
3. Multitasking – Tasks sharing a common resource (like 1 CPU).
4. Multithreading is an extension of multitasking.

1. Multi programming –

In a modern computing system, there are usually several concurrent application processes which want
to execute. Now it is the responsibility of the Operating System to manage all the processes effectively
and efficiently.
One of the most important aspects of an Operating System is to multi program.
In a computer system, there are multiple processes waiting to be executed, i.e. they are waiting when
the CPU will be allocated to them and they begin their execution. These processes are also known as
jobs. Now the main memory is too small to accommodate all of these processes or jobs into it. Thus,
these processes are initially kept in an area called job pool. This job pool consists of all those processes
awaiting allocation of main memory and CPU.
CPU selects one job out of all these waiting jobs, brings it from the job pool to main memory and starts
executing it. The processor executes one job until it is interrupted by some external factor or it goes for
an I/O task.

Non-multi programmed system’s working –

• In a non multi programmed system, As soon as one job leaves the CPU and goes for some other
task (say I/O ), the CPU becomes idle. The CPU keeps waiting and waiting until this job (which
was executing earlier) comes back and resumes its execution with the CPU. So CPU remains
free for all this while.
• Now it has a drawback that the CPU remains idle for a very long period of time. Also, other
jobs which are waiting to be executed might not get a chance to execute because the CPU is
still allocated to the earlier job.
This poses a very serious problem that even though other jobs are ready to execute, CPU is not
allocated to them as the CPU is allocated to a job which is not even utilizing it (as it is busy in
I/O tasks).
• It cannot happen that one job is using the CPU for say 1 hour while the others have been waiting
in the queue for 5 hours. To avoid situations like this and come up with efficient utilization of
CPU, the concept of multi programming came up.

The main idea of multi programming is to maximize the CPU time.


Multi programmed system’s working –

• In a multi-programmed system, as soon as one job goes for an I/O task, the Operating System
interrupts that job, chooses another job from the job pool (waiting queue), gives CPU to this
new job and starts its execution. The previous job keeps doing its I/O operation while this new
job does CPU bound tasks. Now say the second job also goes for an I/O task, the CPU chooses
a third job and starts executing it. As soon as a job completes its I/O operation and comes back
for CPU tasks, the CPU is allocated to it.
• In this way, no CPU time is wasted by the system waiting for the I/O task to be completed.
Therefore, the ultimate goal of multi programming is to keep the CPU busy as long as there are
processes ready to execute. This way, multiple programs can be executed on a single processor
by executing a part of a program at one time, a part of another program after this, then a part of
another program and so on, hence executing multiple programs. Hence, the CPU never remains
idle.

In the image below, program A runs for some time and then goes to waiting state. In the mean time
program B begins its execution. So the CPU does not waste its resources and gives program B an
opportunity to run.
2. Multiprocessing –

In a uni-processor system, only one process executes at a time.


Multiprocessing is the use of two or more CPUs (processors) within a single Computer system. The
term also refers to the ability of a system to support more than one processor within a single computer
system. Now since there are multiple processors available, multiple processes can be executed at a time.
These multi processors share the computer bus, sometimes the clock, memory and peripheral devices
also.

Multi processing system’s working –


• With the help of multiprocessing, many processes can be executed simultaneously. Say
processes P1, P2, P3 and P4 are waiting for execution. Now in a single processor system, firstly
one process will execute, then the other, then the other and so on.
• But with multiprocessing, each process can be assigned to a different processor for its
execution. If its a dual-core processor (2 processors), two processes can be executed
simultaneously and thus will be two times faster, similarly a quad core processor will be four
times as fast as a single processor.

Why use multi processing –

• The main advantage of multiprocessor system is to get more work done in a shorter period of
time. These types of systems are used when very high speed is required to process a large
volume of data. Multi processing systems can save money in comparison to single processor
systems because the processors can share peripherals and power supplies.
• It also provides increased reliability in the sense that if one processor fails, the work does not
halt, it only slows down. e.g. if we have 10 processors and 1 fails, then the work does not halt,
rather the remaining 9 processors can share the work of the 10th processor. Thus the whole
system runs only 10 percent slower, rather than failing altogether.

2.Explain non-preemptive scheduling

on-preemptive Scheduling is one which can be applied in the circumstances when a process terminates,
or a process switches from running to waiting state. In Non-Preemptive Scheduling, once the
resources (CPU) is allocated to a process, the process holds the CPU till it gets terminated or it reaches
a waiting state.

Unlike preemptive scheduling, non-preemptive scheduling does not interrupt a process running CPU in
middle of the execution. Instead, it waits for the process to complete its CPU burst time and then it can
allocate the CPU to another process.

In Non-preemptive scheduling, if a process with long CPU burst time is executing then the other process
will have to wait for a long time which increases the average waiting time of the processes in the ready
queue. However, the non-preemptive scheduling does not have any overhead of switching the processes
from ready queue to CPU but it makes the scheduling rigid as the process in execution is not even
preempted for a process with higher priority. Let us solve the
above scheduling example in non-preemptive fashion. As initially the process P2 arrives at time 0, so
CPU is allocated to the process P2 it takes 6 milliseconds to execute. In between all the processes i.e.
P0, P1, P3 arrives into ready queue. But all waits till process P2 completes its CPU burst time. Then
process that arrives after P2 i.e. P3 is then allocated the CPU till it finishes it’s burst time. Similarly,
then P1 executes, and CPU is later given to process P0.

Key Differences Between Preemptive and Non-Preemptive Scheduling

1. The basic difference between preemptive and non-preemptive scheduling is that in preemptive
scheduling the CPU is allocated to the processes for the limited time. While in Non-preemptive
scheduling, the CPU is allocated to the process till it terminates or switches to waiting state.
2. The executing process in preemptive scheduling is interrupted in the middle of execution
whereas, the executing process in non-preemptive scheduling is not interrupted in the middle
of execution.
3. Preemptive Scheduling has the overhead of switching the process from ready state to running
state, vise-verse, and maintaining the ready queue. On the other hands, non-preemptive
scheduling has no overhead of switching the process from running state to ready state.
4. In preemptive scheduling, if a process with high priority frequently arrives in the ready queue
then the process with low priority have to wait for a long, and it may have to starve. On the
other hands, in the non-preemptive scheduling, if CPU is allocated to the process with larger
burst time then the processes with small burst time may have to starve.
5. Preemptive scheduling is quite flexible because the critical processes are allowed to access
CPU as they arrive into the ready queue, no matter what process is executing currently. Non-
preemptive scheduling is rigid as even if a critical process enters the ready queue the process
running CPU is not disturbed.
6. The Preemptive Scheduling is cost associative as it has to maintain the integrity of shared data
which is not the case with Non-preemptive Scheduling.

Multiprocessing refers to the hardware (i.e., the CPU units) rather than the software (i.e., running
processes). If the underlying hardware provides more than one processor then that is multiprocessing.
It is the ability of the system to leverage multiple processors’ computing power.
Difference between Multi programming and Multi processing –

• A System can be both multi programmed by having multiple programs running at the same
time and multiprocessing by having more than one physical processor. The difference between
multiprocessing and multi programming is that Multiprocessing is basically executing multiple
processes at the same time on multiple processors, whereas multi programming is keeping
several programs in main memory and executing them concurrently using a single CPU only.
• Multiprocessing occurs by means of parallel processing whereas Multi programming occurs by
switching from one process to other (phenomenon called as context switching).

3. Multitasking –

As the name itself suggests, multi tasking refers to execution of multiple tasks (say processes, programs,
threads etc.) at a time. In the modern operating systems, we are able to play MP3 music, edit documents
in Microsoft Word, surf the Google Chrome all simultaneously, this is accomplished by means of multi
tasking.

Multitasking is a logical extension of multi programming. The major way in which multitasking differs
from multi programming is that multi programming works solely on the concept of context switching
whereas multitasking is based on time sharing alongside the concept of context switching.

Multi tasking system’s working –

• In a time sharing system, each process is assigned some specific quantum of time for which a
process is meant to execute. Say there are 4 processes P1, P2, P3, P4 ready to execute. So each
of them are assigned some time quantum for which they will execute e.g time quantum of 5
nanoseconds (5 ns). As one process begins execution (say P2), it executes for that quantum of
time (5 ns). After 5 ns the CPU starts the execution of the other process (say P3) for the specified
quantum of time.
• Thus the CPU makes the processes to share time slices between them and execute accordingly.
As soon as time quantum of one process expires, another process begins its execution.
• Here also basically a context switch is occurring but it is occurring so fast that the user is able
to interact with each program separately while it is running. This way, the user is given the
illusion that multiple processes/ tasks are executing simultaneously. But actually only one
process/ task is executing at a particular instant of time. In multitasking, time sharing is best
manifested because each running process takes only a fair quantum of the CPU time.
In a more general sense, multitasking refers to having multiple programs, processes, tasks, threads
running at the same time. This term is used in modern operating systems when multiple tasks share a
common processing resource (e.g., CPU and Memory).

• As depicted in the above image, At any time the CPU is executing only one task while other
tasks are waiting for their turn. The illusion of parallelism is achieved when the CPU is
reassigned to another task. i.e all the three tasks A, B and C are appearing to occur
simultaneously because of time sharing.
• So for multitasking to take place, firstly there should be multiprogramming i.e. presence of
multiple programs ready for execution. And secondly the concept of time sharing.

4. Multi threading –
A thread is a basic unit of CPU utilization. Multi threading is an execution model that allows a single
process to have multiple code segments (i.e., threads) running concurrently within the “context” of that
process.
e.g. VLC media player, where one thread is used for opening the VLC media player, one thread for
playing a particular song and another thread for adding new songs to the playlist.

Multi threading is the ability of a process to manage its use by more than one user at a time and to
manage multiple requests by the same user without having to have multiple copies of the program.

Multi threading system’s working –

Example 1 –

• Say there is a web server which processes client requests. Now if it executes as a single threaded
process, then it will not be able to process multiple requests at a time. Firstly one client will
make its request and finish its execution and only then, the server will be able to process another
client request. This is really costly, time consuming and tiring task. To avoid this, multi
threading can be made use of.
• Now, whenever a new client request comes in, the web server simply creates a new thread for
processing this request and resumes its execution to hear more client requests. So the web server
has the task of listening to new client requests and creating threads for each individual request.
Each newly created thread processes one client request, thus reducing the burden on web server.

Example 2 –

• We can think of threads as child processes that share the parent process resources but execute
independently. Now take the case of a GUI. Say we are performing a calculation on the GUI
(which is taking very long time to finish). Now we can not interact with the rest of the GUI
until this command finishes its execution. To be able to interact with the rest of the GUI, this
command of calculation should be assigned to a separate thread. So at this point of time, 2
threads will be executing i.e. one for calculation, and one for the rest of the GUI. Hence here in
a single process, we used multiple threads for multiple functionality.

The image below completely describes the VLC player example:


Advantages of Multi threading –

• Benefits of Multi threading include increased responsiveness. Since there are multiple threads
in a program, so if one thread is taking too long to execute or if it gets blocked, the rest of the
threads keep executing without any problem. Thus the whole program remains responsive to
the user by means of remaining threads.
• Another advantage of multi threading is that it is less costly. Creating brand new processes and
allocating resources is a time consuming task, but since threads share resources of the parent
process, creating threads and switching between them is comparatively easy. Hence multi
threading is the need of modern Operating Systems.

3.Discuss about multiprocessing and multitasking

2. Multiprocessing –
In a uni-processor system, only one process executes at a time.
Multiprocessing is the use of two or more CPUs (processors) within a single Computer system. The
term also refers to the ability of a system to support more than one processor within a single computer
system. Now since there are multiple processors available, multiple processes can be executed at a time.
These multi processors share the computer bus, sometimes the clock, memory and peripheral devices
also.

Multi processing system’s working –

• With the help of multiprocessing, many processes can be executed simultaneously. Say
processes P1, P2, P3 and P4 are waiting for execution. Now in a single processor system, firstly
one process will execute, then the other, then the other and so on.
• But with multiprocessing, each process can be assigned to a different processor for its
execution. If its a dual-core processor (2 processors), two processes can be executed
simultaneously and thus will be two times faster, similarly a quad core processor will be four
times as fast as a single processor.

3. Multitasking –

As the name itself suggests, multi tasking refers to execution of multiple tasks (say processes, programs,
threads etc.) at a time. In the modern operating systems, we are able to play MP3 music, edit documents
in Microsoft Word, surf the Google Chrome all simultaneously, this is accomplished by means of multi
tasking.

Multitasking is a logical extension of multi programming. The major way in which multitasking differs
from multi programming is that multi programming works solely on the concept of context switching
whereas multitasking is based on time sharing alongside the concept of context switching.

Multi tasking system’s working –

• In a time sharing system, each process is assigned some specific quantum of time for which a
process is meant to execute. Say there are 4 processes P1, P2, P3, P4 ready to execute. So each
of them are assigned some time quantum for which they will execute e.g time quantum of 5
nanoseconds (5 ns). As one process begins execution (say P2), it executes for that quantum of
time (5 ns). After 5 ns the CPU starts the execution of the other process (say P3) for the specified
quantum of time.
• Thus the CPU makes the processes to share time slices between them and execute accordingly.
As soon as time quantum of one process expires, another process begins its execution.
• Here also basically a context switch is occurring but it is occurring so fast that the user is able
to interact with each program separately while it is running. This way, the user is given the
illusion that multiple processes/ tasks are executing simultaneously. But actually only one
process/ task is executing at a particular instant of time. In multitasking, time sharing is best
manifested because each running process takes only a fair quantum of the CPU time.

In a more general sense, multitasking refers to having multiple programs, processes, tasks, threads
running at the same time. This term is used in modern operating systems when multiple tasks share a
common processing resource (e.g., CPU and Memory).

LEVEL-3

1.What is RTOS?what are different types of operating systems

Operating System | Types of Operating Systems

An Operating System performs all the basic tasks like managing file,process, and memory. Thus
operating system acts as manager of all the resources, i.e. resource manager. Thus operating system
becomes an interface between user and machine.

Types of Operating Systems: Some of the widely used operating systems are as follows-

1. Batch Operating System –


This type of operating system does not interact with the computer directly. There is an operator which
takes similar jobs having same requirement and group them into batches. It is the responsibility of
operator to sort the jobs with similar needs.
Advantages of Batch Operating System:

• It is very difficult to guess or know the time required by any job to complete. Processors of
the batch systems know how long the job would be when it is in queue
• Multiple users can share the batch systems
• The idle time for batch system is very less
• It is easy to manage large work repeatedly in batch systems

Disadvantages of Batch Operating System:

• The computer operators should be well known with batch systems


• Batch systems are hard to debug
• It is sometime costly
• The other jobs will have to wait for an unknown time if any job fails

Examples of Batch based Operating System: Payroll System, Bank Statements etc.

2. Time-Sharing Operating Systems –


Each task is given some time to execute, so that all the tasks work smoothly. Each user gets time of
CPU as they use single system. These systems are also known as Multitasking Systems. The task can
be from single user or from different users also. The time that each task gets to execute is called
quantum. After this time interval is over OS switches over to next task.
Advantages of Time-Sharing OS:

• Each task gets an equal opportunity


• Less chances of duplication of software
• CPU idle time can be reduced

Disadvantages of Time-Sharing OS:

• Reliability problem
• One must have to take care of security and integrity of user programs and data
• Data communication problem

Examples of Time-Sharing OSs are: Multics, Unix etc.

3. Distributed Operating System –


These types of operating system is a recent advancement in the world of computer technology and are
being widely accepted all-over the world and, that too, with a great pace. Various autonomous
interconnected computers communicate each other using a shared communication network.
Independent systems possess their own memory unit and CPU. These are referred as loosely coupled
systems or distributed systems. These system’s processors differ in size and function. The major
benefit of working with these types of operating system is that it is always possible that one user can
access the files or software which are not actually present on his system but on some other system
connected within this network i.e., remote access is enabled within the devices connected in that
network.

Advantages of Distributed Operating System:

• Failure of one will not affect the other network communication, as all systems are
independent from each other
• Electronic mail increases the data exchange speed
• Since resources are being shared, computation is highly fast and durable
• Load on host computer reduces
• These systems are easily scalable as many systems can be easily added to the network
• Delay in data processing reduces

Disadvantages of Distributed Operating System:


• Failure of the main network will stop the entire communication
• To establish distributed systems the language which are used are not well defined yet
• These types of systems are not readily available as they are very expensive. Not only that the
underlying software is highly complex and not understood well yet

Examples of Distributed Operating System are- LOCUS etc.

4.Network Operating System –


These systems run on a server and provide the capability to manage data, users, groups, security,
applications, and other networking functions. These type of operating systems allow shared access of
files, printers, security, applications, and other networking functions over a small private network.
One more important aspect of Network Operating Systems is that all the users are well aware of the
underlying configuration, of all other users within the network, their individual connections etc. and
that’s why these computers are popularly known as tightly coupled systems.
Advantages of Network Operating System:

• Highly stable centralized servers


• Security concerns are handled through servers
• New technologies and hardware up-gradation are easily integrated to the system
• Server access are possible remotely from different locations and types of systems

Disadvantages of Network Operating System:

• Servers are costly


• User has to depend on central location for most operations
• Maintenance and updates are required regularly

Examples of Network Operating System are: Microsoft Windows Server 2003, Microsoft Windows
Server 2008, UNIX, Linux, Mac OS X, Novell NetWare, and BSD etc.

5. Real-Time Operating System –


These types of OSs serves the real-time systems. The time interval required to process and respond to
inputs is very small. This time interval is called response time.

Real-time systems are used when there are time requirements are very strict like missile systems, air
traffic control systems, robots etc.

Two types of Real-Time Operating System which are as follows:

• Hard Real-Time Systems:


These OSs are meant for the applications where time constraints are very strict and even the
shortest possible delay is not acceptable. These systems are built for saving life like automatic
parachutes or air bags which are required to be readily available in case of any accident. Virtual
memory is almost never found in these systems.
• Soft Real-Time Systems:
These OSs are for applications where for time-constraint is less strict.
Advantages of RTOS:

• Maximum Consumption: Maximum utilization of devices and system,thus more output from
all the resources
• Task Shifting: Time assigned for shifting tasks in these systems are very less. For example in
older systems it takes about 10 micro seconds in shifting one task to another and in latest
systems it takes 3 micro seconds.
• Focus on Application: Focus on running applications and less importance to applications
which are in queue.
• Real time operating system in embedded system: Since size of programs are small, RTOS
can also be used in embedded systems like in transport and others.
• Error Free: These types of systems are error free.
• Memory Allocation: Memory allocation is best managed in these type of systems.

Disadvantages of RTOS:

• Limited Tasks: Very few tasks run at the same time and their concentration is very less on few
applications to avoid errors.
• Use heavy system resources: Sometimes the system resources are not so good and they are
expensive as well.
• Complex Algorithms: The algorithms are very complex and difficult for the designer to write
on.
• Device driver and interrupt signals: It needs specific device drivers and interrupt signals to
response earliest to interrupts.
• Thread Priority: It is not good to set thread priority as these systems are very less prone to
switching tasks.

Examples of Real-Time Operating Systems are: Scientific experiments, medical imaging systems,
industrial control systems, weapon systems, robots, air traffic control systems, etc.

2.Explain fundamental issues in hardware software co-design

HARDWARE/SOFTWARE CO-DESIGN METHODOLOGY The systems with less area and simple
elements can be designed by using software and the systems with timing/speed can be designed by
using hardware. Because of portability, battery based designs; System on Chip concepts, low power
high speed issues there is a need to integrate hardware and software components together. The
integration of hardware and software components together is called as co-design. Designing of a co-
design system needs a generic co-design methodology. The generic co-design flow is shown in below
Fig.4. The generic co-design flow for hardware software co-design system consists of the following
steps. A. Specifications The specifications can be refined from the user requirements such that the target
system can fit into any one of the available hardware component or software element. This caring of
specifications is not available in the HW or SW design methodologies. Because of the HW/SW elements
in the target system specifications must be properly selected. Fig 4: Generic Co-Design Flow B. Design
Entry The specifications can be expressed by using different types of models, languages etc. One best
method of design entry is combining some programming language features with hardware description
language features or vice versa. This combination of different languages leads to a new co-design
language. The design entry can be selected based on the following criteria. If the specifications can not
be partitioned /separated into hardware blocks or software blocks then use this co-design language. The
languages can be combined based on the performance criteria i.e. primal approach or dual approach.
The number of registers of the target processor is also a constraint in the language selection. The
language selection can be based on target compiler availability also. Some of the co-design specification
languages are like LOTOS, SDL, and HardwareC etc.. Co-Simulation The system functionality of a
hardware system can be verified by simulation
UNIT-5

LEVEL-1

1.Explain the various elements of an embedded system development environment.

• An Integrated Development Environment is software that contains all the necessary


tools required for embedded software development.
• For creating software for you embedded system, you need all of the above mentioned
tools.
• So it is very helpful to have software that can provide all of the necessary tools from
writing to testing of your code, in one package.
• An IDE normally consists of a code editor, compiler and a debugger.
• An Integrated Development Environment also provides a user interface.
• An example of integrated development environment is Microsoft visual studio. It is
used for developing computer programs and supports different programming
languages.
• Other examples of IDE that are common are given below.
o Android Studio
o Eclipse
o Code Blocks
o BlueJ
o Xcode
o Adobe Flash Builder etc.
• Depending on what kind of microcontroller you are using, you can choose from many
different software applications. I am going to share a few of these Embedded Systems
Software Development Tools here in my article.

1. MPLAB
• If you are working with PIC Microcontroller, than
you definitely need MPLAB.
• MPLAB is an integrated development environment from Microchip technology.
• It is a software that runs on your personal computer and is needed to create program
for your pic microcontroller.
• It helps in editing, debugging and programming of microchip microcontroller that you
use in your embedded system.
• The latest edition of MPLAB is MPLAB X. You can download this software free
form microchip website.
• For developing embedded software for your system using MPLAB, you have to go
through the following steps:
o The first step in this design process is to choose the PIC microcontroller that
meets the requirements and parameters for your system.
o Know all the components of your embedded system by making a rough
design.
o Next step is to write code for your embedded software. It is your choice to
write code in assembly language or some high level programming language.
o Now you have to make your code ready to program your microcontroller. So
using compiler / assembler convert code into machine code.
o The fifth step is to debug your code to remover errors.
o Finally, upload the code in to your microcontroller. And it is ready to be used
in the embedded system.
• There are many important features of MPLAB which are really helpful in software
development. I am going to mention some of them:
o Free C compilers
o Macros
o Complex breakpoints
o Third party tools
o Change variables in watch window etc.

2. Arduino Software

• Arduino software is used if you are


working with arduino microcontroller.
• It is also open source software just like MPLAB that runs on your personal computer.
• Arduino software helps you to create program for your microcontroller providing all
the necessary embedded software tools.
• The codes that you write on arduino software are referred to as sketches and have an
extension .ino.
• Integrated development environment of arduino is very user friendly and has a lot of
features that make your job easy. For example, you can open multiple files with
different extensions in one window.
• With arduino you can make use of a number of different libraries for your functions
and peripherals. Some of them are:
o LiquidCrystal
o WiFi
o Audio
o RTC
o LedControl
o Robot
o Matrix
o Capacitive Sensing

• Now I am moving towards the next one which is Keil.


3. Keil

• Keil is an integrated development environment for a wide range of microcontrollers


including 8051, 251, ARM7, and C16x/ST10 microcontrollers.
• This software includes compiler, assembler, linker, debugger, simulator etc.
• This software is also easy to use and learn.

• The software for 8051 is used by professional embedded system developers and
beginners both.
• Depending on the microcontroller, you are using you can go for the right software.
• Now let’s move towards the next tool that is MATLAB.

4. MATLAB

• Matlab is one of the very important tools for


software developers.
• It provides you with an environment where you can solve all of your computational
problems.
• You can work with matrices, graphs, vectors, functions, arrays, plots etc. You can
make algorithms. Also you can create user interfaces.
• With Matlab, you can also interface programs written in other programming
languages.
• Matlab comes with additional software, Simulink that enables you to create
simulation.
• It is really a helpful tool for embedded software developers, as you can work on
sensors data, plot it and see response by changing certain variables.

5. LabVIEW

• LabVIEW stands for Laboratory Virtual Instrument


Engineering Workbench. This software is also used for viewing output.
• The main functions that can be performed using LabVIEW are data acquisition,
industrial automation and instrument control.
• This software is basically for visual programming language.
• Some of the benefits of LabVIEW are:
o Libraries
o Interfacing to devices
o Parallel programming
o User community

• That was all about LabVIEW basics. The next on the list is PSpice.

6. PSpice
• SPICE stands for Simulation Program for Integrated Circuits Emphasis, and PSpice is
its version for personal computers.
• PSpice is simulation software that is used for simulating circuits.
• It helps in analyzing electronic circuitry, verifying circuit designs and predicting their
behavior.
• It has a number of libraries for digital and analog components.
• The components that are available include
o resistors,
o capacitors,
o voltage and current sources,
o Inductances etc.

7. Proteus

• Proteus is kind of simulation software


where you can create circuits, make model of your embedded system including
microcontroller to see how it works, measure circuit parameters, change sensor values
and much more.
• It helps you to create PCB (printed circuit board) design for your embedded system.
• Microcontroller simulation is an important feature of this software where you can load
a hex file to your microcontroller in the design, connect all other components to it and
see how it works.
• This software runs only on Windows operating system.

8. Visual Studio
• Visual Studio is also an integrated
development environment provided by Microsoft.
• It is used for developing computer programs for Microsoft Windows.
• It can support different programming languages and basically consists of a code editor
and a debugger.
• With this software you can build different mobile apps, window apps, extensions,
games etc. The choice of language is yours.
• Now I am moving to the next tool which is EasyEDA.

9. EasyEDA

• EasyEDA is an online tool that you can use to create schematics, PCB designs, and
simulations.
• Since it is an online tool that runs on web, there is no need for you to download and
install it in your personal computer. Instead you can run it directly.
• Also there is no need of updating your software or to remove bugs, as it is online tool
and keeps updating itself. New features are added automatically.
• Another advantage is that it runs on all types of OS (windows, linux etc.) as EasyEDA
works on your web browser.

10. Altium

• The last one on my list of embedded software tools is Altium which is also PCB
designing software.
• PCB designing is very important part of developing an embedded system, so it is
good to know all the available resources for PCB design.
• The PCB designing module of altium has a lot of features including
o Adding hole tolerance
o PDF 3D export
o Live Drill Drawing
2.Explain simulators, In circuit Emulator(ICE) and debuggers and their role in embedded firm ware
debugging

An in-circuit emulator (ICE) is a hardware interface that allows a programmer to change


or debug the software in an embedded system. The ICE is temporarily installed between the embedded
system and an external terminal or personal computer so that the programmer can observe and alter
what takes place in the embedded system, which has no display or keyboard of its own.

An ICE serves as a "surrogate" CPU (central processing unit) for the microcomputer in an embedded
system. The ICE usually has a connector that fits the CPU socket in the system. If the connector
provided with the ICE does not match the socket in the system, a suitable adapter can usually be found.
An ICE can assist design engineers in product development, and also assist programmers or end users
in product upgrading, modification, or maintenance.

Using an ICE, technicians can test new, revised, or modified programming elements on an embedded
system's hardware without committing to the change. Once they have optimized the embedded-system
software by testing various versions using the ICE, technicians can modify the actual CPU program
accordingly. This process ensures that the final product will function exactly as the vendor and
consumer

3.Explain JTAG based boundary scanning for hardware testing

Circuit design for JTAG, boundary scan

Once the required components have been chosen, it is necessary to ensure that the design for the circuit
enables easy testing, and maximum access when using boundary scan / JTAG. There are a number of
techniques available to ensure that the maximum use can be made of IEEE 1149.1.

• Correct connection of JTAG signals In order to ensure the correct operation of the boundary
scan test, it is necessary to connect the Test Access Port (TAP) signals (TCK, TMS and if
present TRST) in parallel to all the IEEE 1149.1 compliant devices. The TDI and TDO are then
used to form the serial daisy chain around the devices, allowing the serial data to pass from one
chip to the next. Data is sent into the TDI of the first chip, and then TDO from the first chip is
connected to TDI of the next and so forth. Finally the data is taken from the TDO of the last IC
in the daisy chain.

• Partition circuit according to component manufacturers It is often necessary to separate


out the FPGAs or cPLDs from different manufacturers because they use different configuration
tools. In view of the different operation under some circumstances it is easier to partition the
boundary scan chains so that the individual manufacturers tools can communicate with the
relevant devices.

JTAG connector

One important aspect associated with any form of electronics test, and this includes JTAG, boundary
scan is that of test access. This is obviously important in terms of choosing components and designing
the circuit correctly. However physical access is equally important. To ensure that circuits can be tested
easily, many boards include a JTAG connector specifically for test. This JTAG connector can be a very
low cost item as it only needs to be used during the production and test phases of the product. However
good reliable test access is very important. The JTAG connector can save time, especially if it provides
very reliable performance where other methods may not be so reliable. Poor reliability can lead to many
house of lost time fault finding problems associated only with the test access. In view of this and the
ease of performing tests, a JTAG connector can be a cost effective addition to a board in many cases.
A JTAG connector should therefore be considered as one of the design considerations at the earliest
part of the design phase of a product.

This is not an exhaustive summary of all the precautions to take when designing a circuit board that
will use JTAG, boundary scan. However it gives a useful guide to some of the basics that may be
employed.

You might also like