Download Dr. Abeer Mahmoud

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Process management (computing) wikipedia , lookup

Distributed operating system wikipedia , lookup

VS/9 wikipedia , lookup

CP/M wikipedia , lookup

Transcript
Princess Nora University
Faculty of Computer & Information Systems
Computer science Department
Operating Systems
(CS 340 D)
Dr. Abeer Mahmoud
Course
Title: Operating Systems
Code : CS 340 D
Prerequisites: CS 212 D
Credits: lecture 3 + 1 lab = 3




2
Dr. Abeer Mahmoud
Topics

This course will introduce you to the field of Operating
Systems

Main topics which will be covered:




3
Introduction to Operating systems.
Processes
Threads
CPU Scheduling Process
Dr. Abeer Mahmoud
Topics
Main topics which will be covered (cont..) :









4
Process Synchronization
Deadlocks
Memory Management
Virtual Memory
File-System Interface
File-System Implementation
I/O Systems
Mass-Storage Structure
Dr. Abeer Mahmoud
Goals

By the end of the course the students should be able to:

Explain the objectives and functions of the operating systems.

Identify the notion of a process, and a program in execution.

Describe the notion of a thread, CPU Scheduling and deadlocks

Analyze and evaluate various Scheduling algorithms

Explain the function of file systems.

Discuss the benefits of various memory-management techniques, including
paging and segmentation.

Describe the benefits of a virtual memory system and the physical structure
of secondary storage devices
5
Dr. Abeer Mahmoud
Books and references:
Main Text Book:

“OPERATING SYSTEM CONCEPTS“,
by Abraham Silberschatz and Wesley.Edition, Addison 8th Peter Galvin,
• “ OPERATING SYSTEMS: A DESIGNORIENTED APPROACH”, by Charles
Crowley, The Latest Edition ,McGraw-Hill,
ISBN: 0256151512.
• “OPERATING SYSTEMS: DESIGN AND
IMPLEMENTATION”, by Andrew S.
Tanenbaum, Albert S. Woodhull , 2006.
6
Dr. Abeer Mahmoud
Resources

7
Course Blog:
http://www.
Dr. Abeer Mahmoud
Marks Distribution
Assessment method
(Write an essay - test - a
collective project - a final test ...)
Assessment
Week
1st Med Term
7th week
2nd Med Term
12th week
quiz
(Lab)
Final exam (Theory) “Two academic
hours“.
Total
Grade
Percentage
from overall
grade
15
15
10
week Assignments 2rd,
4th, 6th , 8th and 10th +
Attendance
exam
10
15%
15%
10%
10%
10
10%
After 15
40
40
100
100
9th week
- Marks distribution is not final and is subject to change.
8
Dr. Abeer Mahmoud
Course Policy
NO makeup quizzes.
 NO midterm makeup exams unless:

You must bring a medical excuses from
a government hospital.
+ agree on the excuse from department
+ agree on the excuse from course coordinator
9
Dr. Abeer Mahmoud
Course Policy (cont..)

Assignments must be completed individually unless
specified otherwise.


10
If groups are permitted, each student should team
up with students from the same tutorial section.
Cheating is forbidden. Both parties will be
penalized in Minus.
Dr. Abeer Mahmoud
Course Policy (cont..)

Email Communication: Anonymous emails will be ignored.
When you send an email, you should use your PNU account
and make sure to put “OS 340D " in the subject line and
identify yourself with your group code and Student
ID in the email message (body).
Late submissions of any course material is not allowed.


It is your responsibility to check the course’s website
regularly for any assignments, announcements, etc..
11
Dr. Abeer Mahmoud
Thank you
Enjoy the Course
& never forget to smile

12
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
5. Operating-System Operations
6. Process Management
7. Memory Management
8. Storage Management
14
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.
15
Dr. Abeer Mahmoud
What is an Operating System?
16

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
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
17
Dr. Abeer Mahmoud
Four Components of a Computer System
18
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
19
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
20
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
21
Dr. Abeer Mahmoud
Computer-System Organization
1. Computer-System Operation
2. Storage Structure
3. I/O Structure
22
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
23
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.
24
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.
EEPROM retains its contents even when the power is turned off.
25
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.
26
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
27
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.
28
Dr. Abeer Mahmoud
Computer System Organization
More expensive and faster
2-Storage Structure (cont..)
29
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:


30
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
31
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
32
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
33
Dr. Abeer Mahmoud
Computer System Organization
3-I/O Structure(cont..)

(Algorithm #2 moving large data without overhead)

34
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.

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.

While the device controller is performing these operations, the CPU is
available to accomplish other work.
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.
35
Dr. Abeer Mahmoud
Computer-System Architecture (cont..)

MULTIPROCESSOR SYSTEMS – (CONT.):

36
Two types
1. Asymmetric Multiprocessing
 Each processor is assigned a specific task.
 master-slave relationship
 A master processor controls the system; It schedules
and allocates work to the slave processors.
2. Symmetric Multiprocessing (SMP)
 Each processor performs all tasks within the operating
system.
 All CPUs are peers
 Each processor has its own set of registers & cache
 All processors share physical memory.
Dr. Abeer Mahmoud
Symmetric Multiprocessing Architecture
37
Dr. Abeer Mahmoud
Computer-System Architecture (cont..)
SMP pros (++):
 many processes can run simultaneously —N processes can run if
there are N CPUs—without causing a significant deterioration
of performance
 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.

38
Dr. Abeer Mahmoud
Computer-System Architecture (cont..)

Multi-cores chips.





It is a recent trend in CPU design is to include multiple
computing cores on a single chip.
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 only process one instruction at
a time
Multi-cores chips can be more efficient than multiple chips
with single cores because:


39
on-chip communication is faster than between-chip communication
one chip with multiple cores uses significantly less power than multiple singlecore chips.
Dr. Abeer Mahmoud
A Dual-Core Design

Dual-core processor contains two cores (Such as Intel Core Duo).

Multi-core systems are especially well suited for server systems such as
database and Web servers.
40
Dr. Abeer Mahmoud
Operating System Structure
1- Multiprogramming environment:
 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.
 Multiprogramming idea is as follows:







The operating system keeps several jobs in memory simultaneously .
One job selected and run via job scheduling.
When it has to wait (for I/O for example), OS switches to another job
Eventually, the first job finishes waiting and gets the CPU back.
As long as at least one job needs to execute, the CPU is never idle.
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.
41
Dr. Abeer Mahmoud
Memory Layout for Multiprogrammed System
42
Dr. Abeer Mahmoud
Operating System Structure( cont..)
2-Time sharing (or multitasking) system:




It is a logical extension of multiprogramming.
In time-sharing systems, the CPU executes multiple jobs by switching
among them, but the switches occur so frequently that the users can
interact with each program while it is running.
Time sharing requires an interactive computer system
The response time should be short ( less than one second)
amount of time it takes from
when a request was submitted
until the first response is
produced.
43
system that provides direct
communication between the
user and the system.
Dr. Abeer Mahmoud
Operating System Structure( cont..)

A time-shared operating system allows many users to share
the computer simultaneously. each user is given the impression
that the entire computer system is dedicated to his use.

Each user has at least one separate program in memory.

A process : is a program loaded into memory and executing
44
Dr. Abeer Mahmoud
Thank you
End of
Chapter 1
45
Dr. Abeer Mahmoud