程序代写代做代考 compiler data structure algorithm android concurrency Week 05 – Introduction to Operating Systems

Week 05 – Introduction to Operating Systems

Lecture Objective
To develop a basic understanding of what is an operating system and why do we need it ?
Slide #2 of 38

Reading Material
u A lot of this course will be based upon material from the following two books:
n Operating System Concepts (9th edition) by Silberschatz, Galvin &
Gagne
n Operating Systems: Internals and Design Principles (7 edition) by
William Stallings & Goutam Kumar
n The Linux Command Line: A Complete Introduction (1 William Shotts (2012) (Electronic Book only)
th st
n It is recommended that you read these to supplement what you will learn in the lectures
u There are also lots of great research papers available online – any material covered from these will be linked to from Canvas.
edition) by
Slide #3 of 38

Why learn Operating Systems
u A modern education in Computer Science would be incomplete without studying these topics
u Knowledge of the above strengthens the practical appreciation of other parts of your courses:
n Software Workshop
n Implementation of Data Structures & Algorithms
u Needless to say, it is very interesting! uSystem Programming (?)
Slide #4 of 38

This week and the coming weeks
uIntroduction to OS and its Elements
uComputer Systems Architecture and OS Structures uProcess Management
uProcess Scheduling
uMultithreading and its Challenges
uConcurrency and Synchronization
uDeadlocks
Slide #5 of 38

A brief history of Computer Science at Birmingham
uComputing at University of Birmingham can be traced back to the KDF9 computing system
n16K words of memory nMagnetic tape decks for
storage
nPaper tape input and output
Worth a Thousand Words (1967)
Slide #6 of 38

Slide #7 of 38

A room plan for KDF9 deployment
Slide #8 of 38

1968: The KDF9 in the Aston Webb
Slide #9 of 38

1968: An operator works on the KDF9
Slide #10 of 38

The Role of Human Operator
u Each program had to be keyed in by hand to control the system function required.
uThere were few programs to read or write from a keyboard or a disk
u Distinct lack of monitors (screens) or keyboards
uThe operators (the ladies in the pictures) controlled all
nLoaded magnetic tapes nFed in cards/paper tape nMaintained the system
Slide #11 of 38

The Role of Human Operator
uOperators worked in shifts
nFed in cards/paper tape
nApproximately 40 hours per week, per shift.
nIn 1967, only a single operator. nBy 1970, four shifts operated on
the system
u Laborious u Expensive u Tedious
u Error-prone
Slide #12 of 38

The Role of Human Operator
1976: The ICL 1906A (pictured) replaced the KDF9
uAs time progressed, the University installed faster and more powerful computers.
uHowever, the limiting factor was the role of the operators
uAn automatic system was required to free the operators from the mundane tasks
uHence, the arrival of the Operating System
Slide #13 of 38

What is an Operating Systems?
Operating systems are those programs that interface the machine with the applications programs. The main function of these systems is to dynamically allocate the shared system resources to the executing programs. As such, research in this area is clearly concerned with the management and scheduling of memory, processes, and other devices. But the interface with adjacent levels continues to shift with time. Functions that were originally part of the operating system have migrated to the hardware. On the other side, programmed functions extraneous to the problems being solved by the application programs are included in the operating system.
—WHAT CAN BE AUTOMATED?: THE COMPUTER SCIENCE AND ENGINEERING RESEARCH STUDY, MIT Press, 1980
Slide #14 of 38

What is an Operating System?
uAn Operating System is a program or collection of programs that makes it easier for us to use a computer.
uAn Operating System provides simpler abstraction of the underlying hardware.
uAn Operating System is resource manager. Examples:
n DOS, OS/2, Windows XP, Windows 2000
n Ubuntu, FreeBSD, Fedora, Solaris, Mac OS n iOS, Android, Symbian OS, Lynx OS
Slide #15 of 38

What is an Operating System?
u It is a layer of system software that acts as an intermediary between a computer user and the computer’s hardware.
uFrom a user’s perspective:
nIt is designed for ease of use – it hides the hardware complexity: ► Executing user programs
► Convenient interface
u Resource Utilization does not appear to be important!
Slide #16 of 38

What is an Operating System?
uFrom the perspective of the system:
nThe OS is intimately involved with the hardware
nIt can be viewed as a Resource Manager (Allocator)
► CPU time, memory space, file-storage space, I/O devices etc. ► Requests for resources may be numerous, and conflicting.
u It can also be seen as a control system between the I/O devices and the user’s programs.
u Managing the execution to prevent errors and improper use.
Slide #17 of 38

Objectives of an Operating Systems
u A program that controls the execution of application programs
uAn interface between applications and hardware
Main Objectives of an OS:
• Convenience
• Efficiency
• Ability to Evolve
Slide #18 of 38

The Components of a Computer System
uHardware: basic computing resources
u Operating system: controls and coordinates use of
hardware amongst applications and users
u Application programs: define the ways in which the system resources are used to solve computing problems: compilers, text editors, email clients, webs browsers, games
uUsers: people, machines and other computers
Slide #19 of 38

The Components of a Computer System
user 1
compiler
user 2 user n
text editor web browser System and application programs
Operating System
Computer Hardware
Slide #20 of 38

A Modern Computer System
CPU
Disk USB Controller Controller
Memory
Graphics Adaptor (GPU)
Slide #21 of 38

Operating System Services
uProgram development uProgram execution uAccess I/O devices uControlled access to files uSystem access
uError detection and response u Accounting
Slide #22 of 38

Role of an Operating System
u A computer is a set of resources for the movement, storage, and processing of data and for the control of these functions.
uThe OS is responsible for managing these resources Normally, we think of a control mechanism as something
external to that which is controlled.
Example: Heating System and Thermostat
Slide #23 of 38

Operating System as a Resource Manager
Slide #24 of 38

Evolution Operating Systems
Multiprogrammed Systems
Batch Systems Simple Batch
Systems
Serial Processing
Time Sharing
Slide #25 of 38

Serial Processing
EARLIEST COMPUTERS:
v No operating system
v Programmers interacted directly with the computer hardware
v Computers ran from a console with display lights, toggle switches, some form of input device, and a printer
v Users have access to the computer in “series”
PROBLEMS: Scheduling
vMost installations used a hardcopy sign-up sheet to reserve computer time
vTime allocations could run short or long, resulting in wasted computer time
Setup time
vA considerable amount of time was spent just on setting up the program to run
Slide #26 of 38

Simple Batch Systems
Early computers were very expensive
uImportant to maximize processor utilization
Monitor
u User no longer has direct access to processor
u Job is submitted to computer operator who batches them together and places them on an input device
u Program branches back to the monitor when finished
Slide #27 of 38

Role of a Monitor
uMonitor controls the sequence of events
uResident Monitor is software that always resides in memory
uMonitor reads in job and gives control
uJob returns control to monitor
Slide #28 of 38

Role of a Monitor
uProcessor executes instruction from the memory containing the monitor
u Executes the instructions in the user program until it encounters an ending or error condition
u “control is passed to a job” means processor is fetching and executing instructions in a user program
u “control is returned to the monitor” means that the processor is fetching and executing instructions from the monitor program
Slide #29 of 38

Simple Batch Systems – Monitor Overhead
Processor time alternates between execution of user programs and execution of the monitor
Sacrifices:
u Some main memory is now given over to the monitor u Some processor time is consumed by the monitor
Despite overhead, the simple batch system improves utilization of the computer
Slide #30 of 38

Uniprogramming
The processor spends a certain amount of time executing, until it reaches an I/O instruction; it must then wait until that I/O instruction concludes before proceeding.
Slide #31 of 38

Multi-programming
There must be enough memory to hold the OS (resident monitor) and one user program
When one job needs to wait for I/O, the processor can switch to the other job, which is likely not waiting for I/O
Slide #32 of 38

Time Sharing Systems
u Can be used to handle multiple interactive jobs
u Processor time is shared among multiple users
uMultiple users simultaneously access the system through terminals, with the OS interleaving the execution of each user program in a short burst or quantum of computation
Slide #33 of 38

Summary
uThe Role of Human Operator
u How monitor replaced the human operator and
evolved into an Operating System
uOperating System as a Resource manager
u Evolution of Operating Systems from Serial to Time Sharing Systems
Slide #34 of 38

References / Links
uChapter # 1: Operating System Concepts (9th edition) by Silberschatz, Galvin & Gagne
Slide #35 of 38