Faculty Of Engineering and Technology
Department of Computer Science
Course: Introduction to IT
Course Code : CS- 104
(Lecture-5)
Lecturer: Nazir Ahmad Qayoom
Department: Computer Science
Email:
[email protected]Mobile: +93(0) 706338869
CONTENTS
• CPU Architecture
• Threading
• Pipelining
2
OUTCOMES
At the end of this lecture, students will be able to;
• CPU Architecture
• Threading
• Pipelining
3
System Unit: CPU Architecture
• Two components handle processing in a computer:
• The central processing unit Or CPU
• The memory
• Both are located on the computer’s motherboard.
System Unit: CPU Architecture
• CPU, Also called as a processor, microprocessor, central processor, "the brains of the
computer”, the CPU is the heart of any computer system.
• It interprets and carries out basic instructions that operate a computer.
• Central Processing Unit itself consists of three main subsystems; first is the Control
Unit, the second is Registers, and the third is Arithmetic and Logic Unit(ALU).
System Unit: CPU Architecture
Cont…
• Cache Memory:
• It is the fastest and Closest memory inside or outside of the processor.
• When the processor need any data to complete the currently running process, so the
processor will first search the data in the cache memory, if not available then will
search the data in the RAM.
• Cache have important role in the Speed of Computer.
Machine Cycle
• The machine cycle is the main activity of the CPU to execute the program
instructions.
• CPU continuously performs the Machine cycle necessary for program execution.
• It is also called as Instruction cycle, CPU cycle, Processor cycle.
• It includes four steps accordingly:
1. Fetch
2. Decode
3. Execute
4. Store
Machine Cycle
• Fetch: The CPU initiates the program by fetching the program instructions and the
corresponding data from the main system memory RAM.
• Decodes: Control unit decodes and translate the program machine code instructions.
The control unit decodes the program instructions as per the CPU own architecture.
• Execute: After decoding the instructions next step for the CPU is to execute the desired
operations.
• Store: once the desired operation has been done, the processed data is then sent and
stored back in to the main memory RAM. This stored data can either be sent to any
output device such as monitor or it can be sent to any permanent storage device for
future use.
Machine Cycle
Threading
• Threads is a series of programed instructions which allow a CPU core to appear to be
split into two cores. So for each core you have two threads.
• 2cores / 4 threads, 4cores /8 cores …
• Modern operating systems support the running of many programs, or multi-tasking.
• The CPU may be asked to perform tasks for more than one program.
• To make this work, the OS and the CPU create threads.
• A thread is one instruction from a program.
• The CPU will execute one thread from a program at one time.
• Since the CPU can perform each thread quickly , the user thinks that each program is
being run at the same time.
• Newer processors support hyper threading.
Threading
Hyper Threading
• Hyper-Threading Technology is a hardware innovation that allows more than one thread
to run on each core.
• More threads means more work can be done in parallel.
• Two logical cores can work through tasks more efficiently than a traditional single-
threaded core.
• By taking advantage of idle time when the core would formerly be waiting for other
tasks to complete, Hyper-Threading Technology improves CPU performance.
Pipelining
• Pipelining is a technique where multiple instructions are overlapped during execution.
• Pipeline is divided into stages and these stages are connected with one another to form a
pipe like structure.
• Instructions enter from one end and exit from another end.
Pipelining
Pipelining
• A pipeline phase related to each subtask executes the needed operations.
• A similar amount of time is accessible in each stage for implementing the needed
subtask.
• All pipeline stages work just as, receiving their input generally from the previous stage
and transferring their output to the next stage.
Pipelining
• This defines that each stage gets a new input at the beginning of the clock cycle, each
stage has a single clock cycle available for implementing the needed operations, and
each stage produces the result to the next stage by the starting of the subsequent clock
cycle.
Thank You…!