32
Faculty of Computers and Informati on Secon d Year (Second Semester) Operati ng Systems I Dr. Ashraf Elsisi

Lec 1

Embed Size (px)

Citation preview

Page 1: Lec 1

Faculty of Computers andInformation

Second Year (Second Semester)

Operating Systems I

Dr. Ashraf Elsisi

Page 2: Lec 1

Textbooks

- Operating Systems – Internals And Design7thPrinciples– Edition

8th -Operating system concepts

-Windows® 7 Resource Kit

-Galvin

-Windows-powershell-cookbook-the-complete-guide-to-scripting-microsofts-command-shell

Additional Reading:

Tanenbaum - Modern Operating Systems

………

Page 3: Lec 1

Course Description

The purpose of the course is to understand thegeneral concepts of operating systems.

The course introduces:

•Computer•Operating

System,System (Process, Threads,

Concurrency, scheduling, Memory Management)

If we have time, Deadlock

Page 4: Lec 1

Prerequisites

Introductory course in Theory of systems, Programmingskills, Logic Systems, Computer Architecture, …

Homework + LabHomework will be assigned weekly.

Note late homework will not be accepted.

ExaminationAt least one-hour midterm exam is

tentativelyscheduled for

week seven of the quarter. The actual data for the exam will bedetermined by the progress in the course.

Page 5: Lec 1

Grading

• The composition of the final grade is:

• Homework + Lab + Midterm Exam 40%

• Final Exam 60%

Page 6: Lec 1

Computer System Overview

CHAPTER 1

Page 7: Lec 1

1. What is operating system?

• Exploits the hardware resources of oneor more processors

• Provides a set of services to system users

• Manages secondary memory and I/Odevices

Page 8: Lec 1

2. Computer hardware overview••

ProcessorMain Memory

– referred to as real memory or– volatile

I/O modules

primary memory

•–––

secondary memory devicescommunications equipment

terminals• System bus

– communication among processors, memory, andI/O modules

Page 9: Lec 1

Computer System

Page 10: Lec 1

Computer Components

Page 11: Lec 1

Computer Components

Page 12: Lec 1

RegistersThe component that performs computation is CPU, or more concretely it is the ALU (arithmetic logical unit) in CPU

that do the computation.

• To compute, we need first prepare input; however ALUcannot access memory directly, Instead, a set of

registersare provided as a cache that is smaller than main memory.

faster but

• )They are smaller between they are much moreexpensive than regular memory(.

Page 13: Lec 1

Processor RegistersThe textbook reference categorizes

registers two types:User-visible registers

– Enable programmer to minimize main-memory references by optimizing register use

Control and status registers– Used by processor to control operating of the

processor– Used by operating-system routines to control the

execution of programs

• into

Page 14: Lec 1

User-Visible RegistersMay be referenced by machine

languageAvailable to all programs - application

programs and system programsTypes of registers

– Data– Address

••

•••

IndexStack Segment

Stack pointerSSSP

Page 15: Lec 1

• Address Registers– Index

• involves adding an index to a base value to an address

Segment pointer• when memory is divided into segments,

memory is referenced by a segment and an offset

Stack pointer• points to top of stack

get

Page 16: Lec 1

Control and Status RegistersProgram Counter (PC)

– Contains the address of an instruction to be fetched

Instruction Register (IR)– Contains the instruction most recently fetched

Program Status Word (PSW)

•–––

condition codesInterrupt enable/disable

Supervisor/user mode

Page 17: Lec 1

Instruction RegisterFetched instruction is placed in the instruction• register.

Types of instructions:– Processor-memory

• transfer data between processor and memory

Processor-I/O • data transferred to or from a peripheral

device

Data processing • arithmetic or logic operation on data

Control • alter sequence of execution

Page 18: Lec 1

• Condition Codes or Flags– Bits set by the processor hardware as a

result of operations– Can be accessed

alteredExamples

by a program but not

–••••

positive resultnegative result

zeroOverflow

Page 19: Lec 1

2.3 Instruction execution

Page 20: Lec 1

Instruction Fetch and Execute

• The processor fetches the instruction frommemory

• Program counter )PC( holds address of theinstruction to be fetched next

• Program counter is incremented after each fetch

Page 21: Lec 1

Example of Program Execution

How a partial program istwo numbers.

executed step by step to add

Instructionoperand.(

consists of from two parts )opcode,

Opcode: 1 Load, 2 Store, 5 Add

Operand: Data, Address,

Page 22: Lec 1

Example of Program Execution

Page 23: Lec 1

Example of Program Execution

Page 24: Lec 1

Example of Program Execution

Page 25: Lec 1

Example of Program Execution

Page 26: Lec 1

Example of Program Execution

Page 27: Lec 1

Example of Program Execution

Page 28: Lec 1

Interrupts• An interruption of the normal sequence of

executionImproves processing efficiency•

• Allows the processor toI/O

executeoperation

otherinstructions

progresswhile an is in

• A suspension of a process caused by an eventexternal to that process and performed in such

a way that the process can be resumed

Page 29: Lec 1

Classes of Interrupts

Program•––––

arithmetic overflowdivision by zero

execute illegal instruction reference outside user’s memory space

•••

TimerI/O

Hardware failure

Page 30: Lec 1

I/O processing with interrupts)Interrupt Handler(

A program that determines nature of the interrupt and performs whatever actions are

needed.

• Control is transferred to this program

• Generally part of the operating system

Page 31: Lec 1

Interrupt Cycle

Page 32: Lec 1

Interrupt Cycle

Processor checks for interrupts•

• If no interrupts fetch the next instruction forthe current program

• If an interrupt is pending, suspend executionof the current program, and execute theinterrupt handler