Sei sulla pagina 1di 15

Teacher’s Name: Akhtab Hussain

CHAPTER No. 4
Operating System
and
Computer
Architecture

1
Teacher’s Name: Akhtab Hussain

Contents
4.1 Operating System........................................................................................................................ 5
4.1.1 Definition............................................................................................................................. 5
4.1.2 Functions of Operating System ........................................................................................... 5
4.1.3 Types of Operating System ................................................................................................. 6
4.1.3.1 Real-Time Operating System .......................................................................................... 6
4.1.3.2 Multi-user vs. Single user ............................................................................................... 6
4.1.3.3 Multi-tasking vs. Single-tasking........................................................................................... 6
4.1.3.4 Distributed .......................................................................................................................... 6
4.1.3.5 Embedded ....................................................................................................................... 6
4.1.4 Types of User Interface ....................................................................................................... 7
4.1.4.1 Command Line Interface (CLI) ......................................................................................... 7
4.1.4.2 Graphical User Interface (GUI) ........................................................................................ 7
4.1.4.3 Comparison of CLI and GUI ............................................................................................. 7
4.2 Booting Process....................................................................................................................... 8
4.3 Interrupts ................................................................................................................................ 8
4.3.1 Examples ......................................................................................................................... 8
4.3.2 Interrupt Handling........................................................................................................... 8
4.4 Buffers ..................................................................................................................................... 8
4.4.1 Need of Buffers ............................................................................................................... 8
4.5 Use of Interrupts and Buffers ................................................................................................. 9
VON NEUMANN ARCHITECTURE............................................................................................................. 9
4.6 Components of Von Neumann Architecture ............................................................................ 10
4.6.1 Buses ................................................................................................................................. 10
4.6.1.1 Types of Buses .............................................................................................................. 10
4.6.1.2 Bus Width .......................................................................................................................... 10
4.6.1.3 Functions of buses ............................................................................................................ 11
4.6.2 Address.............................................................................................................................. 11
4.6.3 Registers ............................................................................................................................ 11
4.6.3.1 Types of Registers ......................................................................................................... 11
4.6.4 Memory Unit ..................................................................................................................... 12
4.6.4.1 Read Operation ............................................................................................................. 12
4.6.4.2 Write Operation ............................................................................................................ 13
4.6.5 Arithmetic Logic Unit (ALU)............................................................................................... 13

2
Teacher’s Name: Akhtab Hussain

4.6.6 Control unit (CU) ............................................................................................................... 13


4.6.6.1 Functions of CU ............................................................................................................. 13
4.6.7 Input and output devices .................................................................................................. 14
4.7 The fetch–execute cycle ........................................................................................................... 14
4.7.1 Fetch.................................................................................................................................. 14
4.7.2 Decode .............................................................................................................................. 14
4.7.3 Execute .............................................................................................................................. 14

3
Teacher’s Name: Akhtab Hussain

List of Figures

Figure 1 Operating System Interface ...................................................................................................... 5


Figure 2: Operating System Resource Management .............................................................................. 5
Figure 3: Command Line Interface .......................................................................................................... 7
Figure 4: Interrupt handling during printing ........................................................................................... 9
Figure 5: Computer Buses ..................................................................................................................... 10
Figure 6: Address and Registers ............................................................................................................ 12
Figure 7: Fetch Execute Cycle ............................................................................................................... 14
List of Tables

Table 1: Functions of Operating System ................................................................................................. 6


Table 2: Comparison of GUI and CLI ....................................................................................................... 8
Table 3: Functions of Buses................................................................................................................... 11
Table 4: Memory Addresses ................................................................................................................. 12

4
Teacher’s Name: Akhtab Hussain

4.1 Operating System


4.1.1 Definition
“An operating system (OS) is system software that manages computer hardware
and software resources and provides common services for computer programs.”
Points to Remember
 Operating system is an interface between computer and user (as shown in figure 1).

Figure 1 Operating System Interface


 It is responsible for the management and coordination of activities and the sharing
of the resources of the computer (as shown in figure 2).

Figure 2: Operating System Resource Management


4.1.2 Functions of Operating System

Sr Function Description
#
i) Human Computer Interface (HCI) To provide a link between computer system and user
ii) Multitasking Execute more than one program or task
simultaneously.
iii) Multiprogramming Several programs are run at the same time on a
single Processor.

5
Teacher’s Name: Akhtab Hussain

iv) Batch Processing Execution of a series of jobs in a program on


computer without manual intervention.
v) Error Handling Managing the exceptional errors
vi) Managing Application Software Loading and running of application software
vii) Management of User Accounts Allowing the user to create and manage multiple
accounts on a single system.
viii) File Utilities To manage file operations (Copy, save, sort, delete)
ix) Processor Management Allocation of processor to multiple tasks
simultaneously
x) Memory Management Storing the relevant data in RAM and deleting it (if
necessary)
xi) Real Time Processing Allowing the input request to deal quickly enough to
control an output properly.
xii) Interrupt Handling Routines Allocation of processor and RAM in case of interrupts
xiii) Security Manages Log on, Passwords
xiv) Input and Output Control Controlling the basin input and output devices.
Table 1: Functions of Operating System

NOTE:
All Operating systems cannot perform all the above mentioned functions.
4.1.3 Types of Operating System
4.1.3.1 Real-Time Operating System
“A real-time operating system is a multitasking operating system that aims at executing
real-time applications.”
These operating systems respond to input instantly.
4.1.3.2 Multi-user vs. Single user
“A multi-user operating system allows multiple users to access a computer system
concurrently.”
Time-sharing system can be classified as multi-user systems as they enable a multiple user
access to a computer through the sharing of time.
“Single-user operating systems, as opposed to a multi-user operating system, are usable by
a single user at a time.”
4.1.3.3 Multi-tasking vs. Single-tasking
“When a single program is allowed to run at a time, the system is grouped under a single-
tasking system.”
While in case the operating system allows the execution of multiple tasks at one time, it is
classified as a multi-tasking operating system.
4.1.3.4 Distributed
“A distributed operating system manages a group of independent computers and makes
them appear to be a single computer.”
The development of networked computers that could be linked and communicate with each
other, gave rise to distributed computing.
4.1.3.5 Embedded
“Embedded operating systems are designed to be used in embedded computer systems.”
They are designed to operate on small machines like PDAs with less autonomy. They are able
to operate with a limited number of resources.

6
Teacher’s Name: Akhtab Hussain

4.1.4 Types of User Interface


• Command line interface
• Graphical user interface
4.1.4.1 Command Line Interface (CLI)
“A command-line interface is a mechanism for interacting with a computer operating system
or software by typing commands to perform specific tasks.”
 This method of instructing a computer to perform a given task is referred to as "entering" a
command.
 Accept input via keyboard only.
 Not suitable for beginners.

Figure 3: Command Line Interface


4.1.4.2 Graphical User Interface (GUI)
“It is a type of user interface which allows people to interact with computer with images
rather than text commands.”
 Accept input via keyboard and pointing devices.
 Easy to learn.
Elements of Graphical User Interface
- Pointer - Icons - Desktop
- Windows - Menus
4.1.4.3 Comparison of CLI and GUI

CLI GUI
Ease Because of the memorization and Although new users may have a difficult
familiarity needed to operate a command time learning to use the mouse and all
line interface, new users have a difficult GUI features, most users pick up this
time navigating and operating a interface much easier when compared
Command line interface. to a command line interface.
Control Users have much more control of their Although a GUI offers plenty of control
file system and operating system in a of a file system and operating system,
command line interface. For example, the more advanced tasks may still need
users can copy a specific file from one a command line.
location to another with a one-line
command.
Multitasking Although many command line GUI users have windows that enable a
environments are capable of user to view, control, and manipulate
multitasking, they do not offer the same multiple things at once and are much
ease and ability to view multiple things at faster to navigate when compared with a

7
Teacher’s Name: Akhtab Hussain

once on one screen. command line.


Speed Command line users only need to use A GUI may be easier to use because of
their keyboards to navigate a command the mouse. However, using a mouse and
line interface and often only need to keyboard to navigate and control your
execute a few lines to perform a task. operating system for many things is
going to be much slower than someone
who is working in a command line.
Table 2: Comparison of GUI and CLI

4.2 Booting Process


When a computer is first powered up, the initiating programs are loaded into
memory from the ROM (read only memory) chip. These programs run a checking procedure
to make sure the hardware, processor, internal memory and bios (basic input–output
system) are all functioning correctly. If no errors are detected, then the operating system is
loaded into memory.

4.3 Interrupts
“An INTERRUPT is a signal sent from a device or from software to the processor. This
will cause the processor to temporarily stop what it is doing and service the interrupt.”
4.3.1 Examples
Interrupts can occur when, for example:
i. A disk drive is ready to receive more data
ii. An error has occurred, such as a paper jam in a printer
iii. The user has pressed a key to interrupt the current process – an example could be
<CTRL><ALT><BREAK> keys pressed simultaneously
iv. A software error has occurred – an example of this would be if an .exe file couldn’t be found
to initiate the execution of a program.

4.3.2 Interrupt Handling


Once the interrupt signal is received, the processor either carries on with what it
was doing or stops to service the device/program that generated the interrupt.
I. Whenever an interrupt is serviced, the status of the current task being run is saved.
This is done using an INTERRUPT HANDLER.
II. Microprocessor handles the interrupt.
III. Once the interrupt has been fully serviced, the status of the interrupted task is
reinstated and it continues from the point prior to the interrupt being sent.
4.4 Buffers
“BUFFERS are used in computers as a temporary memory area. “
4.4.1 Need of Buffers
I. Hardware devices operate at much slower speeds than the processor. If it wasn’t for
buffers, processors would spend the majority of their time idle, waiting for the
hardware device to complete its operation.
II. Buffers are used, for example, when streaming a video from the internet. This
ensures that the video playback doesn’t keep on stopping to wait for data from the
internet.

Buffers are essentially filled from the processor or memory unit and whilst these
are emptied to the hardware device, the processor carries on with other tasks.

8
Teacher’s Name: Akhtab Hussain

4.5 Use of Interrupts and Buffers


Buffers and interrupts are often used together to allow standard computer functions
to be carried out. These functions are often taken for granted by users of modern computer
systems. Figure 4 shows how buffers and interrupts are used when a document is sent to a
printer.

Figure 4: Interrupt handling during printing

VON NEUMANN ARCHITECTURE


Very early computers were fed data whilst the machines were actually running. They
weren’t able to store programs; consequently, they weren’t able to run without human
intervention.
In about 1945, John von Neumann developed the idea of a stored program
computer, often referred to as the VON NEUMANN ARCHITECTURE concept.

9
Teacher’s Name: Akhtab Hussain

His idea was to hold programs and data in a memory. Data would then move
between the memory unit and the processor. There are many diagrams which show von
Neumann architecture.

4.6 Components of Von Neumann Architecture


Basic elements of a Von Neumann Machine are following
1) Buses
2) Address
3) Registers
4) Memory Unit
5) Arithmetic and Logic Unit
6) Control Unit
7) Input and Output Devices

4.6.1 Buses
“A system bus is an electrical path or set of wires, used to move data, address or
control signals from one unit to another.”

4.6.1.1 Types of Buses


System bus can be divided into three types:
1) Data Bus
2) Address Bus
3) Control Bus
4.6.1.2 Bus Width
“Number of bits a bus can move at a time is called bus width. Bus width depends upon the
number of wires used in a bus as one bit can transfer one bit at a time.”
Figure 5 shows the idea of how processor and memory units are linked together by
connections known as BUSES. This is a simple representation of von Neumann architecture.

Figure 5: Computer Buses

10
Teacher’s Name: Akhtab Hussain

4.6.1.3 Functions of buses

Type of Bus Description of Bus Data/ Signal Direction

Address Bus Carries signals relating to addresses between the processor unidirectional
and the memory (signals travel in
one direction
only)
Data Bus sends data between the processor, the bi-directional
memory unit and the input/output devices (data can travel
in both
directions)
Control Bus carries signals relating to the control and unidirectional
coordination of all activities within the computer (signals travel in
(examples include: the read and write functions) one direction
only)
Table 3: Functions of Buses

4.6.2 Address
“An address is the location of where data can be found in a computer memory. Each
address in the memory is unique.”

4.6.3 Registers
“A register is simply a high speed storage area within the computer. All data must be
represented in a register before it can be processed.”

4.6.3.1 Types of Registers


Number of registers used in a computer depends upon its architecture and its logic design.
Some of the commonly use registers are as follows:

Register Stands for Function Used by


MAR Memory Address To store the address of data to Memory Unit
Register be read
MDR Memory Data Register To store the contents of the Memory Unit
memory location (in MAR)
PC Program Counter Contains the address of the next Control Unit
instruction to be executed.
CIR Current Instruction Contains the current instruction Control Unit
Registers during processing.
ACC Accumulator To store intermediate and final Arithmetic Logic Unit
results

Figure 6 shows a slightly more detailed diagram of the von Neumann architecture. It
brings to our attention another new concept in this computer model – the idea of
ADDRESSES and REGISTERS.

11
Teacher’s Name: Akhtab Hussain

Figure 6: Address and Registers

4.6.4 Memory Unit


The computer memory unit is made up of a number of partitions. Each partition
consists of an ADDRESS and its CONTENTS. The example had shown here uses 8 bits for each
address and 8 bits for the content. In a real computer memory, the address and its contents
are actually much larger than this.
The address will uniquely identify every LOCATION in the memory and the contents
will be the binary.
Address Contents
1111 0000 0111 0010
1111 0001 0101 1011
1111 0010 1101 1101
1111 0011 011 1011
1111 1100 1110 1010
1111 1101 1001 0101
1111 1110 1000 0010
1111 1111 0101 0101
Table 4: Memory Addresses

4.6.4.1 Read Operation


Consider the READ operation. We will use the memory section shown in Table 4.
Suppose we want to read the contents of memory location 1111 0001; the two registers are
used as follows:
i. The address of location 1111 0001 to be read from, is first written into the MAR (memory
address register)

12
Teacher’s Name: Akhtab Hussain

ii. A ‘read signal’ is sent to the computer memory using the control bus.
iii. The contents of memory location 1111 0001 are then put into the MDR (memory
data register):

4.6.4.2 Write Operation


Now let us consider the WRITE operation. Suppose this time we want to show how
the value 1001 0101 was written into memory location 11111101.
i. The data to be stored is first written into the MDR (memory data register):

ii. This data has to be written into the memory location with the address 1111 1101; so this
address is now written into the MAR:

iii. Finally, a ‘write signal’ is sent to the computer memory using the control bus and this value
will then be written into the correct memory location.

4.6.5 Arithmetic Logic Unit (ALU)


The PROCESSOR contains the ARITHMETIC AND LOGIC UNIT (ALU). The ALU allows
arithmetic (e.g. add, subtract, etc.) and logic (e.g. AND, OR, NOT, etc.) operations to be carried out.

4.6.6 Control unit (CU)


“The CONTROL UNIT controls the operation of the memory, processor and input/output
devices.”
It contains the CURRENT INSTRUCTION REGISTER (CIR) and the PROGRAM COUNTER (PC).
The CIR contains the current instruction during processing. The PC contains the address of the next
instruction to be executed.

4.6.6.1 Functions of CU
1) The control unit reads an instruction from memory (the address of the location where the
instruction can be found is stored in the Program Counter).
2) This instruction is then interpreted.
3) Signals are generated along the control bus to tell the other components in the computer
what to do.

13
Teacher’s Name: Akhtab Hussain

4.6.7 Input and output devices


The input and output devices are the main units of entering data into and getting data out of
computer systems. Input devices convert external data into a form the computer can understand
and can then process (e.g. keyboards, touch screens and microphones). Output devices show the
results of computer processing in a humanly understandable form (e.g. printers, monitors and
loudspeakers).
4.7 The fetch–execute cycle
“The process of fetching data and instructions, decoding it, and processing them is known as
fetch execution cycle.”
4.7.1 Fetch
In the fetch–execute cycle, the next instruction is fetched from the memory address
currently stored in the Program Counter (PC) and is then stored in the Current Instruction
Register (CIR). The PC is then incremented (increased by 1) so that the next instruction can
be processed.
4.7.2 Decode
The instruction in CIR is interpreted by Control Unit.
4.7.3 Execute
The processor passes the decoded instruction as a set of control signals to the
appropriate components within the computer system. This allows each instruction to be
carried out in its logical sequence.

Figure 7: Fetch Execute Cycle

14
Teacher’s Name: Akhtab Hussain

15

Potrebbero piacerti anche