Top Banner
Faculty of Computers and Faculty of Computers and Information Information Second Year (Second Semester) Second Year (Second Semester) ______________________________ ______________________________ Operating Systems I Operating Systems I ______________________________ ______________________________ Dr. Ashraf Elsisi Dr. Ashraf Elsisi __________________________ __________________________
48

Lec 3

Feb 17, 2017

Download

Education

Mohamed Ali
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Lec 3

Faculty of Computers and Faculty of Computers and InformationInformation

Second Year (Second Semester) Second Year (Second Semester) ____________________________________________________________

Operating Systems IOperating Systems I

( )( )

____________________________________________________________

Dr. Ashraf ElsisiDr. Ashraf Elsisi____________________________________________________

Page 2: Lec 3

Computer Hardware Basics

• What are the meanings of the following terms?g g

1. 32-bit microprocessor, and 32-bit instructions. p ,2. Opcode, immediate operand, and operand address.3. Local data bus, and local address bus.3. Local data bus, and local address bus.4. Machine cycle, processor cycle, and bus cycle.

Page 3: Lec 3

It refers to the number of bits that can be processedor transmitted in parallel, or the number of bits usedfor single element in a data format.

Th titi th t ll difi d b thThe entities that are usually modified by thesenumbers are:

•BusBus•Microprocessor•Software •Operating system

Page 4: Lec 3
Page 5: Lec 3

Opcode operand and addressing modeOpcode, operand, and addressing mode

A hi i i i d f d d• A machine instruction is made up of an opcode andone or more operands.

• The opcode tells the processor what action top pperform over the following operands.

• The methods for specify the operand(s) for a machinei t ti ll d dd i dinstruction are called addressing modes.

Page 6: Lec 3
Page 7: Lec 3
Page 8: Lec 3

BusA bus is a collection of wires through which datais transmitted from one part of a computer to

thanother.

According to the type of data transmitted through the g yp gbus, we have:

b h b d l d• Data bus: The bus used to carry actual data.•Address bus: The bus transferring informationabout where the data should goabout where the data should go.•Control bus: The physical connections that carrycontrol information between the CPU and otherdevices within the computer.

Page 9: Lec 3

According to the location of buses, or what kinds ofcomponents they connect, we have:p y ,

Local bus:Local bus:

Another name of system bus, which connects themicroprocessor main memory and all kinds of I/Omicroprocessor, main memory, and all kinds of I/Omodules.

A local bus is also called frontside bus, memory bus, or, y ,host bus.

Page 10: Lec 3

Backside bus:

A microprocessor bus that connects the CPU to a Level 2cache.

Typically, a backside bus runs at a faster clock speed thanthe frontside

External bus:

A bus that connects a computer to peripheral devices.

Page 11: Lec 3
Page 12: Lec 3
Page 13: Lec 3
Page 14: Lec 3

S dSpeeds• System clockThere are so many circuits inside a computerThere are so many circuits inside a computer.

To perform a specific action, it is necessary forp p ysome sort of synchronization to occur so thatdifferent parts function and cooperate as expected.

The”conductor” of the PC is the system clock,which brings synchronizationwhich brings synchronization.

A clock is just a signal that alternates between zeroj gand one, back and forth.

Page 15: Lec 3

The pulses generated by the clockThe pulses generated by the clock

Page 16: Lec 3

Memory Access time:also known as response time or latency refers to howquickly the memory can respond to a read or write

trequest.

•Memory cycle:Memory cycle: refers to the minimum period between two successive requests. q

For various reasons the time separating two successive i l 0 i i hrequests is not always 0, i.e a memory with a response

time of 80 ns cannot satisfy a request every 80 ns.

Page 17: Lec 3

Machine cycle:Machine cycle:

also called instruction cycle, the four steps which theCPU i t f h hi lCPU carries out for each machine languageinstruction: fetch, decode, execute, and store.

Page 18: Lec 3

CachesCachesLevel 1 (Primary) Cache:•The fastest memory on the PC.y•It is in fact, built directly into the processor itself.•This cache is very small, generally from 8 KB to 64KB, but it is extremely fast; it runs at the same speed asthe processor.

If the processor requests information and can find it inthe level 1 cache, that is the best case, because thethe level 1 cache, that is the best case, because theinformation is there immediately and the system doesnot have to wait.

Page 19: Lec 3

Level 2 (Secondary) Cache:Level 2 (Secondary) Cache:

The level 2 cache is a secondary cache to the level 1 h d i l d li htl lcache, and is larger and slightly slower.

Page 20: Lec 3

Name some OS’sName some OS s• Linux • PalmOS• Unix• Windows

• TinyOS• WinCEW dows

• Multics• BSDUnix

W C• Spring• 2KBSDUnix

• Mac/Tiger• Vista

2K• ….

• Vista

Page 21: Lec 3

MulticoreMulticore

• A multicore computer, also known as a chipA multicore computer, also known as a chipmultiprocessor , combines two or moreprocessors (called cores) on a single piece ofp ocesso s (ca ed co es) o a s g e p ece osilicon (called a die).

• Typically, each core consists of all of thet f i d d t hcomponents of an independent processor, such

as registers, ALU, pipeline hardware, andcontrol nit pl s L1 instr ction and data cachescontrol unit, plus L1 instruction and data caches.

Page 22: Lec 3

• Virtualization– enables a single PC or server to simultaneously run

l i l i l i l i fmultiple operating systems or multiple sessions of a single OS

– a machine can host numerous applications, includinga machine can host numerous applications, including those that run on different operating systems, on a single platformh t ti t t b– host operating system can support a number of virtual machines (VM)

– each has the characteristics of a particular OSeach has the characteristics of a particular OS

Page 23: Lec 3

Virtual Virtual MemoryMemoryMemory Memory ConceptConcept

Page 24: Lec 3

Process perspective:Process perspective:

• the machine on which it executes consists of the virtual memory space assigned to the process

• the processor registers it may use• the user-level machine instructions it may execute• OS system calls it may invoke for I/O• ABI defines the machine as seen by a process

Application perspective:Application perspective:

• machine characteristics are specified by high-level language capabilities and OS system library calls

• API defines the machine for an application

Application perspective:Application perspective:

• processes share a file system and other I/O resources

OS perspective:OS perspective:

• system allocates real memory and I/O resources to the processes• ISA provides the interface between the system and machine

Page 25: Lec 3

Process and System Virtual MachinesProcess and System Virtual MachinesProcess and System Virtual MachinesProcess and System Virtual Machines

Page 26: Lec 3

Process and System Virtual MachinesProcess and System Virtual MachinesProcess and System Virtual MachinesProcess and System Virtual Machines

Page 27: Lec 3
Page 28: Lec 3

•What is the meaning of installation?(Installation program)(Installation program)

•Why we are using installation?Wh t f i ll i ?•What are types of installations?

•What are Device drivers?

•List programs in system tools in Win7?•List programs in system tools in Win7?

Page 29: Lec 3

Chapter 3 Process Concept and State

Page 30: Lec 3

Major Requirements of an Operating SSystem

• Interleave the execution of several jobs toInterleave the execution of several jobs tomaximize processor utilization whileproviding reasonable response timep ov d g easonable espo se t e

All t t• Allocate resources to processes

• Support interjobs communication and user creation of processes (jobs)

Page 31: Lec 3

Process

• Textbook uses the terms job and process almost interchangeablyinterchangeably

• Process a program in execution;• Process – a program in execution; process execution must progress in sequential fashion

• A process includes:– program counterprogram counter – stack– data section

Page 32: Lec 3

It is programswitches theswitches theprocessor from oneprocess to another

Page 33: Lec 3

Traces of processes

Page 34: Lec 3

Two-State Process ModelTwo State Process Model

• Process may be in one of two statesProcess may be in one of two states– Running– Not-runningNot running

Page 35: Lec 3

Not-Running Process in a QQueue

Page 36: Lec 3

Process CreationProcess Creation• When a new process, OS builds the data

structures that are used to manage the processstructures that are used to manage the process.• Reasons for process creation

– Submission of a batch job– User logs on– Created to provide a service such as printingp p g– Process creates another process (spawning)

[parent – child]

Page 37: Lec 3

Process TerminationProcess Termination

• Any computer system must provide a meansAny computer system must provide a means for a process to indicate its completion.

• Batch job issues Halt instruction (call for• Batch job issues Halt instruction (call for termination) U l ff• User logs off

• Quit an application• Error and fault conditions

Page 38: Lec 3

Reasons for Process TerminationReasons for Process Termination• Normal completion

Ti li it d d• Time limit exceeded• Memory unavailable• Protection error• Protection error

– example write to read-only file• Arithmetic errorArithmetic error• When a process finishes, the operating system

will free the memory space it occupies andy p premove the data structures it allocated tomanage the process.

Page 39: Lec 3

A fi t t d lA five-state model

Page 40: Lec 3

• As a process executes, it changes statep , grunning: Instructions are being executed

new: The process is being created

waiting: The process is waiting for some event to occur

ready: The process is waiting to be assigned to a process

terminated: The process has finished executionterminated: The process has finished execution

Page 41: Lec 3

• RunningRunning• Ready

Bl k dNot running

• Blocked• New• Exit

Page 42: Lec 3
Page 43: Lec 3
Page 44: Lec 3

Using Two QueuesUsing Two Queues

Page 45: Lec 3
Page 46: Lec 3

Process swapping and Suspended PProcesses

• Processor is faster than I/O so all processesProcessor is faster than I/O so all processes could be waiting for I/O

• Swap these processes to disk to free up moreSwap these processes to disk to free up more memory

• Blocked state becomes suspend state whenBlocked state becomes suspend state when swapped to disk

• Two new statesTwo new states– Blocked, suspend (in secondary memory)– Ready, suspend in (secondary memory)y, p ( y y)

Page 47: Lec 3

One Suspend StateOne Suspend State

Page 48: Lec 3

Two Suspend StatesTwo Suspend States