Computer Systems II. First Two Major Computer System Evolution Steps

Similar documents
Introduction to Processes

Basic Computer Hardware

Process Concepts. CSC400 - Operating Systems. 3. Process Concepts. J. Sumey

Chap 4, 5: Process. Dongkun Shin, SKKU

Processes and Non-Preemptive Scheduling. Otto J. Anshus

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

Announcements. Reading. Project #1 due in 1 week at 5:00 pm Scheduling Chapter 6 (6 th ed) or Chapter 5 (8 th ed) CMSC 412 S14 (lect 5)

CSC 2405: Computer Systems II

Mon Sep 17, 2007 Lecture 3: Process Management

Major Requirements of an OS

Process Description and Control. Chapter 3

Process Description and Control. Chapter 3

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

Chapter 3 Process Description and Control

CSC Operating Systems Spring Lecture - XII Midterm Review. Tevfik Ko!ar. Louisiana State University. March 4 th, 2008.

1 PROCESSES PROCESS CONCEPT The Process Process State Process Control Block 5

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

Processes. Dr. Yingwu Zhu

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

Operating System. Chapter 3. Process. Lynn Choi School of Electrical Engineering

THE PROCESS ABSTRACTION. CS124 Operating Systems Winter , Lecture 7

Ricardo Rocha. Department of Computer Science Faculty of Sciences University of Porto

Processes and Threads

PROCESS CONTROL BLOCK TWO-STATE MODEL (CONT D)

Processes. Operating System CS 217. Supports virtual machines. Provides services: User Process. User Process. OS Kernel. Hardware

Processes. CS 475, Spring 2018 Concurrent & Distributed Systems

Processes. Sanzheng Qiao. December, Department of Computing and Software

Roadmap. Tevfik Ko!ar. CSC Operating Systems Spring Lecture - III Processes. Louisiana State University. Virtual Machines Processes

CSC 1600 Unix Processes. Goals of This Lecture

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

Processes and More. CSCI 315 Operating Systems Design Department of Computer Science

Process Scheduling Queues

Process Time. Steven M. Bellovin January 25,

Process Description and Control. Chapter 3

Process a program in execution; process execution must progress in sequential fashion. Operating Systems

Operating Systems. Lecture 05

Process Description and Control

IT 540 Operating Systems ECE519 Advanced Operating Systems

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

Chapter 3 Processes. Process Concept. Process Concept. Process Concept (Cont.) Process Concept (Cont.) Process Concept (Cont.)

CS370: System Architecture & Software [Fall 2014] Dept. Of Computer Science, Colorado State University

Frequently asked questions from the previous class survey

CS510 Operating System Foundations. Jonathan Walpole

Dr. D. M. Akbar Hussain DE5 Department of Electronic Systems

Operating Systems CMPSCI 377 Spring Mark Corner University of Massachusetts Amherst

Process! Process Creation / Termination! Process Transitions in" the Two-State Process Model! A Two-State Process Model!

Process. Heechul Yun. Disclaimer: some slides are adopted from the book authors slides with permission

Operating Systems and Protection CS 217

Part V. Process Management. Sadeghi, Cubaleska RUB Course Operating System Security Memory Management and Protection

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

ECE 7650 Scalable and Secure Internet Services and Architecture ---- A Systems Perspective. Part I: Operating system overview: Processes and threads

CS 370 Operating Systems

Chapter 3: Processes. Operating System Concepts 9 th Edit9on

REVIEW OF COMMONLY USED DATA STRUCTURES IN OS

Process Description and Control. Major Requirements of an Operating System

Major Requirements of an Operating System Process Description and Control

CSE 380 Computer Operating Systems. Instructor: Insup Lee. University of Pennsylvania Fall 2003

Processes COMPSCI 386

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

CSC 4320 Test 1 Spring 2017

2 Processes. 2 Processes. 2 Processes. 2.1 The Process Model. 2.1 The Process Model PROCESSES OPERATING SYSTEMS

Jan 20, 2005 Lecture 2: Multiprogramming OS

Chapter 9: Virtual Memory

OS Main Goals. 10/24/2013 Operating Systems, Beykent University 1

Process. Heechul Yun. Disclaimer: some slides are adopted from the book authors slides with permission 1

Operating System Control Structures

Unix Processes. What is a Process?

Today: Process Management. The Big Picture So Far. What's in a Process? Example Process State in Memory

Chapter 3: Processes

Chapter 9: Virtual Memory. Operating System Concepts 9 th Edition

Announcements Processes: Part II. Operating Systems. Autumn CS4023

Chapter 3: Process Concept

Chapter 3: Process Concept

The Big Picture So Far. Today: Process Management

OS Structure, Processes & Process Management. Don Porter Portions courtesy Emmett Witchel

Processes, PCB, Context Switch

Getting to know you. Anatomy of a Process. Processes. Of Programs and Processes

Inf2C - Computer Systems Lecture 16 Exceptions and Processor Management

Chapter 3: Process Concept

Chapter 8: Virtual Memory. Operating System Concepts Essentials 2 nd Edition

Operating Systems. Computer Science & Information Technology (CS) Rank under AIR 100

Process Description and Control

Processes and Threads Implementation

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

Operating Systems Process description and control

Introduction. CS3026 Operating Systems Lecture 01

Lecture 4: Process Management

Course: Operating Systems Instructor: M Umair. M Umair

Chapter 9: Virtual-Memory

CSCE 313: Intro to Computer Systems

Operating System Structure

CSCE 313 Introduction to Computer Systems. Instructor: Dezhen Song

What is a Process? Processes and Process Management Details for running a program

CS399 New Beginnings. Jonathan Walpole

3.1 Introduction. Computers perform operations concurrently

Fall 2015 COMP Operating Systems. Lab #3

OS: An Overview. ICS332 Operating Systems

4. The Abstraction: The Process

2/14/2012. Using a layered approach, the operating system is divided into N levels or layers. Also view as a stack of services

What is a Process. Processes. Programs and Processes. System Classification 3/5/2013. Process: An execution stream and its associated state

Transcription:

Computer Systems II Introduction to Processes 1 First Two Major Computer System Evolution Steps Led to the idea of multiprogramming (multiple concurrent processes) 2 1

At First (1945 1955) In the beginning, there really wasn t an OS - Program binaries were loaded using switches - Interface included blinking lights (cool!) 3 OS Evolution: Step 1 Very simple OS (1955 1965) - Library of common subroutines read, write, etc. - Single programming (one application at a time) User Program Free memory!!! Operating system Program P. read. system call read begin Start I/O Wait for I/O to complete End I/O end Problem - system expensive, inefficient - Q: What to do while we wait for the I/O device? - A: Run more processes; when one blocks, switch to another 4 2

OS Evolution: Step 2 Multiprogramming (1965 1980) - Multiple running processes - When one process (job) blocks, switch to another 5 Multiprogramming Issues Processes (jobs) share the memory - What if a process starts scribbling in memory? Processes share the CPU - What if a program has infinite loops? 6 3

Multiprogramming Issue 1 Processes (jobs) share the memory - What if a process starts scribbling in memory? Solution: Protection - A program cannot access memory outside its own space - But what about the operating system? Solution: Two execution modes - user mode and system (supervisor, monitor) mode - OS executes in system mode, user programs in user mode. - Attempts to execute privileged instructions while in user mode results in a trap (to be discussed later). 7 Multiprogramming Issue 2 Processes (jobs) share the CPU - What if a program has infinite loops? Solution: Timer Interrupts - The OS sets the internal clock to generate an interrupt at some specified future time. - This interrupt time is the process quantum. - When the timer interrupt occurs, the CPU switches to another process. This prevents the system being held up by processes in infinite loops. 8 4

Timer Interrupts Multiprogramming is also called pseudoparallelism since one has the illusion of a parallel processor. Different from real parallelism in which two or more processes are actually running at once on two different processors. 9 Timer Interrupts Example Suppose P1, P2 and P3 are ready to run (in this order). P1 executes for 3 time units, P2 executes for 4 times units, and P2 executes for 2 time units. Neither process invokes I/O. Assuming that a timer interrupt occurs every time unit, fill in the table below: Time (in units) Running Ready to Run 1 2 3 4 5 6 7 8 9 10 5

Processes 11 Recall: Memory Layout of a Process local variables and function parameters global variables instructions (code) 12 6

Program vs. Process Program (passive, on disk) int global1 = 0; int global2 = 0; void DoSomething() { int local2 = 5; Process (active, in memory) Main Memory local 1 local 2 5 Stack local2 = local2 + 1;... } int main() { char local1[10]; } DoSomething();... global 1 global 2.start main.call DoSomething Data Text CPU Registers A process is a program in execution 13 What if More Processes in Memory? Each process has its own Code, Data, Heap and Stack P0 Free space P1 P2 Free space Stack Data Code OS 14 7

Process Creation (1) Modern general purpose operating systems permit a user to create and destroy processes. In Unix this is done by the fork system call, which creates a child process, and the exit system call, which terminates the current process. 15 Process Creation (2) After a fork, both parent and child keep running, and each can fork off other processes. A process tree results. The root of the tree is a special process created by the OS during startup. A process can choose to wait for children to terminate. For example, if C issued a wait() system call, it would block until G finished. 16 8

Bootstrapping When a computer is switched on or reset, there must be an initial program that gets the system running This is the bootstrap program - Initialize CPU registers, device controllers, memory - Load the OS into memory - Start the OS running OS starts the first process (such as init ) OS waits for some event to occur - Hardware interrupts or software interrupts (traps) 17 Process States and Transitions 18 9

Run, Blocked and Ready States Consider a running process P that issues an I/O request - The process blocks - At some later point, a disk interrupt occurs and the driver detects that P's request is satisfied. - P is unblocked, i.e. is moved from blocked to ready - At some later time the operating system picks P to run Ready: - Processes not allocated to the CPU, but ready to run Running: - Process (one!) allocated to the CPU Blocked: - Process waiting for event to occur before ready to run 19 Transitions Ready Running: Running Ready: Running Blocked: Blocked Ready: Suspend and Resume states will be discussed later (In the memory management module.) 20 10

When to Change the Running Process? When a process is stalled waiting for I/O - Better utilize the CPU, e.g., while waiting for disk read 1: 1: 2: 2: CPU I/O CPU I/O CPU I/O CPU I/O CPU I/O CPU I/O CPU I/O CPU I/O CPU I/O CPU I/O CPU I/O CPU I/O When a process has been running for a while - Sharing on a fine time scale to give each process the illusion of running on its own machine - Trade-off efficiency for a finer granularity of fairness 21 State Transition Example Suppose P2, P3, P4 are in this order in the Ready Queue, and that the following sequence of events occurs: Time 5: P1 invokes read Time 15: P2 invokes write Time 20: Interrupt (P1's read complete) Time 30: P3 terminates. Time 35: Interrupt (P2's write complete) Time 40: P4 terminates Time 45: P1 terminates Time Running Ready Blocked 5+ε 15+ε 20+ε 30+ε 35+ε 40+ε 45+ε Assume that processes are always appended at the end of a queue, and the first process in the queue is always scheduled. Fill in the table to show the process states after each event. 22 11

Switching Between Processes Context - State the OS needs to restart a preempted process, stored in the PCB Context switch - Save the context of current process - Restore the saved context of some previously preempted process - Pass control to this newly restored process Process 1 Process 2 Running Blocked Save context. Load context Blocked Running Running Save context. Load context Blocked 23 Context: What the OS needs to save Process identifier Process state New, ready, blocked, halted CPU registers I/O status information Open files, I/O requests, Memory management information Page tables (to be discussed later) CPU scheduling information Priority (to be discussed later) Process Control Block (PCB) most important data structure read and written by every OS module 24 12

Context Switching Revisited 25 Summary Process - Program in execution Multiprogramming - Processes executing concurrently - Take turns using the CPU Process States and Transitions - Run, Blocked and Ready - Suspend (on disk) and Resume Process Control Block - Information associated to each process Context Switching 26 13