Operating Systems Unit 8: – Virtual Memory management Operating Systems.
SMD149 - Operating Systems · Operating Systems Hardware and Software Concepts Summary SMD149 ......
Transcript of SMD149 - Operating Systems · Operating Systems Hardware and Software Concepts Summary SMD149 ......
IntroductionOperating Systems
Hardware and Software ConceptsSummary
SMD149 - Operating Systems
Roland Parviainen
October 31, 2005
1 / 54
IntroductionOperating Systems
Hardware and Software ConceptsSummary
OverviewCourse Information
Roland Parviainen
E-mail: [email protected], [email protected]
Phone: 070-5317170
Office: ?Web: http://parviainen.org
2 / 54
IntroductionOperating Systems
Hardware and Software ConceptsSummary
OverviewCourse Information
Outline
Introduction to the course
Introduction to Operating systems and a brief history
Hardware and software concepts
Summary
3 / 54
IntroductionOperating Systems
Hardware and Software ConceptsSummary
OverviewCourse Information
Course Objectives
Fundamental course in systems programming and operating systems(theory and development)
By the end of this course, you should
Have gained an understanding of the evolution and purpose of anoperating systemBe able to describe the key elements of an operating system andtheir functionalities and interdependencesHave learnt the significance of application programming interface(API)Have gained hands-on experience in implementing some OSfunctionalities
4 / 54
IntroductionOperating Systems
Hardware and Software ConceptsSummary
OverviewCourse Information
Course Information
Prerequisites
SMD135 Program and data structures
SMD137 Computer organization and logic design
SMD138 Real-time systems
Course textbook
Operating Systems by H. M. Deitel, P. J. Deitel and D. R. Choffnes,Prentice Hall Publication, 3rd edition, 2004 (ISBN: 0131246968)
Available at Bokis (680 kr)
Other modern Operating Systems books should work as well
http://www.sm.luth.se/csee/courses/smd/149/
Home work assignments, labs, news, slides, etc.
5 / 54
IntroductionOperating Systems
Hardware and Software ConceptsSummary
OverviewCourse Information
Course Structure
Modules
Theoretical
IntroductionProcesses and ThreadsPhysical and Virtual MemorySecondary Storage and File SystemsProcessors: Performance and ManagementNetworking and Distributed ComputingSecurity Issues
Laborations
Systems programming (C/Unix) and Operating systemsprogramming (Java/Nachos)
6 / 54
IntroductionOperating Systems
Hardware and Software ConceptsSummary
OverviewCourse Information
Lectures and labs
15 scheduled, but only 14 will be used
2 lectures will cover laborations (systems programming, nachos)
10 scheduled labos
7 / 54
IntroductionOperating Systems
Hardware and Software ConceptsSummary
OverviewCourse Information
Examination and grading
No final exam
Continuous examinationFive homework assignments (each worth 40 points)
You will generally have one week per homeworkLate submissions will NOT be gradedRedo or repair of assignments is not permitted; exception: if youneed 10 points or less to pass the course
Three lab assignments (each worth 100 points)
You will will generally have two weeks per labLate submission can only get a maximum of “pass grade”Submissions after LP-2 (2005/06) ends will NOT be graded
8 / 54
IntroductionOperating Systems
Hardware and Software ConceptsSummary
OverviewCourse Information
Examination and grading
Maximum achievable number of points in the course is 500 (200theoretical + 300 laborations)
To pass the course (i.e., grade ’3’), you need to have passed boththe theoretical and practical parts of the course
At least 100 points to pass the theory partAt least 150 points to pass the laborations part
Grade ’4’ - at least 325 points and passed both parts
Grade ’5’ - at least 400 points and passed both parts
9 / 54
IntroductionOperating Systems
Hardware and Software ConceptsSummary
IntroductionHistoryArchitectures
Operating systems
What is an operating system
“The software that controls the hardware”
“...all the software that is required in order for the user to managethe system and to run third-party application software for thatsystem.”
“In computing, an operating system (OS) is the system softwareresponsible for the direct control and management of hardware andbasic system operations. Additionally, it provides a foundation uponwhich to run application software such as word processing programsand web browsers.”
Resource manager
10 / 54
IntroductionOperating Systems
Hardware and Software ConceptsSummary
IntroductionHistoryArchitectures
Operating systems
Components
Kernel
Shell
Core components
Often in the kernel:
Processor scheduler
Memory manager
I/O manager
Interprocess communication (IPC) manager
File system manager
11 / 54
IntroductionOperating Systems
Hardware and Software ConceptsSummary
IntroductionHistoryArchitectures
Operating systems
What is part of an operating system
Kernel, Shells, Software Libraries, Application Programs, GUIs?
Controversy
United States v. Microsoft antitrust trials
GNU/Linux naming controversy
12 / 54
IntroductionOperating Systems
Hardware and Software ConceptsSummary
IntroductionHistoryArchitectures
Brief history
40s and 50s
Early computers had no operating system
Single job at a time
Faster computers - job switching overhead increased
Single stream batch-processing systems
Programs and data submitted at the same time
Machine operators, not users, handled computers
Replaced by operating systems...
13 / 54
IntroductionOperating Systems
Hardware and Software ConceptsSummary
IntroductionHistoryArchitectures
60s
Several jobs at a time
I/O bound and processour bound jobs
Multiprogramming
1964: System/360 with OS/360 from IBM (later MFT, MVT, SVS,MVS, MVS/XA, MVS/ESA, OS/390 and z/OS)
Interactive users
Timesharing
Real-time systems
response in bounded time periods
CTSS (Compatible time-sharing system), TSS (Time-sharingsystem), Multics, CP/CMS (Control program/ConversationalMonitor System)
14 / 54
IntroductionOperating Systems
Hardware and Software ConceptsSummary
IntroductionHistoryArchitectures
60s
Multics
Developed using CTSSHigh level languageHardware: 400-1000 KMIPSPartly inspired Unix (Unics - Multics - bad pun...)
Virtual Memory
Unix
15 / 54
IntroductionOperating Systems
Hardware and Software ConceptsSummary
IntroductionHistoryArchitectures
70s
Commercialization of time-sharing systems
Ethernet/LANs
Foundations of Internet are started
TCP, TCP/IP
Personal computing starts
16 / 54
IntroductionOperating Systems
Hardware and Software ConceptsSummary
IntroductionHistoryArchitectures
80s
TCP/IP replaces NCP, DNS is developed
8 and 16 bit personal computers
GUIs
Xeroc Palo Alto Research Center (Xerox PARC)Apple Macintosh
Distributed computing - client/server
17 / 54
IntroductionOperating Systems
Hardware and Software ConceptsSummary
IntroductionHistoryArchitectures
90s
HTTP and WWW
Distributed computing explosion
PCs with hundreds of MIPS
Microsoft domination
Plug and play
18 / 54
IntroductionOperating Systems
Hardware and Software ConceptsSummary
IntroductionHistoryArchitectures
00s
Middleware
Web services
Small and mobile devices
19 / 54
IntroductionOperating Systems
Hardware and Software ConceptsSummary
IntroductionHistoryArchitectures
Architectures
Components
Kernel
Shell
Core components
Processor scheduler
Memory manager
I/O manager
Interprocess communication (IPC) manager
File system manager
20 / 54
IntroductionOperating Systems
Hardware and Software ConceptsSummary
IntroductionHistoryArchitectures
Monolithic
All core components inside the kernel
Modules can communicate directly through function calls
Highly efficient
Bugs and errors can be hard to isolate
Security?
Linux, many BSD systems, Solaris
21 / 54
IntroductionOperating Systems
Hardware and Software ConceptsSummary
IntroductionHistoryArchitectures
22 / 54
IntroductionOperating Systems
Hardware and Software ConceptsSummary
IntroductionHistoryArchitectures
Layered
Groups similar functions in layers
Layers communicate only with the layer above or below
Interfaces hides implementation
Calls may have to go through several layers
23 / 54
IntroductionOperating Systems
Hardware and Software ConceptsSummary
IntroductionHistoryArchitectures
24 / 54
IntroductionOperating Systems
Hardware and Software ConceptsSummary
IntroductionHistoryArchitectures
Microkernel
Kernel only provides a small number of services (MM, IPC,synchronization)
More advanced services are implemented as user processes
Often inefficient: intermodule communication, context switches areexpensive, etc.
Mach, L4, QNX, BeOS, Minix
Not to be confused with modular monolithic operating systems
25 / 54
IntroductionOperating Systems
Hardware and Software ConceptsSummary
IntroductionHistoryArchitectures
26 / 54
IntroductionOperating Systems
Hardware and Software ConceptsSummary
IntroductionHistoryArchitectures
Microkernel vs. Monolithic vs. Layered
Famous discussion: Linus Torvalds vs. Andy Tanenbaum, 1992:“Linux is obsolete”(http://www.oreilly.com/catalog/opensources/book/appa.html)
Often partly mixed
MacOS X, Windows NT (and XP, Vista, etc)
27 / 54
IntroductionOperating Systems
Hardware and Software ConceptsSummary
IntroductionHistoryArchitectures
Network and distributed systems
Network Operating systems
Runs on one computer
Allows its processes to access resources on remote computers
Distributed operating systems
Single OS that manages resources on more than one computersystem
Amoeba, Chord
Goals
Transparent performanceScalabilityFault toleranceConsistency
28 / 54
IntroductionOperating Systems
Hardware and Software ConceptsSummary
Hardware components
A computer’s hardware typically consists of:
processor(s)main memoryinput/output devices
Printed Circuit Board (PCB)
Hardware component that provides electrical connections betweendevices
The mainboard is the central PCB in a computer
Devices such as processors and main memory are attachedInclude chips to perform low-level operations (e.g., BIOS)
29 / 54
IntroductionOperating Systems
Hardware and Software ConceptsSummary
Processor
A processor is hardware that executes machine- language
CPU executes the instructions of a program
Coprocessor executes special-purpose instructions
Registers are high-speed memory located on processorsData must be in registers before a processor can operate on itInstruction length is the size of a machine-language instruction
30 / 54
IntroductionOperating Systems
Hardware and Software ConceptsSummary
31 / 54
IntroductionOperating Systems
Hardware and Software ConceptsSummary
32 / 54
IntroductionOperating Systems
Hardware and Software ConceptsSummary
Main memory and storage
Memory
Main memory consists of volatile random access memory (RAM)
Processes can access data locations in any orderCommon forms of RAM include:
dynamic RAM (DRAM) - requires refresh circuitstatic RAM (SRAM) - does not require refresh circuit
Secondary storage
Secondary storage stores large quantities of persistent data at lowcost
Accessing data on a hard disk is slower than main memory
Mechanical movement of read/write headRotational latencyTransfer time
33 / 54
IntroductionOperating Systems
Hardware and Software ConceptsSummary
Buses
A bus is a collection of traces
Traces are thin electrical connections that transport informationbetween hardware devices
A port is a bus that connects exactly two devices
An I/O channel is a bus shared by several devices to perform I/Ooperations
Example, the frontside bus (FSB) connects a processor to mainmemory
34 / 54
IntroductionOperating Systems
Hardware and Software ConceptsSummary
Direct Memory Access (DMA)
DMA improves data transfer between memory and I/O devices
Devices and controllers transfer data to and from main memorydirectlyProcessor is free to execute software instructionsDMA channel uses an I/O controller to manage data transfer
Notifies processor when I/O operation is complete
Improves performance in systems that perform large numbers of I/Ooperations (e.g., mainframes and servers)
35 / 54
IntroductionOperating Systems
Hardware and Software ConceptsSummary
36 / 54
IntroductionOperating Systems
Hardware and Software ConceptsSummary
Processor support for Operating Systems
Processor protection mechanismns for operating systems
Prevents processes from accessing privileged instructions or memory
Computer systems generally have several different execution modes:User mode (user state or problem state)
User may execute only a subset of instructions
Kernel mode (supervisor state)
Processor may access privileged instructions and resources on behalfof processes
37 / 54
IntroductionOperating Systems
Hardware and Software ConceptsSummary
Interrupts and exceptions
Discovering changes
Polling
Interrupts
Exception
38 / 54
IntroductionOperating Systems
Hardware and Software ConceptsSummary
Timers and Clocks
Timers
An interval timer periodically generates an interrupt
Operating systems use interval timers to prevent processes frommonopolizing the processor
Clocks
Provide a measure of continuity
A time-of-day clock enables an OS to determine the current timeand date
39 / 54
IntroductionOperating Systems
Hardware and Software ConceptsSummary
Bootstrapping
Loading initial OS components into memoryPerformed by a computer’s Basic Input/Output System (BIOS)
Initializes system hardwareLoads instructions into main memory from a region of secondarystorage called the boot sector
If the system is not loaded, the user will be unable to access any ofthe computer’s hardware
40 / 54
IntroductionOperating Systems
Hardware and Software ConceptsSummary
41 / 54
IntroductionOperating Systems
Hardware and Software ConceptsSummary
Caching
Caches
Relatively fast memory
Maintain copies of data that will be accessed soon
Increase program execution speed
Examples include:
L1 and L2 processor cachesMain memory can be viewed as a cache for hard disks and othersecondary storage devices
42 / 54
IntroductionOperating Systems
Hardware and Software ConceptsSummary
Buffering and Spooling
Buffers
Temporary storage area that holds data during I/O transfers
Primarily used to:
Coordinate communications between devices operating at differentspeedsStore data for asynchronous processingAllow signals to be delivered asynchronously
Spooling
Buffering technique in which an intermediate device, such as a disk,is interposed between a process and a low-speed I/O device
Allows processes to request operations from a peripheral devicewithout requiring that the device be ready to service the request
43 / 54
IntroductionOperating Systems
Hardware and Software ConceptsSummary
Software support
Programming languages
Some are directly understandable by computers, others requiretranslationClassified generally as either:
Machine languageAssembly languageHigh-level language
Compilers, Interpreters, Loaders
Firmware
Middleware
44 / 54
IntroductionOperating Systems
Hardware and Software ConceptsSummary
Compiling, Linking and Loading
Before a high-level-language program can execute, it must be:
Translated into machine languageLinked with various other machine-language programs on which itdependsLoaded into memory
45 / 54
IntroductionOperating Systems
Hardware and Software ConceptsSummary
Compiling
Translating high-level code to machine code
Accepts source code as input and returns object code
46 / 54
IntroductionOperating Systems
Hardware and Software ConceptsSummary
Linking
Create a single executable unit
Integrate precompiled modules called libraries referenced by aprogram
Assign relative addresses to different program or data units
Resolve all external references between subprograms
Produce an integrated module called a load module
Linking can be performed at compile time, before loading, at loadtime or at runtime
47 / 54
IntroductionOperating Systems
Hardware and Software ConceptsSummary
Dynamic linking
Executable contains undefined symbols
and a list with objects/libraries that provides definitions
Libraries need to be stored in one location only
Errors in libraries can easily be fixed
Multiple versions of libraries?
48 / 54
IntroductionOperating Systems
Hardware and Software ConceptsSummary
Loading
Convert relative addresses to physical addresses
Place each instruction and data unit in main memory
Techniques for loading a program into memoryAbsolute loading
Place program at the addresses specified by programmer or compiler(assuming addresses are available)
Relocatable loading
Relocate the program’s addresses to correspond to its actual locationin memory
Dynamic loading
Load program modules upon first use
49 / 54
IntroductionOperating Systems
Hardware and Software ConceptsSummary
50 / 54
IntroductionOperating Systems
Hardware and Software ConceptsSummary
51 / 54
IntroductionOperating Systems
Hardware and Software ConceptsSummary
52 / 54
IntroductionOperating Systems
Hardware and Software ConceptsSummary
Firmware and Middleware
Firmware contains executable instructions stored in persistentmemory attached to a device
Programmed with microprogramming
Layer of programming below a computer’s machine-languageMicrocode: simple, fundamental instruction necessary to implementall machine-language operations
More and more frequently: high-level languages
Middleware is software for distributed systems
Enables interactions among multiple processes running on one ormore computers across a networkFacilitates heterogeneous distributed systemsSimplifies application programming
53 / 54
IntroductionOperating Systems
Hardware and Software ConceptsSummary
Summary
http://www.sm.luth.se/csee/courses/smd/149/
Home work assignment 1 deadline: 14 Nov.
Next: Processes and threads
Chapters 3, 4, 5 (Sections 5.1- 5.3), 8 (Sections 8.1- 8.7.5)
54 / 54