7 Multitasking
-
Upload
rochana-ramanayaka -
Category
Documents
-
view
212 -
download
0
Transcript of 7 Multitasking
-
8/13/2019 7 Multitasking
1/14
Multitasking
-
8/13/2019 7 Multitasking
2/14
Multitasking
A method by which multiple tasks, also
known as processes, share common
processing resources such as a CPU.
http://en.wikipedia.org/wiki/Computer_processhttp://en.wikipedia.org/wiki/Central_processing_unithttp://en.wikipedia.org/wiki/Central_processing_unithttp://en.wikipedia.org/wiki/Computer_process -
8/13/2019 7 Multitasking
3/14
mul t ip rogramming systems
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 designedto maximize CPU usage.
-
8/13/2019 7 Multitasking
4/14
t ime-sharingsystems
the running task is required to relinquish
the CPU, either voluntarily or by an
external event such as a hardware
interrupt
Time sharing systems are designed to
allow several programs to execute
apparently simultaneously.
http://en.wikipedia.org/wiki/Time-sharinghttp://en.wikipedia.org/wiki/Hardware_interrupthttp://en.wikipedia.org/wiki/Hardware_interrupthttp://en.wikipedia.org/wiki/Hardware_interrupthttp://en.wikipedia.org/wiki/Hardware_interrupthttp://en.wikipedia.org/wiki/Time-sharinghttp://en.wikipedia.org/wiki/Time-sharinghttp://en.wikipedia.org/wiki/Time-sharing -
8/13/2019 7 Multitasking
5/14
Time Sharing
Cooperative multitasking
Preemptive multitasking
-
8/13/2019 7 Multitasking
6/14
Cooperative multitasking
When computer usage evolved from batch mode
to interactive mode, multiprogramming was no
longer a suitable approach. Each user wanted to
see his program running as if it was the onlyprogram in the computer.
The use of time sharing made this possible, with
the concession that the computer would not
seem as fast to any one user as it really wouldbe if it were running only that user's program.
-
8/13/2019 7 Multitasking
7/14
Disadvantages
A cooperatively multitasked system must
rely on each process to regularly give time
to other processes on the system
(voluntarily).
A single stalled process could halt the
entire system
Irregular use of system resources
-
8/13/2019 7 Multitasking
8/14
Preemptive multitasking
Preemptive multitasking allows the
computer system to more reliably
guarantee each process a regular "slice"
of operating time. It also allows the systemto rapidly deal with important external
events like incoming data, which might
require the immediate attention of one oranother process.
-
8/13/2019 7 Multitasking
9/14
real-t imesystems
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.
-
8/13/2019 7 Multitasking
10/14
Multi-threading
Block Multi-threading
Interleaved Multi-threading
Simultaneous Multi-threading
-
8/13/2019 7 Multitasking
11/14
Block/Cooperative/Coarse-grained
Multi-threading The simplest type of multi-threading is where
one thread runs until it is blocked by an event
that normally would create a long latency stall.
For example:
Cycle i : instruction j from thread A is issued
Cycle i+1: instruction j+1 from thread A is issued
Cycle i+2: instruction j+2 from thread A is issued, load instructionwhich misses in all caches
Cycle i+3: thread scheduler invoked, switches to thread B
Cycle i+4: instruction k from thread B is issued
Cycle i+5: instruction k+1 from thread B is issued
-
8/13/2019 7 Multitasking
12/14
Interleaved Multi-threading
A higher performance type of
multithreading is where the processor
switches threads every CPU cycle.
Cycle i : an instruction from thread A is issued
Cycle i+1: an instruction from thread B is issued
Cycle i+2: an instruction from thread C is issued
Source: -en.wikipedia.org
-
8/13/2019 7 Multitasking
13/14
Simultaneous Multi-threading
The most advanced type of multi-threading
applies to superscalarprocessors.
Cycle i : instructions j and j+1 from thread A; instruction k from thread B allsimultaneously issued
Cycle i+1: instruction j+2 from thread A; instruction k+1 from thread B;
instruction m from thread C all simultaneously issued
Cycle i+2: instruction j+3 from thread A; instructions m+1 and m+2 from
thread C all simultaneously issued
http://en.wikipedia.org/wiki/Superscalarhttp://en.wikipedia.org/wiki/Superscalar -
8/13/2019 7 Multitasking
14/14
From scalar to superscalar
Each instruction executed by a scalar processormanipulates one or two data items at a time.
By contrast, each instruction executed by a
vector processoroperates simultaneously onmany data items.
A superscalar processor is a hybrid of the two -each instruction processes one data item but
with multiple redundant functional units withineach CPU so that multiple instructions can beprocessing separate data items concurrently.
Source: - en.wikipedia.org
http://en.wikipedia.org/wiki/Vector_processorhttp://en.wikipedia.org/wiki/Vector_processor