Pipeline Summary Pi li i i f

advertisement
Pipeline Summary
 Pi
Pipelining
li i improves
i
performance
f
bby iincreasing
i
instruction throughput
Datorarkitektur och operativsystem
 Executes multiple instructions in parallel
Lecture 6
 Each instruction has the same latency
 Subject to hazards
 Structure, data, control
 Instruction set design affects complexity of
pipeline implementation (p.335)
1
Recap: Hazards
 Situations that prevent starting the next instruction
in the next cycle
 Structure
S
hazards
h
d
 A required resource is busy
 Data hazard
 Need to wait for previous instruction to complete
its data read/write
 Control hazard
 Deciding on control action depends on previous
i t ti
instruction
Chapter 4 — The Processor — 3
Chapter 4 — The
Processor — 2
Components of a Computer
Operating Systems
Topics to be covered
 Before proceeding to learn about memory and I/O
(Input/Output), let us get introduced to Operating
System Why?
System.
 What is an operating system?
 Peek at the history of operating system
 Learn the fundamental operating system
concepts
6
Operating System
versus
Applications
Operating
p
g System
y
(OS)
( )
 What are the features provided by an OS ?
 Both
B th are programs, so what
h t is
i the
th difference?
diff
?
7
8
Operating System
versus
Applications
Operating System vs Applications
 Both
B th are programs, so what
h t is
i the
th difference?
diff
?
ISA:
Processor:
 We need to understand the difference
between an end-user
end user and a programmer
 A computer system consists of
 hardware
 system programs
 application programs
9
Operating System (OS) vs
System Programs
10
What is an Operating
p
g System
y
?
 Compilers
Compilers, editors … are not part of the
OS even if they are bundled together
 OS is only that part of the software that
p
mode,
runs in kernel/supervisor
Extended
Extended machine:
 like the clock interrupt handlers
 Note: lines may be blurred
 E.g., in embedded systems. Old embedded
 It is an extended machine
systems had no OS.
 No p
precise definition for OS – it is rather a
collection of concepts
 Hides the messy details which must be performed
 Presents
P
user with
i h a virtual
i
l machine,
hi easier
i to use
11
12
What is an Operating
p
g System
y
?
Resource management
g
 Resources:
 Processor time, Printer, Memory, Hard Disk
 Time sharing
 If one program runs on a processor long enough,
schedule another one
 Printer : schedule them one by one and not one
within each other
Resource Manager:
 Space sharing
 It is a resource manager
 Main
M i memory is
i divided
di id d among severall programs
 Each program gets time with the resource
 Disks…
 Each program gets space on the resource
13
14
History
y of Operating
p
g Systems
y
Batch Processing
g
We will look only at some major points in
history, mostly with a focus on the underlying
principles
i i l
Early batch system




15
bring cards to IBM1401
IBM1401 reads cards onto tape
Put tape on IBM 7094 which does computing
putt ttape on IBM 1401 which
hi h prints
i t output
t t
16
History
y of Operating
p
g Systems
y
Drawback of Batch Processing
 CPU bound versus I/O bound
 CPU-bound scientific calculation p
programs
g
are OK
 But I/O wait time can be over 80% in commercial
computations – meaning time between submitting a
job and getting a result can be several hours
• If a single comma makes a compilation to fail,
fail
programmer loses half a day!
 SStructure off a typical
i l Fotran
F
M i
Monitor
System
S
job
j b (a
( program or a
set of programs)
17
18
Timesharing (Multiprogramming)
UNIX
 Timesharing - switch CPU among jobs for prepre
defined time interval
 The CPU can provide interactive service to several
users and also work on big batch jobs when it is
otherwise idle
 Most O.S.
O S issues arise from trying to support
multiprogramming –
 An elegant timesharing system to follow CTTS
 Became popular in academic world,
government agencies and some companies
 CPU scheduling
scheduling, deadlock
deadlock, protection
protection, memory
management, virtual memory …
 CTSS (Compatible
(C
tibl Ti
Time Sh
Sharing
i SSystem)
t ) ffrom MIT
19
20
UNIX
UNIX
 Ken Thompson
p
and Dennis M.
Ritchie
 Turing award (“Nobel prize for
computer science
science”)), 1983
 Source code was widely available,
 Various organizations
g
developed
p their own
versions
 This led to chaos!
 For their development of generic
operating systems theory and
specifically for the implementation
of the UNIX operating system
 Also
 Ken Thompson developed C at
Bell Labs and Go at Google Inc.
 Dennis M. Ritchie developed
p C at
Bell Labs
21
22
Berkeley Software Distribution
From At&T
Apple
23
24
Linux
DOS
 Linus Benedict Torvalds, born 1969, Finland
 IBM
IBM, in 1980s,
1980s inspired by Apple IIII, made their
own PC
 They wanted software to run on it and asked
p y for
Bill Gates’ small company
recommendations on OS
 He didn
didn’tt have one but bought ‘Quick
Quick and
Dirty Operating System’ from another small
S
Seattle
l bbased
d company, re-tooled
l d it, and
d sold
ld
MS-DOS (Microsoft Disk Operating System)
 The popularity of the PC led to a desire for a
UNIX that ran on it. Many tried, but the most
successful was written from scratch in 1991 by
Linus Torvalds.
 In addition to making the source code available,
like BSD, he allowed everyone to make changes
and submit them for inclusion in his next release.
release
Linux popularized open source development as
we know it today, with such software getting
hundreds of volunteers to test releases and add
new features.
25
DOS
26
GUI
 No protection, no processes, and no virtual
memoryy
 Targeted for single user
 From Stanford Research Institute to Xerox
pp Macintosh to
Palo Alto Research Lab to Apple
Windows …
 Windows from 85 to 95, was GUI on top of
DOS
27
28
Windows
Others
 Apple: iOS (Unix based, derived from OS X)
 Google: Android (Linux based)
29
The Operating
p
g System
y
Zoo
30
The Operating
p
g System
y
Zoo
 Desktop computers
 The 3 classes of computers ?
 OS X,
X Wi
Windows
d
77, Ubuntu
Ub t (Linux
(Li
bbased)
d)
 from lecture 1
 Server
S
computers
 Unix, Windows Server 2012, Mac OS X Server
 Embedded computers
 Android, iOS
 Real-time operating systems like QNX,VxWorks
 What about Chrome OS?
31
32
 Compared to Desktop OS, server OS must
p
provide
 Embedded system OS must
 Run on restricted resources such as power,
p
,
energy, memory, …
 Might have real-time deadlines
 Tight system security with advanced memory
protection
 Manage network resources
 But sometimes lines are blurred between the
p and embedded
server, desktop
33
What does the OS do? /
Operating System Concepts




34
Process Management
 A process is a program in execution
Process management
File system
Security (Process/Memory protection)
Memory management
 In a timesharing or multi-tasking operating
systems several processes are interleaved –
systems,
an illusion of parallelism
 Chapter 5 of textbook
 A scheduler makes the decision – which
process must be assigned to the processor
process must be waitingg
and which p
 Input
p /Output
p
 Chapter 6 of textbook
35
36
The 5 State Process Model
Execution States of a Process
 In a multi-tasking scenario, a process
Terminated
New
 is sometimes running
g (because
(
another pprocess
admit
d it
is running), but is ready to run
create
 is interrupted by the Operating System
switch: schedule new job
Ready
scheduler while it is runningg
exit
Running
switch: preempt
 Thus
Thus, each process has a ‘state’
state , i.e.,
ie
information that tells us the status of the
process
Blocked
37
38
Process States
 N
New: new process created,
d may stillll be
b under
d
initialization, not yet ready
 Ready: process is waiting to run
 Running:
gp
process beingg executed on CPU (makes
(
progress on its timeline)
 Blocked: process waiting (sleeping) for event –
cannot execute until event is available
 Terminated: process is finished,
finished may require OS
cleanup
 A data structure called Process Control Block
contains the information related to state and
other necessary data for execution
 There are several scheduling policies and they
influence the performance
39
40
File system management
Security management
 How
H
keep
k
trackk on allll bits?
b ?
 OS is responsible for managing system
securityy
 UNIX provides protection codes (9 bits) for
each file
 Typically, you cannot address an individual bit
(overhead becomes too large).
 Hence, data is organized into files and directories
by the operating system
 Examples: File Allocation Table (FAT), New
Technology File System (NTFS)
 The administrator can specify permissions for
owner, the owner’s group, and everyone else
 The permission can be related to read, write or
execute
 Operating
p
g system
y
provides
p
the services to
open files, close files, and other operations
p g
makingg life easier for the programmers
41
System Call
42
Steps in Making a System Call
 System calls provide the interface between
the OS and the user programs
 If an instruction, in a program, makes a system call
like read/write to files or create a new process,
control is transferred to the OS
 A processor can execute a single instruction
at a time
 OS executes the system call based on the
parameters received from the user program and
returns control to instruction following the system
call
43
44
Some System Calls For Process
Management
Some System Calls For File Management
45
Some System Calls For Directory
Management
46
Some System Calls For Miscellaneous Tasks
47
48
References for Operating Systems
 Parts of today’s lecture taken from Chapter 1
p
g Systems
y
byy Andrew S.
of Modern Operating
Tanenbaum
 This book is not included in compulsory reading
for the exam
 Slides
Slid from
f
this
thi lecture
l t
are sufficient
ffi i t for
f exam
49
49
Download