Today. Operating System Evolution. CSCI 4061 Introduction to Operating Systems. Gen 1: Mono-programming ( ) OS Evolution Unix Overview

Similar documents
Today. Operating System Evolution. CSCI 4061 Introduction to Operating Systems. Gen 1: Mono-programming ( ) OS Evolution Unix Overview

UNIX Kernel. UNIX History

Introduction to Linux

Overview of Unix / Linux operating systems

Operating Systems CS3502 Spring 2018

EECS2301. Lab 1 Winter 2016

CPS221 Lecture: Operating System Functions

Perl and R Scripting for Biologists

CPS221 Lecture: Operating System Functions

CSCI 2132 Software Development. Lecture 3: Unix Shells and Other Basic Concepts

Unix Processes. What is a Process?

Lecture Topics. Announcements. Today: Operating System Overview (Stallings, chapter , ) Next: Processes (Stallings, chapter

Introduction to Operating Systems

Practical Computing-II. Programming in the Linux Environment. 0. An Introduction. B.W.Gore. March 20, 2015

Operating System Structure

What are some common categories of system calls? What are common ways of structuring an OS? What are the principles behind OS design and

Unix/Linux: History and Philosophy

Appendix A GLOSSARY. SYS-ED/ Computer Education Techniques, Inc.

CS450/550 Operating Systems

Operating Systems. Copyleft 2005, Binnur Kurt

Operating Systems 3. Operating Systems. Content. What is an Operating System? What is an Operating System? Resource Abstraction and Sharing

Design Overview of the FreeBSD Kernel CIS 657

Operating System Structure

5/20/2007. Touring Essential Programs

Reserves time on a paper sign-up sheet. Programmer runs his own program. Relays or vacuum tube hardware. Plug board or punch card input.

W4118: OS Overview. Junfeng Yang

Unix System Architecture, File System, and Shell Commands

Design Overview of the FreeBSD Kernel. Organization of the Kernel. What Code is Machine Independent?

Introduction to Linux

Introduction to Shell Scripting

Linux for Beginners. Windows users should download putty or bitvise:

Operating Systems CS 571

Introduction to Linux

CSCI2467: Systems Programming Concepts

OS structure. Process management. Major OS components. CSE 451: Operating Systems Spring Module 3 Operating System Components and Structure

Introduction to Linux

CptS 360 (System Programming) Unit 2: Introduction to UNIX and Linux

ELEC 377 Operating Systems. Week 1 Class 2

Introduction to Linux. Woo-Yeong Jeong Computer Systems Laboratory Sungkyunkwan University

Operating Systems. I. Introduction. Eurecom

INTRODUCTION TO OPERATING SYSTEMS. Jo, Heeseung

The UNIX Operating System. HORT Lecture 2 Instructor: Kranthi Varala

Unix API Books. Linux Kernel Books. Assignments and Exams. Grading for CSC 256. Operating Systems 8/31/2018. CSC 256/456 Fall

Essential Unix and Linux! Perl for Bioinformatics, ! F. Pineda

CS370 Operating Systems

(MCQZ-CS604 Operating Systems)

Operating System Services

Introduction to Operating Systems. Jo, Heeseung

Introduction to Unix. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

Topics: Early systems and OS overview Skim Chapters 1-2 of SGG Read Chapter 1 of USP CS 3733 Operating Systems

The Classical OS Model in Unix

Operating Systems Course Overview

What is UNIX? A Little Bit about UNIX and User Interfaces. Adapted from Practical Unix and Programming Hunter College

Operating System Services. User Services. System Operation Services. User Operating System Interface - CLI. A View of Operating System Services

Introduction to Cygwin Operating Environment

! Software ( kernel ) that runs at all times. ! OS performs two unrelated functions: Maria Hybinette, UGA. user! 1! Maria Hybinette, UGA. user! n!

Operating Systems. Operating System Structure. Lecture 2 Michael O Boyle

Systems Programming. The Unix/Linux Operating System

System Programming. Introduction to Unix

Introduction to Linux. Fundamentals of Computer Science

Creating a Shell or Command Interperter Program CSCI411 Lab

An Introduction to Unix Power Tools

CSCI 2132 Software Development. Lecture 4: Files and Directories

EECS 470 Lab 5. Linux Shell Scripting. Friday, 1 st February, 2018

Overview of Operating Systems

CSCI 2132 Software Development. Lecture 2: Introduction to UNIX and Unix-like Operating Systems

Introduction to Operating Systems. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

Operating System Architecture. CS3026 Operating Systems Lecture 03

Introduction to Operating Systems. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

OS concepts and structure. q OS components & interconnects q Structuring OSs q Next time: Processes

UNIX. The Very 10 Short Howto for beginners. Soon-Hyung Yook. March 27, Soon-Hyung Yook UNIX March 27, / 29

Overview of Operating Systems

Mid Term from Feb-2005 to Nov 2012 CS604- Operating System

Crash Course in Unix. For more info check out the Unix man pages -orhttp:// -or- Unix in a Nutshell (an O Reilly book).

Working With Unix. Scott A. Handley* September 15, *Adapted from UNIX introduction material created by Dr. Julian Catchen

CSCI 6730 / 4730 Operating Systems. Key Questions in System Design. Review: What is An Operating System? Key Points

Operating System Labs. Yuanbin Wu

Introduction: What is Unix?

Unix Handouts. Shantanu N Kulkarni

Linux Systems Administration Getting Started with Linux

Today. Review. Unix as an OS case study Intro to Shell Scripting. What is an Operating System? What are its goals? How do we evaluate it?

CSC209: Software tools. Unix files and directories permissions utilities/commands Shell programming quoting wild cards files

CSC209: Software tools. Unix files and directories permissions utilities/commands Shell programming quoting wild cards files. Compiler vs.

(a) About Unix. History

Unix Shells and Other Basic Concepts

What is an Operating System? A Whirlwind Tour of Operating Systems. How did OS evolve? How did OS evolve?

Lecture 3. Unix. Question? b. The world s best restaurant. c. Being in the top three happiest countries in the world.

Introduction. Let s start with the first set of slides

Chapter 2: Operating-System Structures. Operating System Concepts Essentials 8 th Edition

UNIX Concepts COMPSCI 386

Chapter 2: Operating-System

CSE506: Operating Systems CSE 506: Operating Systems

Introduction. What is an Operating System? A Modern Computer System. Computer System Components. What is an Operating System?

UNIX System Programming Lecture 3: BASH Programming

Chap2: Operating-System Structures

Operating System Labs. Yuanbin Wu

Process Description and Control

Chapter 2: Operating-System Structures

Vi & Shell Scripting

CSC209 Review. Yeah! We made it!

Transcription:

Today CSCI 4061 Introduction to s Instructor: Abhishek Chandra OS Evolution Unix Overview Unix Structure Shells and Utilities Calls and APIs 2 Evolution How did the OS evolve? Dependent on hardware and technology Dependent on applications and usage Gen 1: Mono-programming (1945-55) Large computers (building-size) Mechanical relays, vaccuum tubes Direct programming of hardware Basically no OS! Similar to a programmer writing raw binary code 3 4 1

Gen 2: Batch s (1955-65) Mainframes Programmers submit multiple jobs Stack of punch cards Programs were batched and fed into the system Results were output after a few hours OS did some elementary job scheduling Similar to today s supercomputers Gen 3: Multi-programming (1965-80) Multiple programs executing in parallel Allow more efficient use of CPU and I/O Time-sharing: Variant of multi-programming Fast time-multiplexing between multiple jobs Each user gets single-user view OS performs resource management and control MULTICS (MULTiplexed Information and Computing Service) and UNIX 5 6 Gen 4: Personal Computers (1980-) Started as single-user systems Evolved into multi-user, multi-programming systems Main focus: Ease of use Evolution of GUIs OS provides simple abstractions and resource management Examples: DOS, Windows, MacOS, Linux, FreeBSD Gen 5: Distributed s (1985-) Multiple computers linked by a network/bus Various flavors: Multiprocessor systems Client-server systems Peer-to-peer systems and Grids Cloud computing Focus: Interaction of multiple independent entities 7 8 2

Gen 6: Mobile Computing (2000-) Handheld and wearable devices: smart phones, tablets, watches, Main constraints: power, size/weight Limited resources: Slower CPU, less memory storage Many sensors: Cameras, GPS, accelerometers, Focus: energy-efficiency, mobility, context Examples: Google Android, Apple ios Other Flavors Embedded OS Limited CPU, memory, battery E.g.: Home devices, environmental sensors, IoT Special-purpose functionality Real-time OS Time-based guarantees E.g.: Space rockets, cars, production machinery 10 General Structure Applications Hardware Kernel Core of the Provides the main functionality: Process and Thread Management Memory Management File and I/O Inter-Process Communication Hardware-OS interactions OS-Application interactions 11 12 3

Hardware-OS interactions We would mainly worry about hardware abstractions E.g.: Processes, files, virtual memory, sockets Control allocation and management of CPU, disks, devices, memory, network interfaces Portability across variety of hardware Asynchronous events and concurrency. E.g.: interrupts, I/O events OS-Application interactions Shells and User interfaces Allow users to interact with the OS Libraries Allow programs to use common services calls Direct conduit into the OS Signals OS interacting with user programs 13 14 Key Questions Kernel Mode Q.1: How does the OS protect the hardware from (unruly or malicious) applications? Q.2: How do applications get access to desired resources (CPU, memory, disk, etc.)? User Mode Kernel Mode OS runs in kernel mode: hardware-enabled Higher privileges than user mode Access to hardware resources Access to protected memory Access to OS data structures Tighter control, security of system resources Applications 15 16 4

User Mode User Mode Kernel Mode Applications, utilities, shell run in user mode Restricted access to resources Kernel data structures Protection boundaries Applications Key Questions Q.1: How does the OS protect the hardware from (unruly or malicious) applications? Q.2: How do applications get access to desired resources (CPU, memory, disk, etc.)? 17 18 Example Scenario Calls Consider the matrix multiplication homework program The program needs to read input data from a file in small chunks Can the program directly read data from the disk? How does the program tell the OS to read the data for it? Call User Mode Result Kernel Mode Kernel API: well-defined, small set of operations Entry points into the kernel Provide restricted access to the kernel Applications 19 20 5

Call Operation Call Example: read Parameters, Syscall no. Trap Dispatcher Syscall Table Result Syscall Handler User program executes a TRAP instruction Switches to kernel mode Passes parameters, system call no. Kernel looks up system call table call handler is invoked Results returned to user program User Mode Kernel Mode E.g.: read 16 bytes from file F into buffer Parameters: (F, buffer, 16) User program passes: Parameters, read syscall no. (3) User program executes TRAP Kernel looks up code for syscall no. 3 Kernel executes code for read system call Look up F (File system) Transfer 16 bytes from disk to buffer (I/O) call returns control to user space 21 22 Call Implementation Requires performing TRAP instruction Requires passing parameters to kernel In registers or in buffers Requires getting back control from kernel May be implemented in assembly language How to use in programs easily? Libraries Pre-written and pre-tested functions Programmers can call library functions in their programs Two types: Wrappers for system calls User-level utility functions 23 24 6

Call Wrapper Libraries Provide convenient function call to programmers Library call does the hard work: Packaging the parameters Executing the system call Extracting the results E.g.: read library call Multiple library calls could map to same syscall execve -> execl, execlp, execle, execv, execvp User-level Utility Libraries Implement commonly-used functions Programmers don t have to reinvent the wheel Examples: Random number generation (rand, srand, ) String operations (strcpy, strcmp, strlen, ) 25 26 Advantages of Libraries Unix Overview Reduce load on programmers Standard functions Hide complexity Efficient implementation Available for high-level languages 27 28 7

What is Unix? Highly Popular OS Programming Platform/Toolbox Many variants exist Multiple implementations, similar functionality Principles: Multiprogramming Flexibility Extensibility Unix Evolution MULTICS (1965): MULTiplexed Information and Computing Service UNIX (1969): Developed at Bell Labs Developed in C Architecture-independent Several Evolution Paths: AT&T V (1983) -> SCO Unix BSD (1980) -> FreeBSD, NetBSD Linux (1991-) Other variants: Solaris, HP/UX, IBM AIX, Apple OS/X 29 30 Common Features Similar tools and user interfaces Similar APIs POSIX Standards Variations Shells, tools, and user interfaces APIs Underlying implementation 31 32 8

Unix: User s View Structure Applications Shell Applications Kernel Hardware 33 34 Unix Structure Shell Applications, Utilities, and User Programs Shell Libraries Call Interface Kernel CPU, Memory, Disks, Devices AUI (Application User Interface) API (Application Programmer Interface) Hardware Basic interface to the OS Allows users to interact with the OS Command interpreter Parses and executes several commands Many Unix Shells Bourne sh csh, tcsh, ksh, bash 35 36 9

Shell as Command Interpreter Read-eval-print Read user input Evaluate the input and execute command(s) Print output Example: ls l User types above command Shell reads and parses the input Shell invokes ls command with argument -l Shell prints the output produced by the command Shell as a Program Shell is just another user-level program No special privileges Primary Objective: Run other useful programs Shell interacts with the OS using the API and through other programs Same functionality can be obtained using a C/Java/ program 37 38 Shell Commands Built-in commands Implemented within the shell itself E.g.: alias, echo, eval External commands Other programs executed by the shell Path needs to specified (or be in the environment) File should be executable E.g.: ls is the file /bin/ls Environment variables Environment: A set of variables associated with the shell Useful for the shell to remember common settings Examples: PATH: Set of directories to look for commands HOME: Home directory of the user PS1: Default prompt setting SHELL: Path of the shell itself x, foo: user-defined 39 40 10

Standard I/O Standard input (stdin): source of input data for a command or program Default: Keyboard Standard output (stdout): destination of output from a command or program Default: Display Standard error (stderr): destination of error messages Default: Display Shell Redirection Redirect the input or output of a command to a file Input redirection (<): Takes input from a file instead of keyboard sort < file Output redirection (>): Send output to a file instead of display ls -l > file cat file1 >> file2 41 42 Shell Plumbing Pipes: prog1 prog2 Allow multiple commands to be linked together Connects output of prog1 to input of prog2 Examples: ls -l more cat foo sort head How will you do the above using only redirection? Most UNIX commands consume and produce plain text data Tools and Utilities Unix is a toolbox Several utilities come packaged/can be easily installed Shell Commands: grep, sort, awk, sed Applications: Editors: vi, emacs Compilers: gcc, f77 43 44 11

Unix File Tree-based hierarchy File system has a root (/) Each user has a home directory ($HOME) There are several standard directories: E.g.: /bin (binary files), /dev: device files, /lib: libraries,... cp Unix Directory Hierarchy / bin dev etc home lib usr tmp var ls chandra bin include lib bin cc which libc.so libm.so myprog 45 46 Unix Summary Applications, Utilities, and User Programs Shell AUI (Application User Interface) Libraries Call Interface Kernel Processes, File, Virtual Memory, Threads, Sockets CPU, Memory, Disks, Devices Hardware 47 12