72
Course Introduction: Operating Systems Indranil Sengupta (odd section) and Mainack Mondal (even section) CS39002 Spring 2019-20

Course Introduction: Operating Systems

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Course Introduction: Operating Systems

Course Introduction: Operating Systems

Indranil Sengupta (odd section)and Mainack Mondal (even section)CS39002

Spring 2019-20

Page 2: Course Introduction: Operating Systems

Today’s class

• Resources and notes

• Introduction to operating systems

Page 3: Course Introduction: Operating Systems

Who am I?

• Mainack Mondal: system security, large scale system measurement, privacy

• Office: CSE 316• Will also be in your lab

Page 4: Course Introduction: Operating Systems

Who should be in this class?

• Even roll numbers

Page 5: Course Introduction: Operating Systems

Who should be in this class?

• Even roll numbers

• If your name is not called during attendance please talk to me after class

Page 6: Course Introduction: Operating Systems

Requirements

• Using computers and application software

Page 7: Course Introduction: Operating Systems

Requirements

• Using computers and application software

• How to write, compile and run C-programs

Page 8: Course Introduction: Operating Systems

Requirements

• Using computers and application software

• How to write, compile and run C-programs

• Computer Organization and architecture (prerequisite)

Page 9: Course Introduction: Operating Systems

Website / Books

• Weblink to course page be announced shortly

Page 10: Course Introduction: Operating Systems

Website / Books

• Weblink to course page be announced shortly

• Text Books / References:• Operating Systems Concepts, 9th ed. - A. Silverschatz,

P.V. Galvin, and G. Gagne. Wiley, 2016.

• Design of the Unix Operating System - M.K. Bach. Pearson, 2015.

Page 11: Course Introduction: Operating Systems

Course logistics

• Slides from the text book (created by the authors) will be made available in the web site• Actual coverage in classes might be beyond that

• Exam will be based on class coverage

Page 12: Course Introduction: Operating Systems

Course logistics

• Slides from the text book (created by the authors) will be made available in the web site• Actual coverage in classes might be beyond that

• Exam will be based on class coverage

• I would use both blackboard AND slides

Page 13: Course Introduction: Operating Systems

Course logistics

• Slides from the text book (created by the authors) will be made available in the web site• Actual coverage in classes might be beyond that

• Exam will be based on class coverage

• I would use both blackboard AND slides• Please take notes, these slides are just for guiding the

course (does not fully cover all material)

Page 14: Course Introduction: Operating Systems

Course logistics (contd.)

• Practice problems will be uploaded on the website• Some will be discussed in the class

• You need to solve others

• Exam questions may be based on the practice problems

Page 15: Course Introduction: Operating Systems

Course logistics (contd.)

• Practice problems will be uploaded on the website• Some will be discussed in the class

• You need to solve others

• Exam questions may be based on the practice problems

• There will be two class tests

• Dates will be announced later

Page 16: Course Introduction: Operating Systems

Course evaluation

• Internal Assessment (20%)

• Class tests

• Mid semester examination (30%)

• Closed book

• End semester examination (50%)

• Closed book

Page 17: Course Introduction: Operating Systems

Why should you come to class?

• Aside from the fact that slides are not complete and exam questions will come from class coverage?

Page 18: Course Introduction: Operating Systems

Why should you come to class?

• Aside from the fact that slides are not complete and exam questions will come from class coverage?

• Penalty for poor attendance: -10%

Page 19: Course Introduction: Operating Systems

Why should you come to class?

• Aside from the fact that slides are not complete and exam questions will come from class coverage?

• Penalty for poor attendance: -10%

• Let’s define poor

Page 20: Course Introduction: Operating Systems

Why should you come to class?

• Aside from the fact that slides are not complete and exam questions will come from class coverage?

• Penalty for poor attendance: -10%

• Let’s define poor

• Attendance ≥ 80%, you don’t lose marks

Page 21: Course Introduction: Operating Systems

Why should you come to class?

• Aside from the fact that slides are not complete and exam questions will come from class coverage?

• Penalty for poor attendance: -10%

• Let’s define poor

• Attendance ≥ 80%, you don’t lose marks

• Attendance between 70% and 80%, you lose 2%

Page 22: Course Introduction: Operating Systems

Why should you come to class?

• Aside from the fact that slides are not complete and exam questions will come from class coverage?

• Penalty for poor attendance: -10%

• Let’s define poor

• Attendance ≥ 80%, you don’t lose marks

• Attendance between 70% and 80%, you lose 2%

• Attendance between 60% and 70%, you lose 5%

Page 23: Course Introduction: Operating Systems

Why should you come to class?

• Aside from the fact that slides are not complete and exam questions will come from class coverage?

• Penalty for poor attendance: -10%

• Let’s define poor

• Attendance ≥ 80%, you don’t lose marks

• Attendance between 70% and 80%, you lose 2%

• Attendance between 60% and 70%, you lose 5%

• Attendance less than 60%, you lose 10%

Page 24: Course Introduction: Operating Systems

Last but not the least

• Ask questions in the class

• You need to know how Operating Systems (OS) as computer scientist

• It is best done via class - interaction

Page 25: Course Introduction: Operating Systems

Last but not the least

• Ask questions in the class

• You need to know how Operating Systems (OS) as computer scientist

• It is best done via class - interaction

• Do lab assignments & practice problems religiously

• This is a systems course• There is no other way of learning how systems

work than actually trying to build systems

Page 26: Course Introduction: Operating Systems

Today’s class

• Resources and notes

• Introduction to operating systems

Page 27: Course Introduction: Operating Systems

Today’s class

• Resources and notes

• Introduction to operating systems (OS)• What is an OS• What are the goals of an OS• Under the hood: the structure of OS• How does OS work?

Page 28: Course Introduction: Operating Systems

What is an Operating System?

Page 29: Course Introduction: Operating Systems

Let’s start from the top (check schematic on blackboard)

Users

might be one or multiple (using servers)

Page 30: Course Introduction: Operating Systems

Let’s start from the top (check schematic on blackboard)

Users

might be one or multiple (using servers)

Logs in and start applications

gcc, gedit, notepad, firefox, chrome, excel, …

Page 31: Course Introduction: Operating Systems

Let’s start from the top (check schematic on blackboard)

Users

might be one or multiple (using servers)

Logs in and start applications

gcc, gedit, notepad, firefox, chrome, excel, …

These applications ultimately need to use hardware

processor, ram, display, mouse, keyboard ….

Page 32: Course Introduction: Operating Systems

Let’s start from the top (check schematic on blackboard)

Usersmight be one or multiple (using servers)

Logs in and start applicationsgcc, gedit, notepad, firefox, chrome, excel, …

These applications ultimately need to use hardwareprocessor, ram, display, mouse, keyboard ….

Operating system seats right in between applications and hardware

Page 33: Course Introduction: Operating Systems

Putting it all together

Source: Silberschatz, Galvin and Gagne ©2013

Page 34: Course Introduction: Operating Systems

OS: Definition

A program that acts as an intermediary between users of a computer system and hardware

Page 35: Course Introduction: Operating Systems

Today’s class

• Resources and notes

• Introduction to operating systems (OS)• What is an OS• What are the goals of an OS• Under the hood: the structure of OS• How does OS work?

Page 36: Course Introduction: Operating Systems

Goals of an Operating System

Page 37: Course Introduction: Operating Systems

Primary goals

• Make the computer system convenient and easy to use

• Ensure efficient utilization of resources (think processor time, printer, RAM, ...)

• Controls and co-ordinates the use of hardware resources among multiple users and applications

Page 38: Course Introduction: Operating Systems

These goals might be conflicting across computing systems

Page 39: Course Introduction: Operating Systems

These goals might be conflicting across computing systemsMini computers and mainframes

(1970 - 80)

Best utilization of resources

Cost: user experience(often no immediate result)

Page 40: Course Introduction: Operating Systems

These goals might be conflicting across computing systemsMini computers and mainframes

(1970 - 80)

Workstations / terminals

(1980 - now)

Best utilization of resources

Cost: user experience(often no immediate result)

Fast response time

Cost: Resource utilization is suboptimal

Page 41: Course Introduction: Operating Systems

These goals might be conflicting across computing systemsMini computers and mainframes

(1970 - 80)

Workstations / terminals

(1980 - now)Laptops

Best utilization of resources

Cost: user experience(often no immediate result)

Fast response time

Cost: Resource utilization is suboptimal

Flexible UI, easy to use

Cost: single user system

Page 42: Course Introduction: Operating Systems

These goals might be conflicting across computing systemsMini computers and mainframes

(1970 - 80)

Workstations / terminals

(1980 - now)Laptops Mobile systems

Best utilization of resources

Cost: user experience(often no immediate result)

Fast response time

Cost: Resource utilization is suboptimal

Flexible UI, easy to use

Cost: single user system

Optimized usability & battery life

Cost: Severely constrained resources (your android cannot handle running full fledged game and browsing)

Page 43: Course Introduction: Operating Systems

These goals might be conflicting across applications

Application A: I need 3 GB of memory, now!

Page 44: Course Introduction: Operating Systems

These goals might be conflicting across applications

Application A: I need 3 GB of memory, now!

Application B: I need 2 GB of memory, now!

Page 45: Course Introduction: Operating Systems

These goals might be conflicting across applications

Application A: I need 3 GB of memory, now!

Application B: I need 2 GB of memory, now!

Hardware: oops, total RAM is 4 GB

Page 46: Course Introduction: Operating Systems

OS: goal oriented definition

• A resource allocator

• Manages all resources (processor time, ram, display, printer) and ensures that they are shared in an efficientand fair manner

Page 47: Course Introduction: Operating Systems

OS: goal oriented definition

• A resource allocator

• Manages all resources (processor time, ram, display, printer) and ensures that they are shared in an efficientand fair manner

• A control program

• Controls the execution of other programs to prevent errors and/or improves usability (e.g., by giving faster response to users)

Page 48: Course Introduction: Operating Systems

Today’s class

• Resources and notes

• Introduction to operating systems (OS)• What is an OS• What are the goals of an OS• Under the hood: the structure of OS• How does OS work?

Page 49: Course Introduction: Operating Systems

Typical structure of OS (unix)

• Note: By structure we simply meant control flow

Page 50: Course Introduction: Operating Systems

Typical structure of OS (unix)

• Note: By structure we simply meant control flow

Applications

Operating system

Hardware

Page 51: Course Introduction: Operating Systems

Typical structure of OS (unix)

• Note: By structure we simply meant control flow

Applications

Operating system

Hardware

Kernel

Page 52: Course Introduction: Operating Systems

Typical structure of OS (unix)

• Note: By structure we simply meant control flow

Applications

Operating system

Hardware

Kernel

Page 53: Course Introduction: Operating Systems

Typical structure of OS (unix)

• Note: By structure we simply meant control flow

Applications

Operating system

Hardware

Kernel

Kernel: Collections of functions that

provides essential functionalities of OS

Page 54: Course Introduction: Operating Systems

Typical structure of OS (unix)

• Note: By structure we simply meant control flow

Applications

Operating system

Hardware

Kernel

Kernel: Collections of functions that

provides essential functionalities of OS

Other OS components

(shell, GUI, services, system tools)

Page 55: Course Introduction: Operating Systems

What other services?

Source: Silberschatz, Galvin and Gagne ©2013

Page 56: Course Introduction: Operating Systems

Function of Kernel

• Part of OS closest to the hardware, handles important functionalities• Managing memory, network, file, processes, system

calls …

Page 57: Course Introduction: Operating Systems

Function of Kernel

• Part of OS closest to the hardware, handles important functionalities• Managing memory, network, file, processes, system

calls …

• Shell (other part of OS) and application programs can interact with kernel whenever they require these functionalities • E.g., need to read from keyboard (scanf), show

something on display (printf), create directory (mkdir)

Page 58: Course Introduction: Operating Systems

Food for thought

• A user might ask for printf any time

• Does “Kernel run all the times”?

Page 59: Course Introduction: Operating Systems

Food for thought

• A user might ask for printf any time

• Does “Kernel run all the times”?

• Possible problem

• Kernel needs resources to run

Page 60: Course Introduction: Operating Systems

Food for thought

• A user might ask for printf any time

• Does “Kernel run all the times”?

• Possible problem

• Kernel needs resources to run

• Insight

• Kernel “only” needs to run when any of its functionalities are required

Page 61: Course Introduction: Operating Systems

Today’s class

• Resources and notes

• Introduction to operating systems (OS)• What is an OS• What are the goals of an OS• Under the hood: the structure of OS• How does OS work?

Page 62: Course Introduction: Operating Systems

Today’s class

• Resources and notes

• Introduction to operating systems (OS)• What is an OS• What are the goals of an OS• Under the hood: the structure of OS• How does OS work?

Kernel

Page 63: Course Introduction: Operating Systems

Kernel is “interrupt” driven

• Think of interrupt as the “wake up call” to kernel

• When interrupt comes, some function in Kernel is invoked

Page 64: Course Introduction: Operating Systems

Kernel is “interrupt” driven

• Think of interrupt as the “wake up call” to kernel

• When interrupt comes, some function in Kernel is invoked

• More technically

• interrupt is a signal (instruction), generated by hardware/software

• The interrupt in turn activate appropriate kernel routine depending on specific category of interrupts

Page 65: Course Introduction: Operating Systems

Types of interrupt

Types of interrupt

Hardware generated

External (e.g., from I/O devices)

Internal (timer, memory access

violation)

Hardware interrupts: generated by external device (e.g., a printer) OR internal hardware unit

Page 66: Course Introduction: Operating Systems

Types of interrupt

Types of interrupt

Hardware generated

External (e.g., from I/O devices)

Internal (timer, memory access

violation)

Software generated

Trap (e.g., syscall)

Exception (e.g., divide by 0)

Hardware interrupts: generated by external device (e.g., a printer) OR internal hardware unit

Software interrupts: Generated by a running program

Page 67: Course Introduction: Operating Systems

Case study: Handling Input/Output (I/O) requests

Page 68: Course Introduction: Operating Systems

The setup

Source: Silberschatz, Galvin and Gagne ©2013

Page 69: Course Introduction: Operating Systems

The setup (contd.)

• I/O devices and CPU can execute in parallel• Each device controller is in charge of a particular

device type• Each device controller has a local buffer• Data transfers between local buffer and main memory• Device controller send an interrupt to the CPU to

indicate I/O completion

Page 70: Course Introduction: Operating Systems

The setup (contd.)

• I/O devices and CPU can execute in parallel• Each device controller is in charge of a particular

device type• Each device controller has a local buffer• Data transfers between local buffer and main memory• Device controller send an interrupt to the CPU to

indicate I/O completion

Question: How would an I/O request be handled?

Page 71: Course Introduction: Operating Systems

The setup (contd.)

• I/O devices and CPU can execute in parallel• Each device controller is in charge of a particular

device type• Each device controller has a local buffer• Data transfers between local buffer and main memory• Device controller send an interrupt to the CPU to

indicate I/O completion

Question: How would an I/O request be handled?(Let’s do it on board)

Page 72: Course Introduction: Operating Systems

I/O handling in von Neumann architecture

Source: Silberschatz, Galvin and Gagne ©2013