01-ch1

advertisement
Princess Nora University
Faculty of Computer & Information Systems
Computer science Department
Operating Systems
(CS 340 D)
Dr. Abeer Mahmoud
(Chapter-1)
Introduction
Chapter 1 Introduction
1. What Operating Systems Do
2. Computer-System Organization
3. Computer-System Architecture
4. Operating-System Structure
3
Dr. Abeer Mahmoud
OBJECTIVES:
 To describe the basic organization of computer systems.
 To provide a grand tour of the major components of operating
systems.
 To give an overview of the many types of computing environments.
4
Dr. Abeer Mahmoud
What is an Operating
System?
5
Dr. Abeer Mahmoud
What is an Operating System?
6

A program that acts as an intermediary between a user of a
computer and the computer hardware

Operating system goals:

Execute user programs and make solving user problems
easier

Use the computer hardware in an efficient manner
Dr. Abeer Mahmoud
Operating System Functions






7
Process Management
Memory Management
File Management
Device Management
Command Interpretation
Security
Dr. Abeer Mahmoud
Computer System Structure

Consists of four components
1.
Hardware : provides basic computing resources (CPU, memory, I/O devices)
2.
Operating system: Controls and coordinates (use, hardware, applications)
3.
Application programs :
“define the ways in which the system resources are used to solve the computing
problems of the users”
ex: (Word processors, compilers, web browsers, database systems, video games)
4.
Users : People, machines, other computers
8
Dr. Abeer Mahmoud
Four Components of a Computer System
9
Dr. Abeer Mahmoud
The operating system’s Role
1- User View:
example
OS is designed to
Single User
personal computer
ease of use
Multiple User’s
mainframe l minicomputer
maximize resource utilization
Workstations users
connected to networks or
servers
compromise between individual
usability and resource utilization.
Handheld computers
Single user & may connected
to networks
individual usability and
performance per unit of
battery life is important as well.
Embedded computers
If the computers have little or run without user intervention
no user view
(minimize usability)
category
10
Dr. Abeer Mahmoud
The operating system’s Role (cont.)
2- System View:
OS is a resource allocator
• Manages all resources (e.g. CPU time,
memory space, file-storage space, I/O
devices…etc)
• Decides between conflicting requests
of many users access the same
mainframe or minicomputer
11
OS is a control program
• Controls execution of programs to
prevent errors
• It is especially concerned with the
operation and control of I/O devices.
Dr. Abeer Mahmoud
Operating System Definition

Operating System Definition:

It is a software that manage the computer hardware and provide an
environment for application programs to run

“The one program running at all times on the computer” is the
kernel.

Everything else is either a
system program
application program
12
Dr. Abeer Mahmoud
Computer-System
Organization
13
Dr. Abeer Mahmoud
Computer-System Organization
1. Computer-System Operation
2. Storage Structure
3. I/O Structure
14
Dr. Abeer Mahmoud
Computer System Organization
1-Computer-system operation

A general-purpose computer system consists of three main components
2- Multiple device controllers:
1-One or more CPU
15
connected through a common bus
3- RAM:
connecting to CPU and
device controllers through common bus
Dr. Abeer
Computer System Organization
1-Computer-system operation(cont..)

Each device controller is responsible of a specific type of device (e.g. disk
drives, audio devices, and video displays).

The CPU and the device controllers can execute concurrently, competing
for memory cycles .

So, a memory controller is provided whose function is to synchronize
access to the memory.
16
Dr. Abeer Mahmoud
Computer System Organization
1-Computer-system operation(cont..)
Computer Startup:

bootstrap program is loaded at power-up or reboot
 Typically stored in ROM or EEPROM, generally known as
firmware
 Initializes all aspects of system
 Loads operating system kernel and starts execution
ROM : read-only memory, Once data has been written onto a ROM chip,
it cannot be removed and can only be read.
EEPROM: electrically erasable programmable read-only memory.
EEPROM is a special type of PROM that can be
erased by exposing it to an electrical charge.
17
Dr. Abeer Mahmoud
Computer System Organization
1-Computer-system operation(cont..)
Interrupt:
 It generated from either the hardware or the software


Hardware  sending a signal to the CPU through system bus.
Software send through a system call.
The interrupt is signal that gets the attention of the CPU and is usually
generated when I/O is required.
For example:
• hardware interrupts are generated when a key is pressed or when the
mouse is moved.
• Software interrupts are generated by a program when I/O is required.
18
Dr. Abeer Mahmoud
Computer System Organization
2-Storage Structure



Main memory – only large storage media that the CPU can
access directly
Secondary storage – extension of main memory that
provides large nonvolatile storage capacity
Magnetic disks – rigid metal or glass platters covered with
magnetic recording material
 Disk surface is logically divided into tracks, which are
subdivided into sectors
 The disk controller determines the logical interaction
between the device and the computer
19
Dr. Abeer Mahmoud
Computer System Organization
2-Storage Structure(cont..)

All forms of memory provide an array of words. Each word
has its own address.

Interaction is achieved through a sequence of load or store
instructions to specific memory addresses.



The load instruction>>> moves a word from RAM to
CPU’s register
The store instruction>>> moves the content of a CPU’s
register to RAM
CPU automatically loads instructions from main memory for
execution.
20
Dr. Abeer Mahmoud
Computer System Organization
More expensive and faster
2-Storage Structure (cont..)
21
volatile
can be volatile
or non volatile
Nonvolatile
Dr. Abeer Mahmoud
Computer System Organization
3-I/O Structure

A large portion of OS code is dedicated to managing I/O,
because of:


22
Its importance to the reliability and performance of a
system
The varying nature of the devices.
Dr. Abeer Mahmoud
Computer System Organization
3-I/O Structure(cont..)

A device controller maintains some local buffer storage and
a set of special-purpose registers.

The device controller is responsible for moving the data
between the peripheral devices that it controls and its local
buffer storage.

Operating systems have a device driver for each device
controller. This device driver understands the device controller
23
Dr. Abeer Mahmoud
Computer System Organization
3-I/O Structure(cont..)
DC : Responsible for moving data between
Device
Controller (DC)
Peripherals devices
that it controls eg:
keyboard
Local buffer
storage
+
Set of special
purpose
registers
Understand
how?
OS
24
Device Driver
(DD)
Dr. Abeer Mahmoud
Computer System Organization
3-I/O Structure(cont..)

(Algorithm #1)

DD loads the appropriate registers within the DC

DC, examines the contents of these registers to determine what action to
take (such as “read “a character from the keyboard”).

DC transfers data from the device to its local buffer. When finish informs
DD via an interrupt

DD returns control to OS,

This form of interrupt-driven I/O is fine for moving small amounts of data
otherwise produce high overhead
25
Dr. Abeer Mahmoud
Computer System Organization
3-I/O Structure(cont..)

(Algorithm #2 moving large data without overhead)

What is direct memory access (DMA) ?
 After setting up buffers, pointers, and counters for the I/O device,

DC transfers an entire block of data directly to or from its own buffer
storage to memory, with no intervention by the CPU.

26
Only one interrupt is generated per block, to tell the device driver that
the operation has completed, rather than the one interrupt per byte
generated for low-speed devices.
Dr. Abeer Mahmoud
Computer-System
Architecture
27
Dr. Abeer Mahmoud
Computer-System Architecture

Single-processor systems :

MULTIPROCESSOR SYSTEMS
 Also known as parallel systems, tightly-coupled systems
 have two or more processors in close communication, sharing the
computer bus and some times the clock, memory, and peripheral
devices.
 Advantages include:
1. Increased throughput : more work is performed
2. Economy of scale : cost less
3. Increased reliability : the failure of one processor will not halt the
one CPU
system, only slow it down.
28
Dr. Abeer Mahmoud
Computer-System Architecture (cont..)

MULTIPROCESSOR SYSTEMS – (CONT.):
Asymmetric
Multiprocessing
o Each processor is assigned a
specific task.
o master-slave relationship
o A master processor controls
the system; It schedules and
allocates work to the slave
processors.
29
Symmetric Multiprocessing
(SMP)
o Each processor performs all tasks within
the operating system. (peer =equal rank)
o Each processor has its own set of
registers & cache
o All processors share physical memory.
Dr. Abeer Mahmoud
Symmetric Multiprocessing Architecture
30
Dr. Abeer Mahmoud
Computer-System Architecture (cont..)
 SMP

pros (++):
many processes can run simultaneously —N processes can run if there are N
CPUs—
 SMP Cons (--):



OS must carefully control I/O to ensure that the data reach the
appropriate processor.
since the CPUs are separate, one may be sitting idle while another is
overloaded, resulting in inefficiencies.
All modern operating systems—including Windows, Mac OS X,
and Linux—now provide support for SMP.
31
Dr. Abeer Mahmoud
Computer-System Architecture (cont..)
o
o
o

Processors were originally developed with only one core.
The core : is the part of the processor that actually performs the
reading and executing of the instruction.
Single-core processors can process only one instruction at a time
Multi-cores chips.
o
It is a recent trend in CPU design is to include multiple
computing cores on a single chip.
32
Dr. Abeer Mahmoud
A Dual-Core Design
oMulti-cores chips can be
more efficient than multiple
chips with single cores
because:
1.
Dual-core
processor contains two
cores (Such as Intel Core Duo).
Multi-core
systems are especially
suited for server systems such as
database and Web servers.
33
on-chip communication is
faster than between-chip
communication
2. one chip with multiple cores
uses significantly less power
than multiple single-core
chips.
Dr. Abeer Mahmoud
Operating System Structure
34
Dr. Abeer Mahmoud
Operating System Structure
– Single program cannot keep CPU and I/O devices busy at
all times
– Multiprogramming increases CPU utilization by organizing
jobs (code and data) so that the CPU always has one to
execute.
35
Dr. Abeer Mahmoud
Operating System Structure
Multiprogramming environment
– Multiprogramming idea is as follows:
1. The operating system keeps several
jobs in memory simultaneously .
2. One job selected and run via job
scheduling.
3. When it has to wait (for I/O for
example), OS switches to another
job
Time sharing (or multitasking) system:
o Multiple jobs are executed by switching
the CPU between them. frequently that
the users can interact with each program
while it is running.
o In this, the CPU time is shared by different
processes, so it is called as “Time sharing
Systems”.
o Time slice is defined by the OS, for sharing
CPU time between processes.
4. Eventually, the first job finishes
waiting and gets the CPU back.
o CPU is taken away from a running process
when the allotted time slice expires.
5. As long as at least one job needs to
execute, the CPU is never idle.
ex: Unix, etc.
36
Dr. Abeer Mahmoud
Memory Layout for Multiprogrammed System
– RAM is too small to accommodate
all jobs, the jobs are kept initially on
the disk in the job pool.
– This pool consists of all processes
residing on disk awaiting allocation of
main memory.
37
Dr. Abeer Mahmoud
Thank you
End of
Chapter 1
38
Dr. Abeer Mahmoud
Download