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

Similar documents
Overview of Unix / Linux operating systems

Operating Systems: Internals and Design Principles. Chapter 2 Operating System Overview Seventh Edition By William Stallings

Announcement. Exercise #2 will be out today. Due date is next Monday

Introduction. CS3026 Operating Systems Lecture 01

HIGH PERFORMANCE COMPUTING: MODELS, METHODS, & MEANS OPERATING SYSTEMS 1

An Operating System History of Operating Systems. Operating Systems. Autumn CS4023

Process Description and Control. Chapter 3

Multiprogramming. Evolution of OS. Today. Comp 104: Operating Systems Concepts 28/01/2013. Processes Management Scheduling & Resource Allocation

ELEC 377 Operating Systems. Week 1 Class 2

System Call. Preview. System Call. System Call. System Call 9/7/2018

Processes. Process Management Chapter 3. When does a process gets created? When does a process gets terminated?

Major Requirements of an OS

UNIX Kernel. UNIX History

Process Description and Control

Operating System Architecture. CS3026 Operating Systems Lecture 03

EECS 3221 Operating System Fundamentals

EECS 3221 Operating System Fundamentals

Process Description and Control

Introduction to Linux Overview and Some History

IT 540 Operating Systems ECE519 Advanced Operating Systems

Operating Systems. Lecture 3- Process Description and Control. Masood Niazi Torshiz

Processes. OS Structure. OS Structure. Modes of Execution. Typical Functions of an OS Kernel. Non-Kernel OS. COMP755 Advanced Operating Systems

Operating Systems. I. Introduction. Eurecom

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

Lecture Topics. Announcements. Today: Threads (Stallings, chapter , 4.6) Next: Concurrency (Stallings, chapter , 5.

Killing Zombies, Working, Sleeping, and Spawning Children

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

Process Description and Control. Major Requirements of an Operating System

Major Requirements of an Operating System Process Description and Control

W4118: OS Overview. Junfeng Yang

Introduction to Linux

Underlying computer system = hardware + software

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

Linux Operating System

W4118 Operating Systems. Junfeng Yang

Process Description and Control. Chapter 3

Operating System. Operating System Overview. Layers of Computer System. Operating System Objectives. Services Provided by the Operating System

Operating System Overview. Operating System

Computer Fundamentals : Pradeep K. Sinha& Priti Sinha

INTRODUCTION TO OPERATING SYSTEMS. Jo, Heeseung

Chapter 3: Process Concept

Chapter 3: Process Concept

Introduction to Operating Systems

Today s class. Finish review of C Process description and control. Informationsteknologi. Tuesday, September 18, 2007

Operating Systems Overview. Chapter 2

Process Description and Control

3.1 Introduction. Computers perform operations concurrently

Process. Discussion session 3 1/30/2016

Introduction to Operating Systems. Jo, Heeseung

Operating System. Operating System Overview. Structure of a Computer System. Structure of a Computer System. Structure of a Computer System

Systems Programming. The Unix/Linux Operating System

PROCESS MANAGEMENT. Operating Systems 2015 Spring by Euiseong Seo

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

Lecture 5: Process Description and Control Multithreading Basics in Interprocess communication Introduction to multiprocessors

Logistics. 1: Welcome and Overview. Topics. What is an operating system? Benefits of Operating Systems (1) Hardware Resources

Operating System Labs. Yuanbin Wu

Kernels & Processes The Structure of the Operating System

CHAPTER 2: PROCESS MANAGEMENT

Processes. CS 475, Spring 2018 Concurrent & Distributed Systems

Chapter 3: Process Concept

THE PROCESS ABSTRACTION. CS124 Operating Systems Winter , Lecture 7

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

Processes and Threads. Processes and Threads. Processes (2) Processes (1)

Operating System Structure

UNIX rewritten using C (Dennis Ritchie) UNIX (v7) released (ancestor of most UNIXs).

Lecture 2 Process Management

Last Class: OS and Computer Architecture. Last Class: OS and Computer Architecture

CSC 539: Operating Systems Structure and Design. Spring 2006

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

Introduction to Linux

CMPSC 311- Introduction to Systems Programming Module: UNIX/Operating Systems

Kernel Types Simple OS Examples System Calls. Operating Systems. Autumn CS4023

Chapter 14 Operating Systems

518 Lecture Notes Week 3

CSC 453 Operating Systems

Operating Systems (ECS 150) Spring 2011

CPSC 341 OS & Networks. Processes. Dr. Yingwu Zhu

Process Description and Control. Chapter 3

1: Welcome and Overview COM S 414. Last Modified: 9/2/ :04:21 PM

Operating System Structure

CPS221 Lecture: Operating System Functions

CS 471 Operating Systems. Yue Cheng. George Mason University Fall 2017

Chapter 1: Introduction Operating Systems MSc. Ivan A. Escobar

CSC Operating Systems Spring Lecture - II OS Structures. Tevfik Ko!ar. Louisiana State University. January 17 th, 2007.

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

Announcements. Operating System Structure. Roadmap. Operating System Structure. Multitasking Example. Tevfik Ko!ar

Computer System Overview

Operating System Overview. Chapter 2

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

Processes and Threads

Roadmap. Tevfik Ko!ar. CSC Operating Systems Fall Lecture - III Processes. Louisiana State University. Processes. September 1 st, 2009

TYPES OF OPERATING SYSTEMS. Dimple Juneja

CSCE 313 Introduction to Computer Systems. Instructor: Dezhen Song

Basics of system administration on a Unix system

CSE 153 Design of Operating Systems Fall 2018

Overview: Concurrent Architectures - Unix: Forks and Pipes

CSCE 313: Intro to Computer Systems

Chapter 14 Operating Systems

Unix SVR4 (Open Solaris and illumos distributions) CPU Scheduling

The Operating System Machine Level

Transcription:

Lecture Topics Today: Operating System Overview (Stallings, chapter 2.1-2.4, 2.8-2.10) Next: Processes (Stallings, chapter 3.1-3.6) 1 Announcements Consulting hours posted Self-Study Exercise #3 posted Project #1 (due 9/13) Project #2 (due 9/20) 2

Major OS Functions Process and thread management process control: creation, termination, suspension, resumption, scheduling, resource allocation, etc. Memory management allocation/deallocation of computer memory, implementation of virtual memory, demand paging Interprocess (or interthread) communication signals, pipes, messages, events, semaphores, shared memory, etc. 3 Major OS Functions (cont.) I/O and device drivers character and block device management, handling interrupts, direct memory access (DMA), etc. File management file system implementation, memory-resident data structures, buffer cache, device files, etc. Network management sockets or equivalent, TCP/IP protocols, etc. 4

Linux Overview 5 System Call Interface Process Process Process System Calls System Call Interface. Other kernel functions Kernel 6

System Call Implementation System call: turns on kernel mode uses call number as index into table of function pointers jumps to actual function Return: turns off kernel mode jumps back to process with integer return value (status code) Process System Call Interface sys_open:.... 7 System Call Implementation Cumbersome to invoke system calls directly, so "wrapper" functions developed: int read( int fd, void *buf, size_t count ); int write( int fd, void *buf, size_t count ); int open( const char *pathname, int flags ); int close( int fd ); Those functions preprocess the arguments, invoke the appropriate system call, and postprocess the return value 8

Linux Overview 9 Linux Shells Two main "families" of shells: Bourne family sh (Bourne shell) bash (Bourne again shell) zsh (Z shell) C-shell family csh (C shell) tcsh (T shell) 10

Programming in a Linux Environment C/C++ provides access to: command-line arguments environment variables Sample programs: /user/cse410/examples/example04 /user/cse410/examples/example05 11 Programming in a Linux Environment Arguments to function "main": int main( int argc, char* argv[] ) argc number of command-line arguments argv array of pointers to strings Array terminated with a null pointer; each string is terminated with a null byte. 12

Evolution of Operating Systems Serial Processing Simple Batch Systems Multiprogrammed Batch Systems Time Sharing Systems 13 Serial Processing Earliest computers had no operating system programmers interacted directly with the hardware Users worked at a console with display lights, toggle switches, some input device, and a printer Load compiler, program (via card reader and/or tapes) Compile, link, run, in steps Errors indicated by lights on front panel Users had access to the computer in series (sign-up sheet!) 14

Batch Processing Much time was lost configuring a computer between one job and the next (setup and teardown time) The earliest operating systems were designed to address this problem batches of jobs loaded onto tape, executed sequentially by the OS first OS: GM Research Labs developed OS for IBM 701 15 Major Shift: Multiprogramming System resources underutilized Multiprogramming also called time sharing, multitasking Sharing a resource (e.g., computer) among users, such that each seems to have the whole machine Pauses by one user filled with work for another Need to store program state, quickly switch among user applications Key mechanism: interrupts 16

Multiprogrammed Batch Systems 17 Multiprogrammed Batch Systems 18

Time-Sharing Systems Can be used to handle multiple interactive jobs Processor time is shared among multiple users Multiple 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 19 Comparison Multiprogrammed batch vs time sharing systems Batch Multiprogramming Time Sharing Principal objective Maximize processor use Minimize response time Source of directives to operating system Job control language commands provided with the job Commands entered at the terminal 20

UNIX Beginnings 1969 - first UNIX system (mostly) Thompson at Bell Labs implemented in assembly language on DEC PDP-7 1970 - development of C Thompson and Dennis Ritchie port Unix to a PDP-11/20 Ritchie designs and writes the first C compiler Goal: high-level language for writing a portable OS 1972 - C implementation of UNIX Ritchie and Thompson rewrite the UNIX kernel in C. 21 AT&T s UNIX 1970s - free distribution of UNIX UNIX source code distributed freely to universities, due to marketing restrictions on AT&T, parent of Bell Labs First license: U. Illinois in 1974 (G. Chesson and D. Gillies) UNIX gains favor within the academic/research community 1984 - AT&T UNIX goes commercial January 1, 1984 - Divestiture of Bell System AT&T can enter new markets, including computers AT&T releases the commercial UNIX System V 22

Traditional UNIX Architecture 23 Traditional UNIX Kernel 24

UNIX Features Monolithic kernel (simple!) Clean design (originally) No complex recovery scheme Designed for programmers Many system calls, libraries Shells, scripts, standard I/O Fork/exec, pipes, signals, IPC Windowing with X11 (later) Tree-structured file system Simple file access/descriptors And many other features 25 UNIX and derivatives Originally developed at AT&T Bell Labs Derivatives: BSD UC Berkeley Mac OS -- Apple AIX IBM Solaris Sun Microsystems HP-UX Hewlett-Packard UNIX-like: Minix Tannenbaum Linux Torvalds 26

27 GNU (GNU s Not UNIX!) 1983 - In response to commercialization of UNIX, Richard Stallman starts the GNU Project Goal: create complete UNIX-compatible software system composed entirely of free software 1985 - Stallman creates Free Software Foundation 1989 - Stallman writes GNU General Public License Copyleft license: requires derived works to be available under the same copyleft. By early 1990 s, many programs (libraries, shells, etc) available, but kernel work was stalled. 28

Linux Andrew Tanenbaum had developed MINIX as a microkernel-based, UNIX-like OS for educational purposes. 1991 - Linus Torvalds develops Linux kernel as a student project Based in part on MINIX and Unix System V Wanted a free Unix-like, industrial strength OS Originally developed only for Intel x86 hardware; since then, has been ported to more platforms than any other OS 29 Linux Impact Linux made available under GNU Public License Many, many distributions of Linux, packaged with various configurations, have been available over the past 20+ years Torvalds continues to oversee kernel work, and Stallman still runs Free Software Foundation Linux continues to evolve: SMP kernel, demand-loadable modules Support for 64-bit processors Ever-expanding set of modules, new file systems And many others 30

Linux Impact Although desktop OS market is dominated by Windows versions, Linux has major share of other areas: Top 10 fastest supercomputers run Linux 95% of top 500 supercomputers run Linux 80% of smartphones use Android 33% of server market (65% for UNIX overall) 31 Big vs. Small One of the major historical debates is how OS should be designed: Monolithic kernel: kernel provides most OS services or Microkernel: kernel provides as little as possible; user-level servers provide most OS services 32

Monolithic Kernel vs. Microkernel 33 Monolithic Kernel All of the OS shares a common, protected address space, which executes in privileged mode Kernel performs all major functions of the OS System calls are made by trapping to kernel, which performs work on behalf of the process Traditional UNIX has a monolithic kernel 34

Microkernel-Based Systems Very small kernel provides only the most basic services to support processes and threads Low-level process management, memory management, interprocess communication, interrupt handling Servers (often running at user-level, but with high priority) provide all other OS functions full process management, virtual memory management and paging, file service, I/O, networking, system calls user process sends message to server, which does work and returns results 35 Implications for OS Design UNIX/Linux - monolithic kernel Mach microkernel OS developed at Carnegie Mellon University in 1980s Windows (NT) basis of current Windows versions Heavily influenced initially by microkernel concepts Has evolved toward monolithic kernel over the years Mac OS X Combines Mach microkernel with BSD Unix 36

OS and Processes All multiprogramming operating systems are built around the concept of the process Main issues: different process states, transitions among them process description (OS data structures) process control (switching between processes) 37 Definitions of "Process" An instance of a program running on a computer The entity that can be assigned to and executed on a processor A unit of activity characterized by the execution of a sequence of instructions, a current state, and an associated set of system resources 38

OS Requirements Interleave the execution of multiple processes to maximize processor utilization while providing reasonable response time Allocate resources to processes, based on policies and priorities Support inter-process communication 39 Background Computer platform consists of a collection of hardware resources OS provides a convenient, feature-rich, secure, and consistent interface for applications OS provides a uniform, abstract representation of resources that can be requested and accessed by applications 40

OS Manages Execution of Applications Resources made available to multiple applications Processor switched among multiple applications Processor and I/O devices used efficiently 41 Processes A process consists of (at least): code and data for executing program program counter (PC) and status register (PSW) general-purpose registers set of OS resources (open files, signals received, network connections, ) In other words, everything the OS needs to run the program -- or to re-start it, if it s interrupted at some point 42

Process Control Block All info about process Identifier State Priority Program counter Memory pointers Context data I/O status info Accounting info 43 Process Control Block PCB assigned to process when created OS maintains info in PCB while process is in existence OS moves PCBs between queues to manage system 44

Process States Behavior of process: sequence of instructions executed by that process (trace) Behavior of processor: interleaved sequences of instructions from individual processes Dispatcher (part of OS) switches the processor from one process to another 45 Example Assume no virtual memory: dispatcher and three processes are fully loaded into memory Program counter currently points to an address in Process B 46

Example (cont) 47 Example (cont) Assume timer interrupt after 6 clock cycles Assume dispatcher is at addresses 100-105 Assume dispatcher selects next process using "round robin" 48

Two-State Process Model 49 Process Creation Submission of a batch job User logs onto system OS creates to provide a service (ex: control print job) One process creates another process (ex: parent process spawns child process) 50

Process Termination Batch job terminates User logs off system Application halts normally Error (ex: segmentation fault) Parent process terminates child process 51 Execution patterns Execution of a process is usually a pattern: CPU burst followed by I/O burst (repeated) 52

Execution patterns CPU-bound processes have few bursts, but long bursts I/O-bound processes have many bursts, but short bursts Pattern varies within a process depends on actions within the process 53 Most processes: many short CPU bursts, few long CPU bursts 54