Introduction – Multiple tasks and multiple processes – Multirate systems- Preemptive realtime operating systems- Priority based scheduling- Interprocess communication mechanisms – Evaluating operating system performance- power optimization strategies for processes –Example Real time operating systems-POSIX-Windows CE. – Distributed embedded systems – MPSoCs and shared memory multiprocessors. – Design Example – Audio player, Engine control unit – Video accelerator.
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
RMK College ECE Dept Embedded Systems Processes and OS
1. RMK COLLEGE OF ENGINEERING AND
TECHNOLOGY
DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING
Ms. S. Rajalakshmi
EMBEDDED AND REAL TIME
SYSTEM
2. Unit- 5
PROCESSES AND
OPERATING
SYSTEMS
1. Introduction
2. Multiple tasks and multiple processes,
Multirate systems
3. Pre-emptive Real time operating systems
4. Priority based Scheduling
5. Interprocess Communication
mechanisms
6. Evaluating Operating system
performance
7. Power optimization strategies for
processes
8. Example Real Time Operating System
(POSIX – Windows CE)
9. Distributed embedded systems
10. MPSoCs and shared memory
multiprocessors
11. Design Example – Audio player
12. Design Example – Engine control unit
13. Design Example – Video accelerator
3. 5. INTER PROCESS COMMUNICATION
Communication between various processes within the system .
Operating system provides mechanism for Inter process communication .
Two ways of communication
1. Blocking – Process waits until it receives a response
2. Non-blocking – Process continues its execution after
sending the message.
(i) Shared memory
(ii) Message passing.
(iii)Signals
(iv)Mailboxes
Techniques in Inter Process
Communication
4. (i) Shared memory
Using bus-based system
CPU and I/O device can communicate through a shared memory location
Address of the shared location is known by the software on the CPU and they also loaded into the proper
register of the I/O device
Text Compressor
5. (ii) Message passing.
Each communication devices have their own send/receive unit
Message is stored on the senders/ receivers end points not in communication link
(iii) Signals
A signal is generated by a process and transmitted to
another process by the operating system.
6. (iv) Mailboxes
Simple mechanism for asynchronous communication.
Some architectures define mailbox registers with a fixed number of bits and can be used for small
messages.
simple version of a mailbox holds only one message at a time.
Mailbox contains the message and a mail ready flag. The flag is true when a message has been put into
the mailbox and cleared when the message is removed
7. 6. EVALUATING OPERATING SYSTEM PERFORMANCE
Factors that affect the Operating system performance,
The execution time of the scheduler can be affected by coding practice.
The Choice of scheduling policy affects the time required by the scheduler to determine the next process
to run.
(i) Context Switching Time
(ii) Interrupt Latency
(iii) Critical Sections and Interrupt Latency
(iv) Interrupt priorities and interrupt latency
8. (i) Context Switching Time
Context switching time depends on several factors
The amount of CPU context that must be saved
Scheduler execution time
(ii) Interrupt Latency
Duration of time from the assertion of a device
interrupt to the completion of the device’s requested
operation
The RTOS can delay the execution of an interrupt
handler in two ways,
(i) Critical sections in the kernel will prevent the
RTOS from taking interrupts.
(ii) Higher-priority interrupt may delay a lower-
priority interrupt.
9. (iii) Critical Sections and Interrupt Latency
code segment where the shared variables can be accessed
(iv) Interrupt priorities and interrupt
latency
RTOS Performance evaluation tools
Windows CE,
ILTiming, an instrumentation routine in the kernel that
measures both interrupt service routine and interrupt
service thread latency
OSBench - measures the timing of operating system tasks
such as critical section access, signals, and so on
Kernel Tracker - provides a graphical user interface for RTOS
events
10. 7. POWER OPTIMIZATION STRATEGIES FOR PROCESSES
Strategy for determining when to perform certain power management operations.
There are two modes; Power –up and power-down.
(i) Predictive Shutdown
Goal is to predict when the next request will be made and to start the system just before that time, saving the requestor the start-
up time
Technique 1
If the system does not receive inputs during an interval of
length Ton, it shuts down. A powered-down system waits
for a period Toff before returning to the power-on mode.
12. (ii) Advanced Configuration and Power Interface (ACPI)
Open industry standard for power management services.
Targeted initially to PCs but designed compatible with a wide variety of operating systems.
13. 8. DISTRIBUTED EMBEDDED SYSTEMS
Processing Element (PE)
Unit which is responsible for the computation within the microprocessor system is termed as processing
element.
A PE may be an instruction set processor such as a DSP, CPU, or microcontroller, as well as a nonprogrammable
unit such as the ASICs or an I/O device.
Network
Group of two or more computer systems liked together
15. (i) Network abstractions (ii) CAN Bus
Physical Layer
Data frame
CAN is a multi-master message broadcast system
When RTR = 0, request data
from the device specified by the
identifier.
When RTR = 1, write data to
the destination identifier.
17. Electrical interface to the I2C bus
Bus transaction
0 for writing from the master to the slave.
1 for reading from the slave to the master.
Typical bus transactions on the I2C bus.
(iii) I2C bus (Inter-Integrated Circuit)
I2C is a synchronous, multi-master, multi-slave, packet switched
21. 9. MPSoCs and shared memory multiprocessors
Accelerators
One important category of processing element for embedded multiprocessors is the accelerator.
can provide large performance increases for applications with computational kernels that spend a great deal
of time in a small section of code
Accelerator System Design
22. Accelerator performance analysis
The speedup factor depends in part on
whether the system is,
Single threaded and Multithreaded
Blocking vs nonblocking
24. 10. DESIGN EXAMPLE: AUDIO PLAYER
Audio players are also called as MP3 players.
The earliest portable MP3 players were based on compact disc mechanisms. Modern MP3 players use either
flash memory or disk drives to store music.
An MP3 player performs three basic functions,
Audio storage
Audio decompression
User interface
29. 3. Architecture
Cirrus CS7410 is an audio controller designed for CD/MP3 players
The audio controller includes two processors,
•32-bit RISC processor
•16-bit DSP
The memory controller can be interfaced to
several different types of memory
•Flash memory
•DRAM
The audio interface unit puts out audio in
formats that can be used by A/D converters.
General- purpose I/O pins can be used to
decode buttons, run displays, etc.
Architecture of a Cirrus audio processor for CD/MP3 players.
30. 4. Component design
The most challenging part of system integration and
debugging is ensuring that audio plays smoothly and
without interruption.
5. System testing
The file system can either implement a known standard such as DOS FAT or can implement a new file system.
While a nonstandard file system may be easier to implement on the device, it also requires software to create the file
system.
The audio output system should be tested separately from the compression system. Testing of audio decompression
requires sample audio files
31. 11. DESIGN EXAMPLE: ENGINE CONTROL UNIT
The throttle is the command input.
The engine measures throttle, RPM, intake air
volume, and other variables.
The engine controller computes injector pulse
width and spark.
35. 4. Component design and testing
Any testing performed on an actual engine must be
conducted using an engine controller that has been
designed to withstand the harsh environment of the engine
compartment.
5. System integration and testing
The RTOS initialization phase is used to set up the task periods.
Because some of the output variables depend on changes in state, these tasks should be tested with multiple input
variable sequences to ensure that both the basic and adjustment calculations are performed correctly.
36. 12. DESIGN EXAMPLE: VIDEO ACCELERATOR
A video accelerator is a video card with integrated processor and memory to increase the overall
capabilities of video graphics
Concentrates on motion estimation accelerator
Motion estimation accelerator
Process of determining the motion vector that describe the
transformation from one 2D image to the another.
42. 4. Component design
Testing video algorithms requires a large amount of data
As the design is only a motion estimation it is probably
easiest to use images, not video for test data.
Open source for JPEG encoders and decoders is available.
These programs can be modified to read JPEG images and
put out pixels in the format required by your accelerator
5. System testing
Uses a standard FPGA accelerator board to implement the accelerator
If designing own accelerator board, it is compulsory to design both the video accelerator design and the interface to the PCI
bus
video accelerator architecture can be created and exercised in a hardware description language like VHDL or Verilog
43. 13.(A) Example Real Time Operating System (Windows CE)
Windows CE is an operating system developed by Microsoft and designed for small footprint devices
or embedded systems.
supports devices such as smartphones, electronic instruments, etc.
designed to run on multiple hardware platforms and instruction set architectures.
WinCE Architecture
WinCE layer diagram
45. WinCE Memory space
User address space in Windows CE.
The top 1 GB is reserved for system elements such as DLLs (Dynamic-link library),
memory mapped files, and shared system heap.
The bottom 1 GB holds user elements such as code, data, stack, and heap.
46. WinCE interrupts
1. Interrupt service handler (ISH) - Kernel service that provides the first response to the interrupt.
2. Interrupt service routine (ISR) - ISH selects an interrupt service routine (ISR) to handle the interrupt.
The ISH runs in the kernel with interrupts turned off; as a result, it should be designed to do as little direct work as
possible.
3. Interrupt service thread (IST) - performs most of the work required to handle the interrupt.
The IST runs in the OAL and so can be interrupted by a higher-priority interrupt.
47.
48. 13.(B) Example Real Time Operating System (POSIX)
POSIX is a version of the Unix operating system created by a standards organization.
Unix was not originally designed as a real-time operating system; POSIX has been extended to support Realtime
requirements.
1. Processes in POSIX
(i) fork ( ) function
A process makes a copy of itself by calling the fork ( ) function.
That function causes the operating system to create a new process (the child process) which is a
nearly exact copy of the process that called fork ( ) (the parent process).
They both share the same code and the same data values with one exception, the return value
of fork ( ): the parent process is returned the process ID number of the child process, while the
child process gets a return value of 0.
49. childid = fork ( );
if (childid == 0) { /* must be the child */
/* do child process here */
}
(ii) execv ( ) function
used to overlay the child process with the appropriate code
childid = fork ( );
if (childid == 0) { /* must be the child */
execv(“mychild”, childargs);
exit(1);
}
The execv ( ) function takes as argument the name of the file that
holds the child’s code and the array of arguments.
It overlays the process with the new code and starts executing it
from the main ( ) function.
50. (iii) exit ( ) function
The exit() function is a C
function that is used to leave a
process
The parent process should use one of the POSIX wait functions before calling
exit() for itself.
The wait functions returns the child process’s status, they also make sure that the
child’s resources (namely memory) are free.
childid = fork ( );
if (childid == 0) { /* must be the child */
execv(“mychild”,childargs);
perror(“execl”);
exit(1);
}
else { /* is the parent */
parent_stuff(); /* execute parent functionality */
wait(&cstatus);
exit(0);
}
(iv) wait ( ) function
(v) parent_stuff ( )
The parent_stuff ( ) function performs the work of the
parent function.
51. 2. Real time scheduling in POSIX
(i) sched_setscheduler() function
(ii) SCHED_FIFO policy
#include <sched.h>
int i, my_process_id;
struct sched_param my_sched_params;
…
i = sched_setscheduler(my_process_id,SCHED_FIFO,&sched_params);
52. Two other useful functions allow a process to determine the minimum and maximum priority values in
the system:
minval = sched_get_priority_min(SCHED_RR);
maxval = sched_get_priority_max(SCHED_RR);
(iii) sched_getparams ( )
The sched_getparams ( ) function returns the current parameter values for a process.
(iv) sched_setparams ( )
sched_setparams ( ) changes the parameter values
(v) sched_yield() function
Whenever a process changes its priority, it is put at the back of the
queue for that
priority level.
A process can also explicitly move itself to the end of its priority queue
with a call to the sched_yield() function.
53. 3. POSIX Pipes
(i) pipe ( ) function
A parent process uses the
pipe ( ) function to create a
pipe to talk to a child.
It must do so before the
child itself is created.
if (pipe(pipe_ends) < 0) { /* create the pipe, check for errors */
perror(“pipe”);
break;
}
/* create the process */
childid = fork();
if (childid == 0) { /* the child reads from pipe_ends[1]*/
childargs[0] = pipe_ends[1];
/* pass the read end descriptor to the new incarnation of child */
execv(“mychild”,childargs);
perror(“execv”);
exit(1);
}
else { /* the parent writes to pipe_ends[0] */
}
54. 4. POSIX message passing
POSIX also supports message queues under the _POSIX_MESSAGE_PASSING facility.
The advantage of a queue over a pipe is that, because queues have names, we don’t have to create the pipe
descriptor before creating the other process using it.
The name of a starts with a “/”,
(i) myq
The queue descriptor myq is used to enqueue and
dequeue messages.
(ii) MQ_PRIO_MAX
Messages can be prioritized, with a priority value
between 0 and MQ_PRIO_MAX (there are at least 32
priorities available).
(iii) mq_close ( )
When a process is done with a queue, it calls mq_close (
).
i = mq_close(myq);