Rtes07 - Rtos
Rtes07 - Rtos
RTES Introduction
Categories of the RTES
Properties & Components
Hardware
Today’s topics
An operating system (OS) is the software that sits between the hardware of a
computer and software applications running on the computer. An OS is a
resource allocator and manager.
It manages the computer hardware resources and hides the details of how the
hardware operates to make the computer system more convenient to use.
The main hardware resources in a computer are
Processor
Memory
I/O controllers
Disks
and other devices such as terminals and networks.
General Purpose Operating System
An OS is a policy enforcer.
It defines the rules of engagement between the applications and resources and
controls the execution of applications to prevent errors and improper use of the
computer.
An OS is composed of multiple software components, and the core
components in the OS form its kernel.
The kernel provides the most basic level of control over all of the computer’s
hardware devices.
The kernel of an OS always runs in system mode, while other parts and all
applications run in user mode.
Kernel functions are implemented with protection mechanisms such that they
could not be covertly changed through the actions of software running in
userspace.
General Purpose Operating System
Process Management
Memory Management
Interrupts Management
Multitasking
File System Management
I/O Management
Process Management
Fork
Spawn
PID (Process Identifier)
Exit
Suspension
Program Execution
Before a program is loaded into memory by the loader,
part of the OS, it must be converted into a load module
and stored on disk.
To create a load module, the source code is compiled
by the compiler. The compiler produces an object
module.
Memory Management
Each task has a context, which is the data indicating its execution state
and stored in the task control block (TCB), a data structure that contains all
the information that is pertinent to the execution of the task.
When a scheduler switches a task out of the CPU, its context has to be
stored; when the task is selected to run again, the task’s context is restored
so that the task can be executed from the last interrupted point.
The process of storing and restoring the context of a task during a task
switch is called a context switch.
Multitasking – Context Switching
File System Management
Modern computers interact with a wide range of I/O devices. Keyboards, mice, printers, disk drives, USB
drives, monitors, networking adapters, and audio systems are among the most common ones.
One purpose of an OS is to hide peculiarities of hardware I/O devices from the user.
Memory-mapped I/O
Each I/O device occupies some locations in the I/O address space.
Communication between the I/O device and the processor is enabled through physical memory locations in the I/O
address space.
By reading from or writing to those addresses, the processor gets information from or sends commands to I/O devices.
Device Controllers
A device controller is primarily an interface unit. The OS communicates with the I/O device through the device
controller.
Nearly all device controllers have direct memory access (DMA) capability, meaning that they can directly access the
memory in the system, without the intervention by the processor. This frees up the processor of the burden of data
transfer from and to I/O devices.
I/O Management
Interrupts allow devices to notify the processor when they have data to
transfer or when an operation is complete, allowing the processor to perform other duties
when no I/O transfers need its immediate attention.
The processor has the interrupt request line that it senses after executing every instruction.
Device Controller raises an interrupt
Processor catches it, saves its state and transfer control to the ISR
ISR determines the cause of the interrupt and perform necessary processing.
I/O operations often have high latencies. Most of this latency is due to the
slow speed of peripheral devices.
For example, information cannot be read from or written to a hard disk until the spinning of
the disk brings the target sectors directly under the read/write head.
The latency can be alleviated by having one or more input and output buffers associated
with each device.
RTOS Kernel
The timing behavior of the OS must be predictable. For all services provided
by the OS, the upper bound on the execution time must be known. Some
of these services include OS calls and interrupt handling.
The OS must manage the timing and scheduling, and the scheduler must
be aware of task deadlines.
The OS must be fast. For example, the overhead of context switch should
be short. A fast RTOS helps take care of soft real-time constraints of a system
as well as guarantees hard deadlines
RTOS Overview
RTOS Kernel
Priority Scheduling
EDF
RM
Preemption
Scheduling