0% found this document useful (0 votes)
59 views17 pages

Embedded Systems

embedded systems

Uploaded by

Anet Augustin
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
59 views17 pages

Embedded Systems

embedded systems

Uploaded by

Anet Augustin
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 17

EMBEDDED SYSTEMS

MODULE 4
MULTITASKING
MULTIPROGRAMMING -
MULTIPROCESSING
MULTIPROCESSING
1. Execute multiple processes simultaneously.
2. Multiple processes = multiple processors
3. Multiprocessing in Multiprocessor s/ms
4. S/M s with this ability possesses multiple
processors (CPUs) that execute multiple
processes simultaneously.
MULTIPROGRAMMING
1. Store multiple programs in the memory at a
time
2. Execute multiple programs simultaneously
3. Applicable for multiprocessor and uniprocessor
systems
4. In multiprocessor multiprogramming ====
multiprocessing
5. In uniprocessor multiprogramming ====
multitasking.
WHY MULTIPROGRAMMING?
In the early days of computing,CPU timewas expensive, andperipheralswere very
slow. When the computer ran a program that needed access to a peripheral, the
central processing unit (CPU) would have to stop executing program instructions
while the peripheral processed the data. This was deemed very inefficient. [
citation needed]

The first computer using a multiprogramming system was the BritishLeo IIIowned
byJ. Lyons and Co.Several different programs in batch were loaded in the
computer memory, and the first one began to run. When the first program reached
an instruction waiting for a peripheral, the context of this program was stored
away, and the second program in memory was given a chance to run. The process
continued until all programs finished running. [citation needed]
The use of multiprogramming was enhanced by the arrival ofvirtual memoryand
virtual machinetechnology, which enabled individual programs to make use of
memory and operating system resources as if other concurrently running programs
were, for all practical purposes, non-existent and invisible to them. [citation needed]
Multiprogramming doesn't give any guarantee that a program will run in a timely
manner. Indeed, the very first program may very well run for hours without needing
access to a peripheral. As there were no users waiting at an interactive terminal,
this was no problem: users handed in a deck of punched cards to an operator, and
came back a few hours later for printed results. Multiprogramming greatly reduced
wait times when multiple batches were being processed
MULTITASKING
1. Multitasking is pseudo parallelism
2. It creates an illusion of parallel execution of multiple
programs.
3. multitaskingis a concept of performing multipletasks
over a certain period of time by executing them
concurrently.
4. New tasks start and interrupt already started ones
before they have reached completion, instead of
executing the tasks sequentially so each started task
needs to reach its end before a new one is started. As
a result, a computer executes segments of multiple
tasks in an interleaved manner, while the tasks share
common processing resources such ascentral
processing units(CPUs) andmain memory.
Multitasking doesnotnecessarily mean that
multiple tasks are executing at exactly the
same time.
multitasking does not imply
parallel execution, but it does mean that
more than one task can be part-way through
execution at the same time, and that more
than one task is advancing over a given
period of time.
MULTITASKING IN
UNIPROCESSOR S/MS
Uniprocessor s/ms :
1. Multiple tasks cannot be executed
simultaneously
2. However it can attain some deg of pseudo
parallelism for simultaneous multiple task
execution using multitasking
3. The technique is to switch execution among
different processes simultaneously.
4. The OS holds multiple processes in memory
and switch the CPU from executing one
processor to another processor.
In the case of a computer with a single CPU,
only one task is said to be running at any point
in time, meaning that the CPU is actively
executing instructions for that task.
Multitasking solves the problem by scheduling
which task may be the one running at any
given time, and when another waiting task
gets a turn.
The act of reassigning a CPU from one task to
another one is called acontext switch; the
illusion of parallelism is achieved when
context switches occur frequently enough.
MULTITASKING IN
MULTIPROCESSOR S/MS
Onmultiprocessorormulticorecomputers,
which have multiple CPUs/cores so more
than one task can be executed at once
(physically, one per CPU or core),
multitasking allows many more tasks to be
run than there are CPUs.
HOW MULTITASKING ?
Operating systems may adopt one of many different scheduling
strategies, which generally fall into the following categories: [
citation needed]

Inmultiprogrammingsystems, the running task keeps running


until it performs an operation that requires waiting for an
external event (e.g. reading from a tape) or until the computer's
scheduler forcibly swaps the running task out of the CPU.
Multiprogramming systems are designed to maximize CPU usage.
Intime-sharingsystems, the running task is required to
relinquish the CPU, either voluntarily or by an external event
such as ahardware interrupt. Time sharing systems are designed
to allow several programs to execute apparently simultaneously.
Inreal-timesystems, some waiting tasks are guaranteed to be
given the CPU when an external event occurs. Real time systems
are designed to control mechanical devices such as industrial
robots, which require timely processing.
CONTEXT SWITCHING WHAT
HAPPENS?
A process identical to physical processor :
hence process === VIRTUAL PROCESSOR
1. It has its own registers set that monitors
the CPU registers , SP and PC .
2. A process in waiting is a VIRTUAL
PROCESSOR waiting its turn to get its
PROPERTIES converted to that of a
PHYSICAL PROCESSOR
When context switching occurs..
1. Virtual to physical processor switching controlled
by OS kernel scheduler
2. Multitasking involves :
. CONTEXT SWITCHING
. CONTEXT SAVING
. CONTEXT RETRIEVAL
1. Context switching : switching CPU among the
processes or changing the current execution
context.
2. Context saving : saving the current context which
contains the context details [ reg det , mem det ,
sys-res usage det ,exe det etc] for the current
running process at the time of switching
3. Context retrieval :Retrieving the saved context
details so as to resume a process exactly from the
point it was interrupted due to CPU switching .
TYPES OF MULTITASKING -BASED ON
HOW SWITCHING OCCURS.

REFER PAPER

You might also like