Download - 1 Os Services
-
8/9/2019 1 Os Services
1/36
2008 Chapter-8 L1: "Embedded Systems - Architecture, Programming
and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.1
REAL TIME OPERATINGREAL TIME OPERATINGSYSTEMSSYSTEMS
LessonLesson--1:1:OPERATING SYSTEM SERVICESOPERATING SYSTEM SERVICES
GOAL, MODES AND STRUCTUREGOAL, MODES AND STRUCTURE
-
8/9/2019 1 Os Services
2/36
2008 Chapter-8 L1: "Embedded Systems - Architecture, Programming
and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.2
1. OS Services Goal1. OS Services Goal
-
8/9/2019 1 Os Services
3/36
2008 Chapter-8 L1: "Embedded Systems - Architecture, Programming
and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.3
The OS Service GoalThe OS Service Goal Perfection andPerfection and
correctness during a servicecorrectness during a service
GoalGoal
-
8/9/2019 1 Os Services
4/36
2008 Chapter-8 L1: "Embedded Systems - Architecture, Programming
and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.4
(i) Facilitating easy sharing of resources as
per schedule and allocations
No processing task or thread uses any
resource until it has been allocated by theOS at a given instance
OS Services GoalOS Services Goal
-
8/9/2019 1 Os Services
5/36
2008 Chapter-8 L1: "Embedded Systems - Architecture, Programming
and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.5
Meaning of Resource of a systemMeaning of Resource of a system
processor (s), memory, I/O
devices, virtual devices,
system timer, software timers
keypad, displays, printer and other suchresources, which processes (tasks or
threads) request from the OS.
-
8/9/2019 1 Os Services
6/36
2008 Chapter-8 L1: "Embedded Systems - Architecture, Programming
and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.6
(ii) Facilitating easy implementation of the
application program with the given system-
hardware through the system software
OS Services GoalOS Services Goal
-
8/9/2019 1 Os Services
7/36
2008 Chapter-8 L1: "Embedded Systems - Architecture, Programming
and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.7
(iii) Optimally scheduling the processes onone (or more CPUs if available) byproviding an appropriate context switchingmechanism
OS Services GoalOS Services Goal
-
8/9/2019 1 Os Services
8/36
2008 Chapter-8 L1: "Embedded Systems - Architecture, Programming
and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.
8
(iv) Maximizing the system performance tolet different processes (or tasks or threads)share the resources most efficiently withprotection and without any security breach.
OS Services GoalOS Services Goal
-
8/9/2019 1 Os Services
9/36
2008 Chapter-8 L1: "Embedded Systems - Architecture, Programming
and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.
9
(v) Providing management functions for the
processes (tasks or threads), memory, file,
physical and virtual devices and I/Os and
for other functions for which it is designed (vi) Providing management and
organisation functions for the I/Os, devices
and files and file -like devices
OS Services GoalOS Services Goal
-
8/9/2019 1 Os Services
10/36
2008 Chapter-8 L1: "Embedded Systems - Architecture, Programming
and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.
10
(vii) Providing interoperability of the
application on different networks
(viii) Providing a common set of
interfaces that integrates various
devices and applications through
standard and open systems
OS Services GoalOS Services Goal
-
8/9/2019 1 Os Services
11/36
2008 Chapter-8 L1: "Embedded Systems - Architecture, Programming
and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.
11
(ix) Providing easy interfacing and
management functions for the network
protocols and network
(x) Providing portability of the applicationon different hardware configurations
OS Services GoalOS Services Goal
-
8/9/2019 1 Os Services
12/36
2008 Chapter-8 L1: "Embedded Systems - Architecture, Programming
and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.
12
2. User and Supervisory mode2. User and Supervisory mode
structurestructure
-
8/9/2019 1 Os Services
13/36
2008 Chapter-8 L1: "Embedded Systems - Architecture, Programming
and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.
13
Processor in the system running in twoProcessor in the system running in two
modesmodes
Clock, called system clock.
At every clock tick of the system-clock,there is system interrupt.
On each system interrupt, the system timeupdates, the system context switches to thesupervisory mode from user mode.
After completing the supervisory functionsin the OS, the system context switches backto user mode
-
8/9/2019 1 Os Services
14/36
2008 Chapter-8 L1: "Embedded Systems - Architecture, Programming
and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.
14
User modeUser mode
User processpermitted to run and use
only a subset of functions and instructions
in OS.
Use of OS functions in user modeeither
by sending a message to the waiting process
associated in the OS kernel space or by
system call (calling an OS function).
-
8/9/2019 1 Os Services
15/36
2008 Chapter-8 L1: "Embedded Systems - Architecture, Programming
and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.
15
User modeUser mode
The use of hardware resources including
memory is not permitted without OS
making the call to the OS functions, called
system call.
-
8/9/2019 1 Os Services
16/36
2008 Chapter-8 L1: "Embedded Systems - Architecture, Programming
and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.
16
User modeUser mode
User function call, which is not a systemcall, is not permitted to read and write intothe protected memory allotted to the OS
functions, data, stack and heap That protected memory space is also called
kernel space. Hence execution of userfunctions calls is slower than the execution
of the OS functions (on system call) due toneed to spend time in first checking theaccess permission to the protected space
-
8/9/2019 1 Os Services
17/36
2008 Chapter-8 L1: "Embedded Systems - Architecture, Programming
and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.
17
Supervisory modeSupervisory mode
Also called kernel mode
OS runs in protected mode the privilegedfunctions and instructions in protected mode
that are the privileged ones and the OS(more specifically, the kernel) is only onepermitted to access the hardware resourcesand protected area memory
Kernel space functions and processesexecute faster than the user space functionsand processes.
-
8/9/2019 1 Os Services
18/36
2008 Chapter-8 L1: "Embedded Systems - Architecture, Programming
and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.
18
Supervisory modeSupervisory mode
Only a system call is permitted to read and
write into the protected memory allotted to
the OS functions, data, stack and heap
-
8/9/2019 1 Os Services
19/36
2008 Chapter-8 L1: "Embedded Systems - Architecture, Programming
and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.
19
3. Example3. Example Improving system Improving system
performance by running applicationperformance by running application
program threads in supervisory (kernel)program threads in supervisory (kernel)
modemode
-
8/9/2019 1 Os Services
20/36
2008 Chapter-8 L1: "Embedded Systems - Architecture, Programming
and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.
20
RTOS Windows CE and several RTOSesRTOS Windows CE and several RTOSes
Run all the threads run in the supervisory
mode (kernel mode). Therefore, the threads
executes fast.
Improves the system performance.
If the threads are to execute in user mode,
as in Unix or in non-real time OS, then the
execution slows down due to time spent inchecks on the code access to the protected
kernel space
-
8/9/2019 1 Os Services
21/36
2008 Chapter-8 L1: "Embedded Systems - Architecture, Programming
and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.
21
3. Structure3. Structure
-
8/9/2019 1 Os Services
22/36
2008 Chapter-8 L1: "Embedded Systems - Architecture, Programming
and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.
22
Top to down Structural LayersTop to down Structural Layers
Software Application Programming
Interface (API)
System software other than the one
provided at the OS
OS Interface
OS
HardwareOS Interface
Hardware
-
8/9/2019 1 Os Services
23/36
2008 Chapter-8 L1: "Embedded Systems - Architecture, Programming
and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.
23
OS is the middle in-between layer
between the application software and
system hardware
Top to down Structural LayersTop to down Structural Layers
-
8/9/2019 1 Os Services
24/36
2008 Chapter-8 L1: "Embedded Systems - Architecture, Programming
and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.
24
4.4. Kernel Services in the OSKernel Services in the OS
-
8/9/2019 1 Os Services
25/36
2008 Chapter-8 L1: "Embedded Systems - Architecture, Programming
and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.
25
KernelKernel
Process, memory and IO managers areessential components of a kernel
Kernel may include file and devicemanagement functions as part of the
kernel in a given OS Kernel in certain OSes is without File and
Device management functions as part ofthe kernel in the given OS and any otherneeded functions other than process,memory and IO device managers, whichare essential components of a kernel arenot provided for at the kernel
-
8/9/2019 1 Os Services
26/36
2008 Chapter-8 L1: "Embedded Systems - Architecture, Programming
and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.
26
Process Management Kernel Services in anProcess Management Kernel Services in an
OSOS
Creation to deletion of Processes
Process structure maintenance
Processing resource requests
Scheduling Processes
Inter process Communication (IPC)
(communication between Tasks, ISRs, OS
functions)
-
8/9/2019 1 Os Services
27/36
2008 Chapter-8 L1: "Embedded Systems - Architecture, Programming
and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.
27
Memory Management Kernel Services in anMemory Management Kernel Services in an
OSOS
Allocation and de-allocation between
Tasks, ISRs, OS functions
-
8/9/2019 1 Os Services
28/36
2008 Chapter-8 L1: "Embedded Systems - Architecture, Programming
and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.
28
Kernel Services in an OSKernel Services in an OS
File Management
Device Management,
Device Drivers
I/O Management
Interrupts Control (by handling ISR)
Mechanism
-
8/9/2019 1 Os Services
29/36
2008 Chapter-8 L1: "Embedded Systems - Architecture, Programming
and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.
29
SummarySummary
-
8/9/2019 1 Os Services
30/36
2008 Chapter-8 L1: "Embedded Systems - Architecture, Programming
and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.
30
We learntWe learnt
OS goal is perfection, correctness,portability, interoperability, and providing a
common set of interfaces for the system,
resources and orderly access and control
when managing the processes
-
8/9/2019 1 Os Services
31/36
-
8/9/2019 1 Os Services
32/36
2008 Chapter-8 L1: "Embedded Systems - Architecture, Programming
and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.
32
We learntWe learnt
OS structure consists of kernel and otherservice functions outside the kernel. System
software includes the kernel. The OS lets
the application run on the hardware
OS is the middle in-between layer between
the application software and system
hardware
Process, memory and device managers,
which are essential components of a kernel
-
8/9/2019 1 Os Services
33/36
2008 Chapter-8 L1: "Embedded Systems - Architecture, Programming
and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.
33
Kernel - A basic unit of any OS that
includes the functions for processes,
memory, task scheduling, inter process
communication, management of
devices, IOs, and interrupts and may
include the file systems and network
subsystems in certain OSes
We learntWe learnt
-
8/9/2019 1 Os Services
34/36
2008 Chapter-8 L1: "Embedded Systems - Architecture, Programming
and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.
34
We learnt OS lets a process execute on the CPU
some process at OS for a resource-
management mechanism lets it use thesystem-memory and other system-
resources such as network, file, display
or printer
-
8/9/2019 1 Os Services
35/36
2008 Chapter-8 L1: "Embedded Systems - Architecture, Programming
and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.
35
We learntWe learnt
Kernel functions are management of
processes, process and resources scheduling
memory, file, devices, IOs, network and
handling the interrupts
-
8/9/2019 1 Os Services
36/36
2008 Chapter-8 L1: "Embedded Systems - Architecture, Programming
and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.
36
End of Lesson 1 of Chapter 8End of Lesson 1 of Chapter 8