Wednesday, September 14, Chapter 3: Processes

Similar documents
Process Description and Control. Chapter 3

Process Description and Control. Major Requirements of an Operating System

Major Requirements of an Operating System Process Description and Control

Process Description and Control

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

Process Description and Control. Chapter 3

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

Process Description and Control

IT 540 Operating Systems ECE519 Advanced Operating Systems

Major Requirements of an OS

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

CSCE Introduction to Computer Systems Spring 2019

Operating System Control Structures

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

PROCESS CONTROL BLOCK TWO-STATE MODEL (CONT D)

Process Description and Control. Chapter 3

Lecture 4: Process Management

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

Processes. CS3026 Operating Systems Lecture 05

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

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

Chapter 3 Process Description and Control

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

Process Description and Control

OPERATING SYSTEM. The Process. Introduction Process creation & termination Process state diagram Process scheduling & its criteria

Processes, PCB, Context Switch

Sistemi in Tempo Reale

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

Process. Discussion session 3 1/30/2016

CSCE 313: Intro to Computer Systems

CSCE 313 Introduction to Computer Systems. Instructor: Dezhen Song

! The Process Control Block (PCB) " is included in the context,

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

B.H.GARDI COLLEGE OF MASTER OF COMPUTER APPLICATION. Ch-3 Process Description and Control

Introduction to OS Processes in Unix, Linux, and Windows MOS 2.1 Mahmoud El-Gayyar

Concurrent programming: Introduction II. Anna Lina Ruscelli Scuola Superiore Sant Anna

Introduction to Processes in Computer Systems SEEM

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

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

Process Scheduling Queues

Computer Systems II. First Two Major Computer System Evolution Steps

Processes. Dr. Yingwu Zhu

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

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

Operating Systems. Lecture 05

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)

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

Processes COMPSCI 386

REVIEW OF COMMONLY USED DATA STRUCTURES IN OS

Processes in linux. What s s a process? process? A dynamically executing instance of a program. David Morgan. David Morgan

Killing Zombies, Working, Sleeping, and Spawning Children

Chap 4, 5: Process. Dongkun Shin, SKKU

Processes and Non-Preemptive Scheduling. Otto J. Anshus

CS 322 Operating Systems Practice Midterm Questions

PROCESS MANAGEMENT. Operating Systems 2015 Spring by Euiseong Seo

csci3411: Operating Systems

UNIT 3. PROCESS MANAGEMENT

CS 355 Operating Systems. Keeping Track of Processes. When are processes created? Process States 1/26/18. Processes, Unix Processes and System Calls

CSE 451: Operating Systems Winter Module 4 Processes. Mark Zbikowski Allen Center 476

Processes. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

A process. the stack

Process management. What s in a process? What is a process? The OS s process namespace. A process s address space (idealized)

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

Most of the work is done in the context of the process rather than handled separately by the kernel

CSC 539: Operating Systems Structure and Design. Spring 2006

THE PROCESS ABSTRACTION. CS124 Operating Systems Winter , Lecture 7

CS510 Operating System Foundations. Jonathan Walpole

OPERATING SYSTEM SUPPORT (Part 1)

Processes and Threads

Unix Processes. What is a Process?

CS 111. Operating Systems Peter Reiher

Operating Systemss and Multicore Programming (1DT089)

3.1 Introduction. Computers perform operations concurrently

ENGR 3950U / CSCI 3020U Midterm Exam SOLUTIONS, Fall 2012 SOLUTIONS

Processes. Johan Montelius KTH

Process Description and Control

csci3411: Operating Systems

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

@2010 Badri Computer Architecture Assembly II. Virtual Memory. Topics (Chapter 9) Motivations for VM Address translation

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

CS153: Process. Chengyu Song. Slides modified from Harsha Madhyvasta, Nael Abu-Ghazaleh, and Zhiyun Qian

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

CSE 410: Computer Systems Spring Processes. John Zahorjan Allen Center 534

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

CSE 153 Design of Operating Systems Fall 2018

Operating Systems CMPSCI 377 Spring Mark Corner University of Massachusetts Amherst

Following are a few basic questions that cover the essentials of OS:

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

OS 1 st Exam Name Solution St # (Q1) (19 points) True/False. Circle the appropriate choice (there are no trick questions).


Operating System. Chapter 4. Threads. Lynn Choi School of Electrical Engineering

SMD149 - Operating Systems

Chapter 3 Process Description and Control

The Big Picture So Far. Chapter 4: Processes

Process Concept. Minsoo Ryu. Real-Time Computing and Communications Lab. Hanyang University.

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

Prepared by Prof. Hui Jiang Process. Prof. Hui Jiang Dept of Electrical Engineering and Computer Science, York University

Process Concepts 8/21/2014. CS341: Operating System. Scheduling: Theoretical Analysis

Inf2C - Computer Systems Lecture 16 Exceptions and Processor Management

Process. Prepared by Prof. Hui Jiang Dept. of EECS, York Univ. 1. Process in Memory (I) PROCESS. Process. How OS manages CPU usage? No.

Transcription:

Chapter 3: Processes

Themes (so far) Computers solve problems Automate computation, scientific models OS evolved to solve problems Common I/O, shared HW, multitasking, protection Implementations vary, but concepts persist

Process Program in execution Instance of a running program Entity scheduled for CPU time Combination of code, state, and resources

How is this represented?

Process creation New batch job Interactive logon Provide OS service Spawning

Process termination Normal completion Time limit exceeded Memory unavailable Bounds violation Protection error Arithmetic error Time overrun I/O failure Invalid instruction Privileged instruction Data misuse Intervention Parent termination Parent request

New Admit Ready Dispatch Running Release Exit Timeout Event Occurs Event Wait Blocked Figure 3.6 Five-State Process Model

0xffffffff 0xc0000000 kernel 0xffffffff 0xc0000000 kernel 0xffffffff 0xc0000000 kernel code+data code+data code+data 0x00000000 0x00000000 0x00000000

0xffffffff 0xc0000000 kernel 0xffffffff 0xc0000000 kernel 0xffffffff 0xc0000000 kernel code+data code+data code+data 0x00000000 0x00000000 0x00000000 ready kernel blocked

0xffffffff 0xc0000000 kernel 0xffffffff 0xc0000000 kernel 0xffffffff 0xc0000000 kernel code+data code+data code+data 0x00000000 0x00000000 0x00000000 ready kernel blocked

0xffffffff 0xc0000000 kernel 0xffffffff 0xc0000000 kernel 0xffffffff 0xc0000000 kernel code+data code+data code+data 0x00000000 0x00000000 0x00000000 ready kernel blocked

Process A Process B Process C Dispatcher 0 5 10 15 20 25 30 35 40 45 50 = Running = Ready = Blocked Figure 3.7 Process States for Trace of Figure 3.4

ready ready blocked new blocked ready

ready ready new blocked blocked ready

ready ready ready blocked blocked ready

ready ready ready blocked suspended ready

Suspended process Not immediately available for execution May or may not be waiting Suspended by an agent Agent must explicitly un-suspend

Process representation Code Data Associated resources

Code: (program.c) #include <stdio.h> #include <fcntl.h> int main() { int f; size_t s; char c[10]; f = open("program.c",o_rdonly); printf ("f = %d\n",f); } s = read(f, c, 9); c[9] = '\0'; printf("c is '%s'\n",c); close(f); return 0;

Code: (program.c) #include <stdio.h> #include <fcntl.h> Output: f = 3 c is #include int main() { int f; size_t s; char c[10]; f = open("program.c",o_rdonly); printf ("f = %d\n",f); } s = read(f, c, 9); c[9] = '\0'; printf("c is '%s'\n",c); close(f); return 0;

Code: (program.c) #include <stdio.h> #include <fcntl.h> int main() { int f; size_t s; char c[10]; f = open("program.c",o_rdonly); printf ("f = %d\n",f); Output: f = 3 c is #include 0 = stdin 1 = stdout 2 = stderr } s = read(f, c, 9); c[9] = '\0'; printf("c is '%s'\n",c); close(f); return 0;

Process location

Process location 0xffffffff +----------------------------------+ kernel 0xc0000000 +----------------------------------+ user V grows downward grows upward ^ user heap +----------------------------------+ uninitialized data segment (BSS) +----------------------------------+ initialized data segment +----------------------------------+ code segment 0x08084000 +----------------------------------+ 0 +----------------------------------+

Process location code + data + 0xffffffff +----------------------------------+ kernel 0xc0000000 +----------------------------------+ user V grows downward grows upward ^ user heap +----------------------------------+ uninitialized data segment (BSS) +----------------------------------+ initialized data segment +----------------------------------+ code segment 0x08084000 +----------------------------------+ 0 +----------------------------------+

Process location attributes () code + data + 0xffffffff +----------------------------------+ kernel 0xc0000000 +----------------------------------+ user V grows downward grows upward ^ user heap +----------------------------------+ uninitialized data segment (BSS) +----------------------------------+ initialized data segment +----------------------------------+ code segment 0x08084000 +----------------------------------+ 0 +----------------------------------+

Process location Memory Storage 0xffffffff +----------------------------------+ kernel 0xc0000000 +----------------------------------+ user V grows downward grows upward ^ user heap +----------------------------------+ uninitialized data segment (BSS) +----------------------------------+ initialized data segment +----------------------------------+ code segment 0x08084000 +----------------------------------+ 0 +----------------------------------+

Process location Memory Storage 0xffffffff +----------------------------------+ kernel 0xc0000000 +----------------------------------+ user V grows downward grows upward ^ user heap +----------------------------------+ uninitialized data segment (BSS) +----------------------------------+ initialized data segment +----------------------------------+ code segment 0x08084000 +----------------------------------+ 0 +----------------------------------+

Process location Memory Storage 0xffffffff +----------------------------------+ kernel 0xc0000000 +----------------------------------+ user V grows downward grows upward ^ user heap +----------------------------------+ uninitialized data segment (BSS) +----------------------------------+ initialized data segment +----------------------------------+ code segment 0x08084000 +----------------------------------+ 0 +----------------------------------+

Process attributes Process identification PID, PPID, UID Processor state information User-visible registers, control/status registers (PC, etc.), pointers Process control information Scheduling (state, priority, events), pointers to other, IPC, privileges, memory mgmt., resources

proc int

int hdlr proc int

int hdlr kernel proc int irt

int hdlr kernel proc proc int irt int

int hdlr kernel int hdlr proc proc int irt int int

Process creation 1. Assign unique PID 2. Allocate space 3. Initialize 4. Set linkages 5. Create/expand data structures

Process switching When? Interrupt, trap, supervisor (system) call How? Mode switch vs. context switch

kernel kernel code code gen reg CPU ctl reg vm reg pc code+data code+data

kernel kernel code code gen reg CPU ctl reg vm reg pc code+data code+data

kernel code INT ==> Mode switch kernel code gen reg CPU ctl reg vm reg pc code+data code+data

kernel kernel code code gen reg CPU ctl reg vm reg pc code+data code+data

kernel kernel code code gen reg CPU ctl reg vm reg pc code+data code+data

kernel kernel code code gen reg CPU ctl reg vm reg pc code+data code+data

kernel kernel code code gen reg CPU ctl reg vm reg pc code+data code+data

kernel code Control registers PC Kernel pointer User pointer PSW (x86 EFLAGS) CR0, CR1, CR2, CR3 (for VM) kernel code gen reg CPU ctl reg vm reg pc code+data code+data

Context switch 1. Save CPU context 2. Update of running process 3. Move to queue 4. Select next process 5. Update of new process 6. Update memory management 7. Restore context of selected process