Chapter 3 Process Description and Control

Similar documents
Chapter 3: Processes. Operating System Concepts 8th Edition,

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

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

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

Chapter 3: Process-Concept. Operating System Concepts 8 th Edition,

Processes. Process Concept

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

Outlook. Process Concept Process Scheduling Operations on Processes. IPC Examples

Lecture 2 Operating System Structures (chapter 2)

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

Chapter 3: Processes. Chapter 3: Processes. Process in Memory. Process Concept. Process State. Diagram of Process State

Operating Systems & Concurrency: Process Concepts

OS lpr. www. nfsd gcc emacs ls 1/27/09. Process Management. CS 537 Lecture 3: Processes. Example OS in operation. Why Processes? Simplicity + Speed

Chapter 3: Processes. Operating System Concepts 8th Edition, modified by Stewart Weiss

Operating System Services

OS lpr. www. nfsd gcc emacs ls 9/18/11. Process Management. CS 537 Lecture 4: Processes. The Process. Why Processes? Simplicity + Speed

Chapter 2: Operating-System Structures

Chapter 3: Processes. Operating System Concepts 8 th Edition,

Objectives. Chapter 2: Operating-System Structures. 2.1 Operating System Services

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

Chapter 3: Processes. Operating System Concepts 8 th Edition,

Chapter 2: Operating-System Structures. Chapter 2: Operating-System Structures. Objectives. Operating System Services

Chapter 2: Operating-System

Windows architecture. user. mode. Env. subsystems. Executive. Device drivers Kernel. kernel. mode HAL. Hardware. Process B. Process C.

Chapter 2: System Structures

Chapter 3: Processes. Operating System Concepts Essentials 8 th Edition

Processes CHAPTER CHAPTER OBJECTIVES. 3.1 Process Concept

Chapter 3 Process Description and Control

www nfsd emacs lpr Process Management CS 537 Lecture 4: Processes Example OS in operation Why Processes? Simplicity + Speed

COP 4610: Introduction to Operating Systems (Spring 2016) Chapter 3: Process. Zhi Wang Florida State University

COP 4610: Introduction to Operating Systems (Spring 2014) Chapter 3: Process. Zhi Wang Florida State University

Part Two - Process Management. Chapter 3: Processes

Fall 2015 COMP Operating Systems. Lab #3

Chapter 3: Process Concept

Chapter 3: Process Concept

Chapter 2: Operating-System Structures

CS510 Operating System Foundations. Jonathan Walpole

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

Chapter 2: Operating-System Structures

Operating Systems. Designed and Presented by Dr. Ayman Elshenawy Elsefy

Chapter 3: Process Concept

CHAPTER 2: SYSTEM STRUCTURES. By I-Chen Lin Textbook: Operating System Concepts 9th Ed.

CHAPTER 2: PROCESS MANAGEMENT

Chapter 3: Processes. Operating System Concepts 8 th Edition,

SE350: Operating Systems

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

Chapter 4: Processes. Process Concept. Process State

Chapter 3: Process Concept

What Is A Process? Process States. Process Concept. Process Control Block (PCB) Process State Transition Diagram 9/6/2013. Process Fundamentals

Process Description and Control. Chapter 3

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

Chapter 4: Processes. Process Concept

Last time: introduction. Networks and Operating Systems ( ) Chapter 2: Processes. This time. General OS structure. The kernel is a program!

Operating System: Chap2 OS Structure. National Tsing-Hua University 2016, Fall Semester

Chapter 3: Processes

Chapter 4: Processes

Processes and Threads

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

Process. Operating Systems (Fall/Winter 2018) Yajin Zhou ( Zhejiang University

CSCE 313: Intro to Computer Systems

CSCE 313 Introduction to Computer Systems. Instructor: Dezhen Song

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

Operating Systems CMPSCI 377 Spring Mark Corner University of Massachusetts Amherst

CSC 716 Advanced Operating System Fall 2007 Exam 1. Answer all the questions. The maximum credit for each question is as shown.

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

The Big Picture So Far. Today: Process Management

Operating-System Structures

csci3411: Operating Systems

Processes. Electrical and Computer Engineering Stephen Kim ECE/IUPUI RTOS & Apps 1

CHAPTER 3 - PROCESS CONCEPT

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

Processes. Operating System Concepts with Java. 4.1 Sana a University, Dr aimen

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

Chapter 3: Processes. Operating System Concepts 8th Edition

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

Lecture 2 Process Management

Notice: This set of slides is based on the notes by Professor Perrone of Bucknell and the textbook authors Silberschatz, Galvin, and Gagne

UNIX Processes. by Armin R. Mikler. 1: Introduction

The Big Picture So Far. Chapter 4: Processes

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

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

The Big Picture So Far. Chapter 4: Processes

CS307: Operating Systems

Diagram of Process State Process Control Block (PCB)

Lecture 2 - Fundamental Concepts

Chapter 3: Processes. Operating System Concepts Essentials 2 nd Edition

CSC 539: Operating Systems Structure and Design. Spring 2006

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

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

REVIEW OF COMMONLY USED DATA STRUCTURES IN OS

Chapter 3: Processes

Operating Systems. Lecture 05

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

CS 322 Operating Systems Practice Midterm Questions

Major Requirements of an OS

CS307 Operating Systems Processes

Processes. Process Concept. The Process. The Process (Cont.) Process Control Block (PCB) Process State

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

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

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

Transcription:

Operating Systems: Internals and Design Principles Chapter 3 Process Description and Control Seventh Edition By William Stallings

Example of Standard API Consider the ReadFile() function in the Win32 API a function for reading from a file A description of the parameters passed to ReadFile() HANDLE file the file to be read LPVOID buffer a buffer where the data will be read into and written from DWORD bytestoread the number of bytes to be read into the buffer LPDWORD bytesread the number of bytes read during the last read LPOVERLAPPED ovl indicates if overlapped I/O is being used

Traditional UNIX Systems

Micro-Kernel

Micro-Kernel In the mid 1980s, researchers at Carnegie Mellon developed the Mach microkernel OS Moves nonessential components from the kernel into user space resulting in a smaller kernel Main function of the microkernel is to provide a communication facility between the client program and various services that are also running in user space o Communication takes place between user modules using message passing. Benefits: easier to extend a microkernel o all new services are added to user space easier to port the operating system to new architectures more reliable and secure o less code is running in kernel mode

Process A process (sometimes called a task, or a job) is, informally, a program in execution Everything necessary to resume the process execution if it is somehow put aside temporarily

PCB For every process, the OS maintains a Process Control Block (PCB), a data structure that represents the process and its state. Process id number User-id of owner Memory space (static, dynamic) Program Counter, Stack Pointer, general purpose registers Process state (running, not-running, etc.) CPU scheduling information (e.g., priority) List of open files I/O states, I/O in progress Pointers into CPU scheduler s state queues (e.g., the waiting queue)

Process Control Block

Control Tables

PCB

PCB (Summary) ID State information SP General Purpose Registers PC PSW Control Information Open Files Allocated Memory Data Structures I/O Scheduling

Operating System Role in Process Management The operating system is responsible for the following activities in connection with process management. Process creation and deletion. Process suspension and resumption. Provision of mechanisms for: process synchronization process communication

UNIX Process Creation int main() { Pid_t pid; /* fork another process */ pid = fork(); if (pid < 0) { /* error occurred */ fprintf(stderr, "Fork Failed"); exit(-1); } else if (pid == 0) { /* child process */ execlp("/bin/ls", "ls", NULL); } else { /* parent process */ /* parent will wait for the child to complete */ wait (NULL); printf ("Child Complete"); exit(0); } }

#include <stdio.h> #include <windows.h> int main (VOID) { STARTUPINFO si; PROCESS_INFORMATION pi; Windows Process Creation //allocates memory ZeroMemory(&si, sizeof(si)); si.cb = sizeof(si); ZeroMemory(&pi, sizeof(pi)); //create child process If (!CreateProcess(NULL, C:\\WINDOWS\system32\\mspaint.exe,NULL,NULL,FALSE,0, NULL, NULL,&si, &pi)) { fprint(stderr, Create Process Failed ); return -1; } //parent will wait for the child to complete WaitForSingleObject(pi.hProcess, INFINITE); Printf( Child Complete ); //close handles CloseHandle(pi.hProcess); CloseHandle(pi.hThread); }

Process model with 2 suspended states

Structure of Process Images in Virtual Memory

How to do SWITCH??? 1.Mode Switch 2.Context Switch 3.Process Switch

Non-Process Kernel Types of Exe within Userprocess Kernel Process based Kernel

Cooperating Processes Independent process cannot affect or be affected by the execution of another process. Cooperating process can affect or be affected by the execution of another process Advantages of process cooperation Information sharing Computation speed-up via parallel sub-tasks Modularity by dividing system functions into separate processes Convenience - even an individual may want to edit, print and compile in parallel